Development

Changeset 10515

You must first sign up to be able to contribute.

Changeset 10515

Show
Ignore:
Timestamp:
07/30/08 17:54:35 (1 year ago)
Author:
hartym
Message:

backported r10514 to 1.0 branch

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.0/lib/util/sfToolkit.class.php

    r9589 r10515  
    467467            return $default; 
    468468          } 
    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          } 
    471478        } 
    472479 
     
    498505            return $default; 
    499506          } 
    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          } 
    502516        } 
    503517 
  • branches/1.0/test/unit/util/sfToolkitTest.php

    r4320 r10515  
    1111require_once(dirname(__FILE__).'/../../bootstrap/unit.php'); 
    1212 
    13 $t = new lime_test(70, new lime_output_color()); 
     13$t = new lime_test(72, new lime_output_color()); 
    1414 
    1515// ::stringToArray() 
     
    173173  '::arrayDeepMerge() recursively merges arrays preserving numerical keys' 
    174174); 
     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'); 

The Sensio Labs Network

Since 1998, Sensio Labs has been promoting the Open-Source software movement by providing quality web application development, training, consulting, and supporting several large Open-Source projects.