Problem/Motivation
On installing the extension I got the following error:
Error: Call to undefined function Drupal\jsonapi_role_access\EventSubscriber\str_starts_with() in Drupal\jsonapi_role_access\EventSubscriber\CheckUserRolePermissionEvent->checkUserRoleAccess() (line 73 of modules/contrib/jsonapi_role_access/src/EventSubscriber/CheckUserRolePermissionEvent.php).
Steps to reproduce
Install the extension on a system running a version of php less than 8.0
Proposed resolution
A polyfill which first tries to call the "str_starts_with" else falls back to the polyfill.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | jsonapi_role_access-3168679-2.patch | 1.16 KB | 3li |
Comments
Comment #2
3liComment #4
arshadkhan35 commentedThanks @Eli.Stone for the patch it looks good except for some variables description and data type missing in function comment doc, just to add the str_starts_with function is available from PHP 7.4 onward as I have tested on PHP7.4 and its working perfectly fine, it will throw exception for lower version hence accepting your proposed solution.
Comment #5
arshadkhan35 commented