mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Applying patch from 'phally' to update Set::extract to properly tokenize xpath selectors which contain hyphens (-). Fixes #6140
git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@8059 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
parent
5ded592c1e
commit
f20ccc745c
2 changed files with 39 additions and 1 deletions
|
@ -388,7 +388,7 @@ class Set extends Object {
|
|||
if (!isset($contexts[0])) {
|
||||
$contexts = array($data);
|
||||
}
|
||||
$tokens = array_slice(preg_split('/(?<!=)\/(?![a-z]*\])/', $path), 1);
|
||||
$tokens = array_slice(preg_split('/(?<!=)\/(?![a-z-]*\])/', $path), 1);
|
||||
|
||||
do {
|
||||
$token = array_shift($tokens);
|
||||
|
|
|
@ -919,6 +919,44 @@ class SetTest extends CakeTestCase {
|
|||
$expected = array(7,2,1);
|
||||
$r = Set::extract('/CallType[name=Internal Voice]/../x/hour', $multiple);
|
||||
$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);
|
||||
|
||||
$expected = array(array('name' => 'zipfile.zip','type' => 'application/zip','tmp_name' => '/tmp/php178.tmp','error' => 0,'size' => '564647'));
|
||||
$r = Set::extract('/file/.[type=application/zip]', $f);
|
||||
$this->assertEqual($r, $expected);
|
||||
|
||||
}
|
||||
/**
|
||||
* testMatches method
|
||||
|
|
Loading…
Reference in a new issue