Remove bonus intval()

It caused issues when getting numeric keys that
exceeded PHP_INT_MAX.

Fixes #2897
This commit is contained in:
mark_story 2012-05-22 22:33:46 -04:00
parent c26df7001b
commit 5270721ade
2 changed files with 16 additions and 2 deletions

View file

@ -1657,6 +1657,20 @@ class SetTest extends CakeTestCase {
$this->assertEquals($expected, $result);
}
/**
* test classicExtract with keys that exceed 32bit max int.
*
* @return void
*/
public function testClassicExtractMaxInt() {
$data = array(
'Data' => array(
'13376924712' => 'abc'
)
);
$this->assertEquals('abc', Set::classicExtract($data, 'Data.13376924712'));
}
/**
* testInsert method
*

View file

@ -603,8 +603,8 @@ class Set {
foreach ($path as $i => $key) {
if (is_numeric($key) && intval($key) > 0 || $key === '0') {
if (isset($data[intval($key)])) {
$data = $data[intval($key)];
if (isset($data[$key])) {
$data = $data[$key];
} else {
return null;
}