ID: 41432 Updated by: [EMAIL PROTECTED] Reported By: nikhil dot gupta at in dot ibm dot com -Status: Open +Status: Closed Bug Type: Arrays related Operating System: Linux, win32-xp PHP Version: 6CVS-2007-05-18 (snap) New Comment:
This bug has been fixed in CVS. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. Thank you for the report, and for helping us make PHP better. Previous Comments: ------------------------------------------------------------------------ [2007-05-18 13:22:13] nikhil dot gupta at in dot ibm dot com Description: ------------ In PHP6, extract() function doesnot prefix the string with default character ("_") when no prefix is provided in argument ,as it does in PHP5. According to php5 documentation, output for testcase with php5 is correct. i.e when no prefix is provided, default prefix is "_" (underscore character). Hence while printing the variable _size in php5 , gives correct output ("medium"). Whereas in php6 it gives a warning and notices and refuses to recognize the other variables (color, shape) as well as expected prefixed variable (_size). Reproduce code: --------------- <?php $size = "large"; $var_array = array("color" => "blue", "size" => "medium", "shape" => "sphere"); extract($var_array, EXTR_PREFIX_SAME, ""); echo "$color, $size, $shape, $_size\n"; ?> Expected result: ---------------- blue, large, sphere, medium Actual result: -------------- PHP Warning: extract(): prefix is not a valid identifier in /home/nikhil/php/tmp.php on line 7 PHP Notice: Undefined variable: color in /home/nikhil/php/tmp.php on line 9 PHP Notice: Undefined variable: shape in /home/nikhil/php/tmp.php on line 9 PHP Notice: Undefined variable: _size in /home/nikhil/php/tmp.php on line 9 , large, , ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41432&edit=1