Open daveHT opened 1 year ago
@daveHT Interesting issue thank you for reaching out. We will investigate!
Any resolution on this? Every time I do a composer update my simple fix above gets overwritten so it would be nice to get this in (or addressed some other way)
@daveHT do you still experience this issue? For me it seems to work without your "hack". Regards Tino
@tinora @emawby where can i find the user key token and app key token
What happened?
When I try to follow the tutorial for the basic set up I'm getting an internal error
include(StringMap.php): Failed to open stream: No such file or directory
Note that the code from the tutorial works totally fine (I am able to create the StringMap and dispatch the notification) as per the snippet below
function createNotification($enContent): Notification { $content = new StringMap(); $content->setEn($enContent); $notification = new Notification(); $notification->setAppId(APP_ID); $notification->setContents($content); $notification->setIncludedSegments(['Subscribed Users']); return $notification; }
The error is happening deep inside the OneSignal SDK code inside ObjectSerializer.php.
vendor/onesignal/onesignal-php-api/lib/ObjectSerializer.php(93): is_callable()
The call to is_callable() is failing (can't find StringMap).
Interestingly I have no problems including and creating my own StringMaps (along with other OneSignal types) so it's not a dependency issue that I can see. (I'm not ruling out an issue with my composer setup but all else seems to be working).
In ObjectSerializer.php there one line before the offending line there is long list of allowable types that it checks that skip the call to is_callable(). I added StringMap to that list, and everything works perfectly after that. Obviously this solution is a bit of a hack, but it's interesting that everything works after I do that small change (I can get notifications to show up on devices and there are no errors).
if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'double', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void', 'StringMap'], true)) { $callable = [$openAPIType, 'getAllowableEnumValues']; if (is_callable($callable)) { ......
I talked to support and they advised that they are forwarding to the dev team but also said that I should post here to understand what is happening and see whether this is a bug or issue with my setup.
Thanks!
Steps to reproduce?
What did you expect to happen?
I expected there to be no error that it couldn't find StringMap.php
Relevant log output
No response
Code of Conduct