mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
parent
60f9131940
commit
246c09ae40
2 changed files with 5 additions and 1 deletions
|
@ -873,6 +873,10 @@ class HashTest extends CakeTestCase {
|
||||||
$result = Hash::extract($data, '{n}.Article[title=/^First/]');
|
$result = Hash::extract($data, '{n}.Article[title=/^First/]');
|
||||||
$expected = array($data[0]['Article']);
|
$expected = array($data[0]['Article']);
|
||||||
$this->assertEquals($expected, $result);
|
$this->assertEquals($expected, $result);
|
||||||
|
|
||||||
|
$result = Hash::extract($data, '{n}.Article[title=/^Fir[a-z]+/]');
|
||||||
|
$expected = array($data[0]['Article']);
|
||||||
|
$this->assertEquals($expected, $result);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -170,7 +170,7 @@ class Hash {
|
||||||
*/
|
*/
|
||||||
protected static function _matches(array $data, $selector) {
|
protected static function _matches(array $data, $selector) {
|
||||||
preg_match_all(
|
preg_match_all(
|
||||||
'/(\[ (?<attr>[^=><!]+?) (\s* (?<op>[><!]?[=]|[><]) \s* (?<val>[^\]]+) )? \])/x',
|
'/(\[ (?<attr>[^=><!]+?) (\s* (?<op>[><!]?[=]|[><]) \s* (?<val>(?:\/.*?\/ | [^\]]+)) )? \])/x',
|
||||||
$selector,
|
$selector,
|
||||||
$conditions,
|
$conditions,
|
||||||
PREG_SET_ORDER
|
PREG_SET_ORDER
|
||||||
|
|
Loading…
Reference in a new issue