| [13:26:40] | <edbob[m]> | fyi - i tried enabling the https://www.drupal.org/project/webhooks module and wiring it up on asset create/update. but when i edited my dog (animal asset) it threw an error: |
| [13:26:40] | <edbob[m]> | > TypeError: strpos(): Argument #1 ($haystack) must be of type string, null given in strpos() (line 101 of /opt/drupal/web/profiles/farm/modules/core/geo/src/Normalizer/ContentEntityGeometryNormalizer.php). |
| [13:26:40] | <edbob[m]> | i'm guessing this means it tries to build a field payload and just b/c an asset "can" have geometry, it assumes it "does" ..? anyway i can make an issue somewhere if you want, but i may just consider this the first of (too?) many hurdles and move on to something else for now. webhooks would be nice to have someday perhaps but it's not really vital for my use case |
| [13:28:31] | <mstenta[m]> | Actually that looks like a minor bug in farmOS... |
| [13:28:51] | <mstenta[m]> | Would be an easy pull request if you want to contibute :-) |
| [13:29:11] | <edbob[m]> | hm i assumed it was part of "core" as in drupal core.. |
| [13:29:19] | <mstenta[m]> | https://github.com/farmOS/farmOS/blob/955695115602aa7efaa25f26c69d9d20ff... |
| [13:29:24] | <mstenta[m]> | That's the line |
| [13:29:31] | <edbob[m]> | maybe i'll take a closer look then, after a break. thanks for the link! |
| [13:29:59] | <mstenta[m]> | It's checking strpos($format, 'geometry_') === 0 ... but strpos() doesn't allow NULL arguments, and $format is NULL in your case. |
| [13:30:24] | <mstenta[m]> | So that's just bad type checking in that code |
| [13:30:37] | <edbob[m]> | also i still need to get a dev setup for farmOS, i've been running w/ podman locally as well as prod. this is a good excuse to finally get over that hump i guess |
| [13:30:59] | <mstenta[m]> | Maybe should be something like: |
| [13:30:59] | <mstenta[m]> | `return $data instanceof ContentEntityInterface && !is_null($format) && strpos($format, 'geometry_') === 0;` |
| [13:31:13] | <mstenta[m]> | (checking !is_null($format) first) |
| [13:33:08] | <mstenta[m]> | (There's also a better way to check if the string starts with geometry_ too: str_starts_with($format, 'geometry_')) |
| [13:33:29] | <mstenta[m]> | (That was added in PHP 8, our code could be updated to make use of that) |
| [13:34:33] | <mstenta[m]> | Regarding "webhooks" more generally... yea! It feels like that would be a nice core feature of farmOS! |
| [13:35:04] | <mstenta[m]> | Whether we use https://www.drupal.org/project/webhooks or roll our own is the question... so testing that module out is a good first step :-) |