mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Fixed issue with Set::extract() where conditions containing a space and a slash would fail. Fixes #1185
Signed-off-by: mark_story <mark@mark-story.com>
This commit is contained in:
parent
0e5613f63d
commit
0d86302404
2 changed files with 34 additions and 1 deletions
|
@ -393,7 +393,7 @@ class Set {
|
|||
$contexts = array($data);
|
||||
}
|
||||
}
|
||||
$tokens = array_slice(preg_split('/(?<!=)\/(?![a-z-]*\])/', $path), 1);
|
||||
$tokens = array_slice(preg_split('/(?<!=)\/(?![a-z-\s]*\])/', $path), 1);
|
||||
|
||||
do {
|
||||
$token = array_shift($tokens);
|
||||
|
|
|
@ -855,6 +855,39 @@ class SetTest extends CakeTestCase {
|
|||
$r = Set::extract('/file/.[type=application/zip]', $f);
|
||||
$this->assertEqual($r, $expected);
|
||||
|
||||
$f = array(
|
||||
array(
|
||||
'file' => array(
|
||||
'name' => 'zipfile.zip',
|
||||
'type' => 'application/zip',
|
||||
'tmp_name' => '/tmp/php178.tmp',
|
||||
'error' => 0,
|
||||
'size' => '564647'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'file' => array(
|
||||
'name' => 'zipfile2.zip',
|
||||
'type' => 'application/x zip compressed',
|
||||
'tmp_name' => '/tmp/php179.tmp',
|
||||
'error' => 0,
|
||||
'size' => '354784'
|
||||
)
|
||||
),
|
||||
array(
|
||||
'file' => array(
|
||||
'name' => 'picture.jpg',
|
||||
'type' => 'image/jpeg',
|
||||
'tmp_name' => '/tmp/php180.tmp',
|
||||
'error' => 0,
|
||||
'size' => '21324'
|
||||
)
|
||||
)
|
||||
);
|
||||
$expected = array(array('name' => 'zipfile2.zip','type' => 'application/x zip compressed','tmp_name' => '/tmp/php179.tmp','error' => 0,'size' => '354784'));
|
||||
$r = Set::extract('/file/.[type=application/x zip compressed]', $f);
|
||||
$this->assertEqual($r, $expected);
|
||||
|
||||
$hasMany = array(
|
||||
'Node' => array(
|
||||
'id' => 1,
|
||||
|
|
Loading…
Reference in a new issue