From 5e454c108f454d142d685b029ea226c3dd138c4a Mon Sep 17 00:00:00 2001 From: Phally Date: Fri, 8 Oct 2010 20:49:35 +0200 Subject: [PATCH] Fixed issue with Set::extract() where conditions containing a space and a slash would fail. Fixes #1185 Signed-off-by: mark_story --- cake/libs/set.php | 2 +- cake/tests/cases/libs/set.test.php | 33 ++++++++++++++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/cake/libs/set.php b/cake/libs/set.php index d60231c75ae..1853b54429e 100644 --- a/cake/libs/set.php +++ b/cake/libs/set.php @@ -394,7 +394,7 @@ function extract($path, $data = null, $options = array()) { $contexts = array($data); } } - $tokens = array_slice(preg_split('/(?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,