Bug #53663 [Com]: fatal error with bad memory allocation in a script echo & exit

From: Date: Thu, 06 Jan 2011 08:17:17 +0000
Subject: Bug #53663 [Com]: fatal error with bad memory allocation in a script echo & exit
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-157655@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=53663&edit=1

 ID:                 53663
 Comment by:         sskaje at gmail dot com
 Reported by:        sskaje at gmail dot com
 Summary:            fatal error with bad memory allocation in a script
                     echo & exit
 Status:             Open
 Type:               Bug
 Package:            *Web Server problem
 Operating System:   Linux/CentOS
 PHP Version:        5.3.4
 Block user comment: N
 Private report:     N

 New Comment:

The original script is like 

<?php

require(__DIR__ . '/blahsparent.php');
class blahblah extends blahsparent
{
    
}

new blahblah;

only if __halt_compiler(); was added before the line of 'class ....',
error would not be triggered.


Previous Comments:
------------------------------------------------------------------------
[2011-01-06 09:13:04] sskaje at gmail dot com

In fact, there are also error logs in httpd error-log:

[Thu Jan 06 15:15:41 2011] [error] [client 172.16.1.123] PHP Fatal
error:  Allowed memory size of 134217728 bytes exhausted (tried to
allocate 543450464 bytes) in Unknown on line 0
[Thu Jan 06 15:16:27 2011] [error] [client 172.16.1.123] PHP Fatal
error:  Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1735355393 bytes) in Unknown on line 0
[Thu Jan 06 15:16:27 2011] [error] [client 172.16.1.123] PHP Fatal
error:  Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1999598178 bytes) in Unknown on line 0
[Thu Jan 06 15:16:27 2011] [error] [client 172.16.1.123] PHP Fatal
error:  Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1999598178 bytes) in Unknown on line 0
[Thu Jan 06 15:16:27 2011] [error] [client 172.16.1.123] PHP Fatal
error:  Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1999598178 bytes) in Unknown on line 0
[Thu Jan 06 15:16:28 2011] [error] [client 172.16.1.123] PHP Fatal
error:  Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1999598178 bytes) in Unknown on line 0

And the 'PHP Fatal error: Exception thrown without a stack frame in
Unknown on line 0' might not be logged by this test script. 

Sorry.

------------------------------------------------------------------------
[2011-01-06 09:09:45] sskaje at gmail dot com

Description:
------------
Linux/CentOS 5.5 x86_64
PHP 5.3.4
Apache 2.2.16
Tested and can be reproduced under Apache httpd +
mod_php5/nginx+fastcgi.
Ok under CLI(at least cant be reproduced under cli.)

I tested a script like below, which was simplified to the minimal.
I was about to dump something, then wrote a var_dump() with an exit;,
then i found the php results a fatal error like:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1702113144 bytes) in Unknown on line 0 ...

then In apache error log:

PHP Fatal error: Exception thrown without a stack frame in Unknown on
line 0

Apache httpd/nginx usually gives *no response* to the http get request.


check the following code:
uncomment:
  1st __halt_compiler();   .... OK
  2nd __halt_compiler();   .... BAD

then exchange the lines of definitions of class a and b, uncomment:
  1st __halt_compiler();   .... OK
  2nd __halt_compiler();   .... OK


only in 5.3.4, works perfectly in 5.3.3.

Test script:
---------------
<?php
echo 'a';
exit;
#__halt_compiler();
class a extends b{}
class b{}

#__halt_compiler();
#new a;

Expected result:
----------------
a

Actual result:
--------------
error like 
[quote]
Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to
allocate 1702113144 bytes) in Unknown on line 0 ...

then In apache error log:

PHP Fatal error: Exception thrown without a stack frame in Unknown on
line 0

Apache httpd/nginx usually gives *no response* to the http get request.

[/quote]


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=53663&edit=1


Thread (8 messages)

« previous php.bugs (#157655) next »