Changeset 10515
- Timestamp:
- 07/30/08 17:54:35 (1 year ago)
- Files:
-
- branches/1.0/lib/util/sfToolkit.class.php (modified) (2 diffs)
- branches/1.0/test/unit/util/sfToolkitTest.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/1.0/lib/util/sfToolkit.class.php
r9589 r10515 467 467 return $default; 468 468 } 469 $array = &$array[substr($name, $pos + 1, $end - $pos - 1)]; 470 $offset = $end; 469 else if (is_array($array)) 470 { 471 $array = &$array[substr($name, $pos + 1, $end - $pos - 1)]; 472 $offset = $end; 473 } 474 else 475 { 476 return $default; 477 } 471 478 } 472 479 … … 498 505 return $default; 499 506 } 500 $array = $array[substr($name, $pos + 1, $end - $pos - 1)]; 501 $offset = $end; 507 else if (is_array($array)) 508 { 509 $array = $array[substr($name, $pos + 1, $end - $pos - 1)]; 510 $offset = $end; 511 } 512 else 513 { 514 return $default; 515 } 502 516 } 503 517 branches/1.0/test/unit/util/sfToolkitTest.php
r4320 r10515 11 11 require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 12 12 13 $t = new lime_test(7 0, new lime_output_color());13 $t = new lime_test(72, new lime_output_color()); 14 14 15 15 // ::stringToArray() … … 173 173 '::arrayDeepMerge() recursively merges arrays preserving numerical keys' 174 174 ); 175 176 177 $arr = array( 178 'foobar' => 'foo', 179 'foo' => array( 180 'bar' => array( 181 'baz' => 'foo bar', 182 ), 183 ), 184 'bar' => array( 185 'foo', 186 'bar', 187 ), 188 'simple' => 'string', 189 ); 190 191 // ::getArrayValueForPath() 192 $t->diag('::getArrayValueForPath()'); 193 194 $t->is(sfToolkit::getArrayValueForPath($arr, 'foo[bar][baz][booze]'), null, '::getArrayValueForPath() is not fooled by php mistaking strings and array'); 195 $t->is(sfToolkit::getArrayValueForPathByRef($arr, 'foo[bar][baz][booze]'), null, '::getArrayValueForPathByRef() is not fooled by php mistaking strings and array');

