diff options
author | Lorry Tar Creator <lorry-tar-importer@baserock.org> | 2013-03-14 05:42:27 +0000 |
---|---|---|
committer | <> | 2013-04-03 16:25:08 +0000 |
commit | c4dd7a1a684490673e25aaf4fabec5df138854c4 (patch) | |
tree | 4d57c44caae4480efff02b90b9be86f44bf25409 /ext/pcre/tests/grep2.phpt | |
download | php2-master.tar.gz |
Imported from /home/lorry/working-area/delta_php2/php-5.4.13.tar.bz2.HEADphp-5.4.13master
Diffstat (limited to 'ext/pcre/tests/grep2.phpt')
-rw-r--r-- | ext/pcre/tests/grep2.phpt | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/ext/pcre/tests/grep2.phpt b/ext/pcre/tests/grep2.phpt new file mode 100644 index 0000000..0cf8d4a --- /dev/null +++ b/ext/pcre/tests/grep2.phpt @@ -0,0 +1,45 @@ +--TEST-- +preg_grep() 2nd test +--FILE-- +<?php + +var_dump(preg_grep(1,array(),3,4)); +var_dump(preg_grep(1, 2)); +var_dump(preg_grep('/+/', array())); + +$array = array(5=>'a', 'x' => '1', 'xyz'=>'q6', 'h20'); + +var_dump(preg_grep('@^[a-z]+@', $array)); +var_dump(preg_grep('@^[a-z]+@', $array, PREG_GREP_INVERT)); + +ini_set('pcre.recursion_limit', 1); +var_dump(preg_last_error() == PREG_NO_ERROR); +var_dump(preg_grep('@^[a-z]+@', $array)); +var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR); + +?> +--EXPECTF-- +Warning: preg_grep() expects at most 3 parameters, 4 given in %sgrep2.php on line 3 +NULL + +Warning: preg_grep() expects parameter 2 to be array, integer given in %sgrep2.php on line 4 +NULL + +Warning: preg_grep(): Compilation failed: nothing to repeat at offset 0 in %sgrep2.php on line 5 +bool(false) +array(3) { + [5]=> + string(1) "a" + ["xyz"]=> + string(2) "q6" + [6]=> + string(3) "h20" +} +array(1) { + ["x"]=> + string(1) "1" +} +bool(true) +array(0) { +} +bool(true) |