New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Fatal Error 'yii\base\ErrorException' with message 'Allowed memory size of 134217728 bytes exhausted (tried to allocate 20480 bytes)' #3
Comments
The provided JSON file contains subtree This might go out of memory: $accounts = JsonMachine::fromFile('data.json'); because it iterates the top level and your code in foreach will be given This will work: (tested on provided file) $accounts = JsonMachine::fromFile('data.json', '/accounts'); because it will lazy iterate the huge array at |
Closing as not a bug. Feel free to comment if needed. |
Hi Halaxa, I'm getting the same error with this code:
The response looks like this:
I tried |
Hi @Mwisho, I apologize for the possibly misleading guzzle example. The Try: ...
// Gets PHP stream resource from Guzzle stream
$phpStream = \GuzzleHttp\Psr7\StreamWrapper::getResource($respose->getBody());
foreach (\JsonMachine\JsonMachine::fromStream($phpStream) as $product) {
var_dump($product['information']);
} |
Thanks for your fast response and the fix! |
in /var/www/html/vendor/halaxa/json-machine/src/Parser.php:181
FILE:
https://mega.nz/#!SUchmYSA
key is
8nEKU0-JUQzx39x8V1_my_dELb71C12rG5knMULEySc
The text was updated successfully, but these errors were encountered: