Closed am-adnbp closed 6 years ago
@am-adnbp the UUID library we are using should be utilizing a fallback to a polyfill when not using PHP 7+.
Could you verify the polyfill library is installed, and if so which version, by running composer show
please?
guzzlehttp/guzzle dev-master c7faf23 Guzzle is a PHP HTTP client library guzzlehttp/promises dev-master 136531a Guzzle promises library guzzlehttp/psr7 dev-master 4b981cd PSR-7 message implementation that also provides common utility methods monolog/monolog 1.x-dev c465e11 Sends your logs to files, sockets, inboxes, databases and various web services paragonie/random_compat v9.99.99 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7 phpseclib/phpseclib 2.0.x-dev f381b1f PHP Secure Communications Library - Pure-PHP implementations of RSA, AES, SSH2, SFTP, X.509 etc. psr/cache dev-master 78c5a01 Common interface for caching libraries psr/http-message dev-master f6561bf Common interface for HTTP messages psr/log dev-master 3490ba5 Common interface for logging libraries ralouphie/getallheaders 2.0.5 A polyfill for getallheaders. ramsey/uuid 3.x-dev 4c467ce Formerly rhumsaa/uuid. A PHP 5.4+ library for generating RFC 4122 version 1, 3, 4, and 5 universally unique identifiers (UUID). rize/uri-template 0.3.2 PHP URI Template (RFC 6570) supports both expansion & extraction symfony/polyfill-ctype dev-master e3d8262 Symfony polyfill for ctype functions
Thanks for the verification.
I tested out deploying the script you shared with the following debug information at the end:
echo 'Bytes: ' . random_bytes(5) . '<br/>';
echo 'PHP Version: ' . phpversion() . '<br/>';
echo 'Total queried rows: ' . $queryResults->info()['totalRows'];
It appears the polyfill is working on my end when using app engine standard, as I received the following output:
My first thought is to try removing your vendor directory and composer.lock file if one exists and then re-install. If that doesn't do the trick, could you please share your composer.json, app.yaml, and php.ini?
Receiving support from Google cases, they suggest to downgrade ramsey to 3.7.3, so I changed composer.json indicating to install "ramsey/uuid": "3.7.3"
And it worked!. :)
That's great :)
After looking a bit more at the versions of the dependencies you have installed, it appears most of them are dev branches. Does your composer file have minimum-stability
set to dev
? I'd caution against this as there could be other gotchas/breaking changes in the dependencies we rely on. If you need to keep the stability at that level, I'd recommend setting the prefer-stable
flag to true
if possible.
Very useful, Thank you!!.
Trying to run the example code over Standard appengine:
The Google logs show the following error:
PHP Fatal error: Call to undefined function Ramsey\Uuid\Generator\random_bytes() in /base/data/home/apps/e~cloudframework-io/api:1.412536651015598677/vendor/ramsey/uuid/src/Generator/RandomBytesGenerator.php on line 35
Following the error it seems that in RandomBytesGenerator.php uses the php command random_bytes() only available for PHP7 but Appengine Standard only allows to run php5.5
What can I do?