ID:               40236
 Updated by:       [EMAIL PROTECTED]
 Reported By:      csaba at alum dot mit dot edu
-Status:           Assigned
+Status:           Closed
 Bug Type:         Scripting Engine problem
 Operating System: Win XP
 PHP Version:      5CVS-2007-01-25 (snap)
 Assigned To:      dmitry


Previous Comments:
------------------------------------------------------------------------

[2007-02-15 10:44:11] [EMAIL PROTECTED]

Fixed in CVS HEAD and PHP_5_2.

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

[2007-01-25 14:00:03] [EMAIL PROTECTED]




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

[2007-01-25 13:17:13] csaba at alum dot mit dot edu

Description:
------------
The following command line (single line in the cmd window) call does
not work unless memory_limit is set to 9M or higher in php.ini on my
Win XP Pro:

echo ^^^<?php $p='function f';$s='(){}';
for($i=0;++$i^^^<7;) eval($p.$i.$s);
print('success'); ?^^^> | php.exe -a

It complains about having run out of memory:
Interactive mode enabled


Fatal error: Allowed memory size of 8388608 bytes exhausted (tried to
allocate 786432 bytes) in C:\phpLib\-(1) : eval()'d code on line 1



Reproduce code:
---------------
<?php
// name this file test.php
function func1() { }
function func2() { }
function func3() { }
function func4() { }
function func5() { }
function func6() { }
function func7() { }
print ('success');
?>

The invocation line above looks a little scary (but it's just a loop to
define functions) - the below single line achieves the same result:
echo ^^^<?php include('test.php'); ?^^^> | php -a

Expected result:
----------------
I expect the default configuration (of 8M) to be more than enough for
trivial code to be invoked with the -a option.
Indeed,
php.exe -r "include(test.php);"
works just fine

It seems like each function declaration gobbles over 1M of memory when
php is invoked with the -a option.  I use the -a construct frequently
since php-cgi.exe does not allow the -r construct, and I've noticed
that between July and December of 2006 is when this problem started
happening.

In particular, I have an auto_prepend_file with about 50 functions
defined and for php to start running on this requires that I set
memory_limit to 56M minimum so that the php invocations with -a can
run!

Actual result:
--------------
Tested on the most recent snaps of PHP 5.2 and PHP 6.

Csaba Gabor from Vienna


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


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

Reply via email to