|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2004-07-07 00:11 UTC] pollita@php.net
[2004-07-07 10:43 UTC] tomas_matousek at hotmail dot com
[2004-07-11 20:25 UTC] andrey@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 23:00:01 2025 UTC |
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 )