mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Remove bonus intval()
It caused issues when getting numeric keys that exceeded PHP_INT_MAX. Fixes #2897
This commit is contained in:
parent
c26df7001b
commit
5270721ade
2 changed files with 16 additions and 2 deletions
|
@ -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
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue