1--TEST-- 2Bug #29038 (extract(), EXTR_PREFIX_SAME option prefixes empty strings) 3--FILE-- 4<?php 5function my_print_r($a) { 6 ksort($a); 7 print_r($a); 8} 9function f1() { 10 $c = extract(array("" => 1),EXTR_PREFIX_SAME,"prefix"); 11 echo "Extracted:"; 12 var_dump($c); 13 my_print_r(get_defined_vars()); 14} 15function f2() { 16 $a = 1; 17 $c = extract(array("a" => 1),EXTR_PREFIX_SAME,"prefix"); 18 echo "Extracted:"; 19 var_dump($c); 20 my_print_r(get_defined_vars()); 21} 22function f3() { 23 $a = 1; 24 $c = extract(array("a" => 1),EXTR_PREFIX_ALL,"prefix"); 25 echo "Extracted:"; 26 var_dump($c); 27 my_print_r(get_defined_vars()); 28} 29function f4() { 30 $c = extract(array("" => 1),EXTR_PREFIX_ALL,"prefix"); 31 echo "Extracted:"; 32 var_dump($c); 33 my_print_r(get_defined_vars()); 34} 35function f5() { 36 $c = extract(array("111" => 1),EXTR_PREFIX_ALL,"prefix"); 37 echo "Extracted:"; 38 var_dump($c); 39 my_print_r(get_defined_vars()); 40} 41 42f1(); 43f2(); 44f3(); 45f4(); 46f5(); 47?> 48--EXPECT-- 49Extracted:int(0) 50Array 51( 52 [c] => 0 53) 54Extracted:int(1) 55Array 56( 57 [a] => 1 58 [c] => 1 59 [prefix_a] => 1 60) 61Extracted:int(1) 62Array 63( 64 [a] => 1 65 [c] => 1 66 [prefix_a] => 1 67) 68Extracted:int(0) 69Array 70( 71 [c] => 0 72) 73Extracted:int(1) 74Array 75( 76 [c] => 1 77 [prefix_111] => 1 78) 79