#6333 [Com]: garbage collection is not being performed on create_function?
ID: 6333 Comment by: josh at mykoala dot com Reported By: ewdafa at ewdafa dot b0rk dot co dot uk Status: Closed Bug Type: Performance problem Operating System: linux-2.2.16 PHP Version: 4.0.1pl2 New Comment: It's been said that this is just how the function works, but it seems as though destroying allocations for an anonymous function when redefining to the same variable would be the way to handle it. Example: for ($i=0; $i<10; $i++) { $echoit = create_function('$wha', 'echo $wha;'); echo memory_get_usage(); $echoit(" on iteration: #$i\n"); } How else can you dynamically modify function or code without reloading a script? Previous Comments: [2000-09-07 11:43:23] [EMAIL PROTECTED] This isn't a bug but how it works. Each create_function() call creates a new unique function. So obviously if you define zillions in an infinite loop you'll run out of memory. [2000-08-24 09:57:38] ewdafa at ewdafa dot b0rk dot co dot uk the following code causes PHP to continually eat more and more memory where it should be destroying the old reference for $func. while(1) { $array = array(); $func = create_function('', "return 0;"); $array[] = $func; $func = 0; echo "sleeping for a second.\n"; sleep(1); } -- Edit this bug report at http://bugs.php.net/?id=6333&edit=1
#48573 [NEW]: E-notated strings improperly cast as integers
From: josh at mykoala dot com Operating system: Mac OS X 10.5.7 PHP version: 5.2.9 PHP Bug Type: *Programming Data Structures Bug description: E-notated strings improperly cast as integers Description: When an E notated integer is in a string, and you try to cast it to an integer, the value stops at anything non-integer, reducing the ability to cast notated numbers. It does not first check or convert the value to a float to account for E notation. The documentation on type juggling doesn't mention this limitation, and it is not the expected result. Reproduce code: --- $ php -r 'var_dump((int)"5.6401418785e+05");' int(5) $ php -r 'var_dump((int)5.6401418785e+05);' int(564014) $ php -r 'var_dump((int)(float)"5.6401418785e+05");' int(564014) -- Edit bug report at http://bugs.php.net/?id=48573&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48573&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48573&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48573&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48573&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48573&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48573&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48573&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48573&r=needscript Try newer version: http://bugs.php.net/fix.php?id=48573&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48573&r=support Expected behavior: http://bugs.php.net/fix.php?id=48573&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48573&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48573&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48573&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48573&r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=48573&r=dst IIS Stability: http://bugs.php.net/fix.php?id=48573&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48573&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48573&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48573&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48573&r=mysqlcfg
#48573 [Opn]: E-notated strings improperly cast as integers
ID: 48573 User updated by: josh at mykoala dot com Reported By: josh at mykoala dot com Status: Open Bug Type: *Programming Data Structures Operating System: Mac OS X 10.5.7 PHP Version: 5.2.9 New Comment: > When an E notated integer When an E notated float* intval() on the string also (predictably) produces the same result as casting to int Previous Comments: [2009-06-16 19:08:10] josh at mykoala dot com Description: When an E notated integer is in a string, and you try to cast it to an integer, the value stops at anything non-integer, reducing the ability to cast notated numbers. It does not first check or convert the value to a float to account for E notation. The documentation on type juggling doesn't mention this limitation, and it is not the expected result. Reproduce code: --- $ php -r 'var_dump((int)"5.6401418785e+05");' int(5) $ php -r 'var_dump((int)5.6401418785e+05);' int(564014) $ php -r 'var_dump((int)(float)"5.6401418785e+05");' int(564014) -- Edit this bug report at http://bugs.php.net/?id=48573&edit=1
#48573 [Opn]: E-notated strings improperly cast as integers
ID: 48573 User updated by: josh at mykoala dot com Reported By: josh at mykoala dot com Status: Open Bug Type: Scripting Engine problem Operating System: Mac OS X 10.5.7 PHP Version: 5.2.9 New Comment: Well, round() produces the desired result -- the large number without any decimals. Adding zero just casts to float, which takes the decimals into consideration, and is the same as: $ php -r 'var_dump((float)"5.6401418785e+05");' float(564014.18785) It's that conversion to int directly that makes Iron Eyes Cody cry. Previous Comments: [2009-06-23 19:57:29] sjoerd-php at linuxonly dot nl Thank you for your bug report. A workaround for what you want is adding 0: php -r 'echo 0 + "5.6401418785e+05";' 564014.18785 ---------------- [2009-06-16 19:54:37] josh at mykoala dot com > When an E notated integer When an E notated float* intval() on the string also (predictably) produces the same result as casting to int ---------------- [2009-06-16 19:08:10] josh at mykoala dot com Description: When an E notated integer is in a string, and you try to cast it to an integer, the value stops at anything non-integer, reducing the ability to cast notated numbers. It does not first check or convert the value to a float to account for E notation. The documentation on type juggling doesn't mention this limitation, and it is not the expected result. Reproduce code: --- $ php -r 'var_dump((int)"5.6401418785e+05");' int(5) $ php -r 'var_dump((int)5.6401418785e+05);' int(564014) $ php -r 'var_dump((int)(float)"5.6401418785e+05");' int(564014) -- Edit this bug report at http://bugs.php.net/?id=48573&edit=1
#39457 [Asn]: Multiple invoked OO connections never close
ID: 39457 User updated by: josh at mykoala dot com Reported By: josh at mykoala dot com Status: Assigned Bug Type: MySQLi related Operating System: OS X 10.4.8 PHP Version: 5.2.0 Assigned To: georg New Comment: About to celebrate the two-year anniversary of this one, woo! =) Previous Comments: [2007-06-28 20:14:39] [EMAIL PROTECTED] Georg, reassign to someone else if this is not for you. :) [2007-05-08 21:36:09] bugs dot php at david-salisbury dot co dot uk I've experienced this behaviour on the latest PHP5 CVS (built May 8 2007 22:31:22) running in Apache 2.0.59 as mod_php5. Further reproduce code if necessary: init(); $m->real_connect('localhost', 'root', 'pass', 'dbname'); $m->real_connect('localhost', 'root', 'pass', 'dbname'); $m->real_connect('localhost', 'root', 'pass', 'dbname'); ?> [2006-11-10 12:00:27] josh at mykoala dot com Description: After invoking multiple identical connect() calls to a MySQLi object (after mysqli_init), only one is closed via close() or script termination. Reproduce code: --- # only when invoked through apache $db = mysqli_init(); $db->connect(null, 'root'); $db->connect(null, 'root'); $db->close(); Expected result: Just like when using procedural MySQLi functions (or via mysql_* funcs), multiple connect() calls will not result in rogue db connections. Actual result: -- Checking the MySQL process list after each execution shows a rogue connection, which goes on until you reach max connections. This only happens when using OO style. -- Edit this bug report at http://bugs.php.net/?id=39457&edit=1
#39457 [NEW]: Multiple invoked OO connections never close
From: josh at mykoala dot com Operating system: OS X 10.4.8 PHP version: 5.2.0 PHP Bug Type: MySQLi related Bug description: Multiple invoked OO connections never close Description: After invoking multiple identical connect() calls to a MySQLi object (after mysqli_init), only one is closed via close() or script termination. Reproduce code: --- # only when invoked through apache $db = mysqli_init(); $db->connect(null, 'root'); $db->connect(null, 'root'); $db->close(); Expected result: Just like when using procedural MySQLi functions (or via mysql_* funcs), multiple connect() calls will not result in rogue db connections. Actual result: -- Checking the MySQL process list after each execution shows a rogue connection, which goes on until you reach max connections. This only happens when using OO style. -- Edit bug report at http://bugs.php.net/?id=39457&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=39457&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=39457&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=39457&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=39457&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=39457&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=39457&r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=39457&r=needscript Try newer version:http://bugs.php.net/fix.php?id=39457&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=39457&r=support Expected behavior:http://bugs.php.net/fix.php?id=39457&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=39457&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=39457&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=39457&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=39457&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=39457&r=dst IIS Stability:http://bugs.php.net/fix.php?id=39457&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=39457&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=39457&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=39457&r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=39457&r=mysqlcfg