You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
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?
1. follow tutorial for basic setup. 2 app crashes with error above
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
I agree to follow this project's Code of Conduct
The text was updated successfully, but these errors were encountered:
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)
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
The text was updated successfully, but these errors were encountered: