PHP 7.3 / print_r($GLOBALS) causes “Fatal error: Allowed memory size”












0















We've just upgraded to PHP 7.3 and are experiencing some strange behaviour.



When I try to run the following code PHP crashes with the error message



Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 534777856 bytes) in /............./test.php on line 2


Code:



<?php
print_r($GLOBALS);
?>


As you see it's a really simple script with only one line of code. var_export works and shows the content correctly. Increasing the memory limit only delays the crash. In PHP 5.6 it's working as it's supposed to.



Did any of you experience the same behaviour with PHP 7.3? Do you have any tips apart from not using print_r?



Thanks



PS: That's the correct output of var_export, so $GLOBALS is really far away from being as big as suggested in the error message:



array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> *RECURSION* } } 









share|improve this question























  • no, this is a php default recursion. $GLOBALS is a part of itself - has always been. And: I couldn't change this, it's only one line of code. This has been working since the dawn of time :-)

    – Andi
    Jan 2 at 10:35











  • Seems like a 7.3 bug. 3v4l.org/AdLgJ

    – Jonnix
    Jan 2 at 10:43













  • thanks... I've posted a bug report for the developers.

    – Andi
    Jan 2 at 11:40


















0















We've just upgraded to PHP 7.3 and are experiencing some strange behaviour.



When I try to run the following code PHP crashes with the error message



Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 534777856 bytes) in /............./test.php on line 2


Code:



<?php
print_r($GLOBALS);
?>


As you see it's a really simple script with only one line of code. var_export works and shows the content correctly. Increasing the memory limit only delays the crash. In PHP 5.6 it's working as it's supposed to.



Did any of you experience the same behaviour with PHP 7.3? Do you have any tips apart from not using print_r?



Thanks



PS: That's the correct output of var_export, so $GLOBALS is really far away from being as big as suggested in the error message:



array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> *RECURSION* } } 









share|improve this question























  • no, this is a php default recursion. $GLOBALS is a part of itself - has always been. And: I couldn't change this, it's only one line of code. This has been working since the dawn of time :-)

    – Andi
    Jan 2 at 10:35











  • Seems like a 7.3 bug. 3v4l.org/AdLgJ

    – Jonnix
    Jan 2 at 10:43













  • thanks... I've posted a bug report for the developers.

    – Andi
    Jan 2 at 11:40
















0












0








0








We've just upgraded to PHP 7.3 and are experiencing some strange behaviour.



When I try to run the following code PHP crashes with the error message



Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 534777856 bytes) in /............./test.php on line 2


Code:



<?php
print_r($GLOBALS);
?>


As you see it's a really simple script with only one line of code. var_export works and shows the content correctly. Increasing the memory limit only delays the crash. In PHP 5.6 it's working as it's supposed to.



Did any of you experience the same behaviour with PHP 7.3? Do you have any tips apart from not using print_r?



Thanks



PS: That's the correct output of var_export, so $GLOBALS is really far away from being as big as suggested in the error message:



array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> *RECURSION* } } 









share|improve this question














We've just upgraded to PHP 7.3 and are experiencing some strange behaviour.



When I try to run the following code PHP crashes with the error message



Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 534777856 bytes) in /............./test.php on line 2


Code:



<?php
print_r($GLOBALS);
?>


As you see it's a really simple script with only one line of code. var_export works and shows the content correctly. Increasing the memory limit only delays the crash. In PHP 5.6 it's working as it's supposed to.



Did any of you experience the same behaviour with PHP 7.3? Do you have any tips apart from not using print_r?



Thanks



PS: That's the correct output of var_export, so $GLOBALS is really far away from being as big as suggested in the error message:



array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> array(5) { ["_GET"]=> array(0) { } ["_POST"]=> array(0) { } ["_COOKIE"]=> array(3) { ["xxxx_username"]=> string(4) "xxxx" ["printcounter"]=> string(1) "4" ["PHPSESSID"]=> string(32) "793b64887bb8b857515748bbb3d7c5cb" } ["_FILES"]=> array(0) { } ["GLOBALS"]=> *RECURSION* } } 






php memory size






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Jan 2 at 10:21









AndiAndi

11




11













  • no, this is a php default recursion. $GLOBALS is a part of itself - has always been. And: I couldn't change this, it's only one line of code. This has been working since the dawn of time :-)

    – Andi
    Jan 2 at 10:35











  • Seems like a 7.3 bug. 3v4l.org/AdLgJ

    – Jonnix
    Jan 2 at 10:43













  • thanks... I've posted a bug report for the developers.

    – Andi
    Jan 2 at 11:40





















  • no, this is a php default recursion. $GLOBALS is a part of itself - has always been. And: I couldn't change this, it's only one line of code. This has been working since the dawn of time :-)

    – Andi
    Jan 2 at 10:35











  • Seems like a 7.3 bug. 3v4l.org/AdLgJ

    – Jonnix
    Jan 2 at 10:43













  • thanks... I've posted a bug report for the developers.

    – Andi
    Jan 2 at 11:40



















no, this is a php default recursion. $GLOBALS is a part of itself - has always been. And: I couldn't change this, it's only one line of code. This has been working since the dawn of time :-)

– Andi
Jan 2 at 10:35





no, this is a php default recursion. $GLOBALS is a part of itself - has always been. And: I couldn't change this, it's only one line of code. This has been working since the dawn of time :-)

– Andi
Jan 2 at 10:35













Seems like a 7.3 bug. 3v4l.org/AdLgJ

– Jonnix
Jan 2 at 10:43







Seems like a 7.3 bug. 3v4l.org/AdLgJ

– Jonnix
Jan 2 at 10:43















thanks... I've posted a bug report for the developers.

– Andi
Jan 2 at 11:40







thanks... I've posted a bug report for the developers.

– Andi
Jan 2 at 11:40














0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54004584%2fphp-7-3-print-rglobals-causes-fatal-error-allowed-memory-size%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54004584%2fphp-7-3-print-rglobals-causes-fatal-error-allowed-memory-size%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

MongoDB - Not Authorized To Execute Command

in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith

How to fix TextFormField cause rebuild widget in Flutter