From: tomas_matousek at hotmail dot com Operating system: WinXP PHP version: 5.0.0RC3 PHP Bug Type: Arrays related Bug description: extract function, EXTR_PREFIX_SAME option prefixes empty strings
Description: ------------ The extract() function with EXTR_PREFIX_SAME option specified prefixes variable name which is an empty string, although such variable doesn't exists in the scope where extract is called. Manual says: "EXTR_PREFIX_SAME If there is a collision, prefix the variable name with prefix." And this is not true for an empty string. A bug is possibly here (!!!): -- array.c ---------------------------- case EXTR_PREFIX_SAME: if (!var_exists) smart_str_appendl(&final_name, var_name, var_name_len); /* break omitted intentionally */ case EXTR_PREFIX_ALL: if (final_name.len == 0 !!!) { ... break; --------------------------------------- Reproduce code: --------------- function f() { extract(array("" => 1),EXTR_PREFIX_SAME,"prefix"); print_r(get_defined_vars()); { f(); Expected result: ---------------- Array ( ) Actual result: -------------- Array ( [prefix_] => 1 ) -- Edit bug report at http://bugs.php.net/?id=29038&edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=29038&r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=29038&r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=29038&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=29038&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=29038&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=29038&r=needscript Try newer version: http://bugs.php.net/fix.php?id=29038&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=29038&r=support Expected behavior: http://bugs.php.net/fix.php?id=29038&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=29038&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=29038&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=29038&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=29038&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=29038&r=dst IIS Stability: http://bugs.php.net/fix.php?id=29038&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=29038&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=29038&r=float