Mombu the Php Forum sponsored links

Go Back   Mombu the Php Forum > Php > #41432 : extract() function in php6 does not accept the default prefix character ie. "_"
User Name
Password
REGISTER NOW! Mark Forums Read

sponsored links


Reply
 
1 22nd July 22:01
External User
 
Posts: 1
Default #41432 : extract() function in php6 does not accept the default prefix character ie. "_"



ID: 41432
Updated by: tony2001@php.net
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 do***entation, 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
  Reply With Quote


  sponsored links


Reply


Thread Tools
Display Modes




Copyright © 2006 SmartyDevil.com - Dies Mies Jeschet Boenedoesef Douvema Enitemaus -
666