import zend pcre tests

Esse commit está contido em:
Paul Tarjan
2013-04-22 19:33:07 -07:00
commit de Sara Golemon
commit 71113aef61
187 arquivos alterados com 4337 adições e 1 exclusões
+14
Ver Arquivo
@@ -0,0 +1,14 @@
<?php
var_dump(preg_match());
var_dump(preg_match_all());
var_dump(preg_match_all('//', '', $dummy, 0xdead));
var_dump(preg_quote());
var_dump(preg_quote(''));
var_dump(preg_replace('/(.)/', '${1}${1', 'abc'));
var_dump(preg_replace('/.++\d*+[/', 'for ($', 'abc'));
var_dump(preg_replace('/(.)/e', 'for ($', 'abc'));
?>
+16
Ver Arquivo
@@ -0,0 +1,16 @@
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
string(0) ""
string(12) "a${1b${1c${1"
HipHop Warning: %a
NULL
Parse error: %s in %s002.php(12) : regexp code on line 1
HipHop Fatal error: %a
for ($ in %s002.php on line 12
+15
Ver Arquivo
@@ -0,0 +1,15 @@
<?php
var_dump(preg_match_all('/((?:(?:unsigned|struct)\s+)?\w+)(?:\s*(\*+)\s+|\s+(\**))(\w+(?:\[\s*\w*\s*\])?)\s*(?:(=)[^,;]+)?((?:\s*,\s*\**\s*\w+(?:\[\s*\w*\s*\])?\s*(?:=[^,;]+)?)*)\s*;/S', 'unsigned int xpto = 124; short a, b;', $m, PREG_SET_ORDER));
var_dump($m);
var_dump(preg_match_all('/(?:\([^)]+\))?(&?)([\w>.()-]+(?:\[\w+\])?)\s*,?((?:\)*\s*=)?)/S', '&a, b, &c', $m, PREG_SET_ORDER));
var_dump($m);
var_dump(preg_match_all('/zend_parse_parameters(?:_ex\s*\([^,]+,[^,]+|\s*\([^,]+),\s*"([^"]*)"\s*,\s*([^{;]*)/S', 'zend_parse_parameters( 0, "addd|s/", a, b, &c);', $m, PREG_SET_ORDER | PREG_OFFSET_CAPTURE));
var_dump($m);
var_dump(preg_replace(array('@//.*@S', '@/\*.*\*/@SsUe'), array('', 'preg_replace("/[^\r\n]+/S", "", \'$0\')'), "hello\n//x \n/*\ns\n*/"));
var_dump(preg_split('/PHP_(?:NAMED_)?(?:FUNCTION|METHOD)\s*\((\w+(?:,\s*\w+)?)\)/S', "PHP_FUNCTION(s, preg_match)\n{\nlalala", -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
?>
+130
Ver Arquivo
@@ -0,0 +1,130 @@
int(2)
array(2) {
[0]=>
array(7) {
[0]=>
string(24) "unsigned int xpto = 124;"
[1]=>
string(12) "unsigned int"
[2]=>
string(0) ""
[3]=>
string(0) ""
[4]=>
string(4) "xpto"
[5]=>
string(1) "="
[6]=>
string(0) ""
}
[1]=>
array(7) {
[0]=>
string(11) "short a, b;"
[1]=>
string(5) "short"
[2]=>
string(0) ""
[3]=>
string(0) ""
[4]=>
string(1) "a"
[5]=>
string(0) ""
[6]=>
string(3) ", b"
}
}
int(3)
array(3) {
[0]=>
array(4) {
[0]=>
string(3) "&a,"
[1]=>
string(1) "&"
[2]=>
string(1) "a"
[3]=>
string(0) ""
}
[1]=>
array(4) {
[0]=>
string(2) "b,"
[1]=>
string(0) ""
[2]=>
string(1) "b"
[3]=>
string(0) ""
}
[2]=>
array(4) {
[0]=>
string(2) "&c"
[1]=>
string(1) "&"
[2]=>
string(1) "c"
[3]=>
string(0) ""
}
}
int(1)
array(1) {
[0]=>
array(3) {
[0]=>
array(2) {
[0]=>
string(46) "zend_parse_parameters( 0, "addd|s/", a, b, &c)"
[1]=>
int(0)
}
[1]=>
array(2) {
[0]=>
string(7) "addd|s/"
[1]=>
int(27)
}
[2]=>
array(2) {
[0]=>
string(9) "a, b, &c)"
[1]=>
int(37)
}
}
}
string(9) "hello
"
array(3) {
[0]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(0)
}
[1]=>
array(2) {
[0]=>
string(13) "s, preg_match"
[1]=>
int(13)
}
[2]=>
array(2) {
[0]=>
string(9) "
{
lalala"
[1]=>
int(27)
}
}
+12
Ver Arquivo
@@ -0,0 +1,12 @@
<?php
function iter($ar)
{
foreach ($ar as $c) {
echo htmlentities($c, 0, "UTF-8"), ": ", strlen($c), "\n";
}
}
$teststr = "\xe2\x82\xac hi there";
iter(preg_split('//u', $teststr, -1, PREG_SPLIT_NO_EMPTY));
preg_match_all('/./u', $teststr, $matches);
iter($matches[0]);
?>
@@ -0,0 +1,20 @@
&euro;: 3
: 1
h: 1
i: 1
: 1
t: 1
h: 1
e: 1
r: 1
e: 1
&euro;: 3
: 1
h: 1
i: 1
: 1
t: 1
h: 1
e: 1
r: 1
e: 1
+16
Ver Arquivo
@@ -0,0 +1,16 @@
<?php
function callback($match)
{
var_dump($match);
return $match[1].'/'.strlen($match['name']);
}
var_dump(preg_replace_callback('|(?P<name>blub)|', 'callback', 'bla blub blah'));
var_dump(preg_match('|(?P<name>blub)|', 'bla blub blah', $m));
var_dump($m);
var_dump(preg_replace_callback('|(?P<1>blub)|', 'callback', 'bla blub blah'));
?>
@@ -0,0 +1,20 @@
array(3) {
[0]=>
string(4) "blub"
["name"]=>
string(4) "blub"
[1]=>
string(4) "blub"
}
string(15) "bla blub/4 blah"
int(1)
array(3) {
[0]=>
string(4) "blub"
["name"]=>
string(4) "blub"
[1]=>
string(4) "blub"
}
HipHop Warning: %a
NULL
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
$str1 = 'a';
$str2 = 'b';
$array=Array("1",2,3,1.1,FALSE,NULL,Array(), $str1, &$str2);
var_dump($array);
var_dump(preg_grep('/do not match/',$array));
$a = preg_grep('/./',$array);
var_dump($a);
$str1 = 'x';
$str2 = 'y';
var_dump($a); // check if array is still ok
var_dump($array);
?>
@@ -0,0 +1,80 @@
array(9) {
[0]=>
string(1) "1"
[1]=>
int(2)
[2]=>
int(3)
[3]=>
float(1.1)
[4]=>
bool(false)
[5]=>
NULL
[6]=>
array(0) {
}
[7]=>
string(1) "a"
[8]=>
&string(1) "b"
}
HipHop Notice: %a
array(0) {
}
HipHop Notice: %a
array(7) {
[0]=>
string(1) "1"
[1]=>
int(2)
[2]=>
int(3)
[3]=>
float(1.1)
[6]=>
array(0) {
}
[7]=>
string(1) "a"
[8]=>
&string(1) "b"
}
array(7) {
[0]=>
string(1) "1"
[1]=>
int(2)
[2]=>
int(3)
[3]=>
float(1.1)
[6]=>
array(0) {
}
[7]=>
string(1) "a"
[8]=>
&string(1) "y"
}
array(9) {
[0]=>
string(1) "1"
[1]=>
int(2)
[2]=>
int(3)
[3]=>
float(1.1)
[4]=>
bool(false)
[5]=>
NULL
[6]=>
array(0) {
}
[7]=>
string(1) "a"
[8]=>
&string(1) "y"
}
+18
Ver Arquivo
@@ -0,0 +1,18 @@
<?php
var_dump(preg_quote('-oh really?'));
// make sure there's no regression in matching
preg_match('/[a\-c]+/', 'a---b', $m);
var_dump($m);
preg_match('/[a\-c]+/', 'a\-', $m);
var_dump($m);
preg_match("/a\-{2,}/", 'a----a', $m);
var_dump($m);
preg_match("/a\-{1,}/", 'a\----a', $m);
var_dump($m);
?>
@@ -0,0 +1,15 @@
%string|unicode%(13) "\-oh really\?"
array(1) {
[0]=>
%string|unicode%(4) "a---"
}
array(1) {
[0]=>
%string|unicode%(1) "a"
}
array(1) {
[0]=>
%string|unicode%(5) "a----"
}
array(0) {
}
+13
Ver Arquivo
@@ -0,0 +1,13 @@
<?php
$message = 'Der ist ein Süßwasserpool Süsswasserpool ... verschiedene Wassersportmöglichkeiten bei ...';
$pattern = '/\bwasser/iu';
preg_match_all($pattern, $message, $match, PREG_OFFSET_CAPTURE);
var_dump($match);
$pattern = '/[^\w]wasser/iu';
preg_match_all($pattern, $message, $match, PREG_OFFSET_CAPTURE);
var_dump($match);
?>
@@ -0,0 +1,24 @@
array(1) {
[0]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(6) "Wasser"
[1]=>
int(61)
}
}
}
array(1) {
[0]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(7) " Wasser"
[1]=>
int(60)
}
}
}
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?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);
?>
@@ -0,0 +1,22 @@
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
HipHop Warning: %a
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)
@@ -0,0 +1,14 @@
<?php
$string = b"\xc3\xa9 uma string utf8 bem formada";
var_dump(preg_match(b'~.*~u', $string, $m, 0, 1));
var_dump($m);
var_dump(preg_last_error() == PREG_BAD_UTF8_OFFSET_ERROR);
var_dump(preg_match(b'~.*~u', $string, $m, 0, 2));
var_dump($m);
var_dump(preg_last_error() == PREG_NO_ERROR);
echo "Done\n";
?>
@@ -0,0 +1,11 @@
bool(false)
array(0) {
}
bool(true)
int(1)
array(1) {
[0]=>
string(28) " uma string utf8 bem formada"
}
bool(true)
Done
+15
Ver Arquivo
@@ -0,0 +1,15 @@
<?php
// this tests if the cache is working correctly, as the char tables
// must be rebuilt after the locale change
setlocale(LC_ALL, 'C', 'POSIX');
var_dump(preg_match('/^\w{6}$/', 'aàáçéè'));
setlocale(LC_ALL, 'pt_PT', 'pt', 'pt_PT.ISO8859-1', 'portuguese');
var_dump(preg_match('/^\w{6}$/', 'aàáçéè'));
setlocale(LC_ALL, 'C', 'POSIX');
var_dump(preg_match('/^\w{6}$/', 'aàáçéè'));
?>
@@ -0,0 +1,3 @@
int(0)
int(1)
int(0)
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?php
preg_match("\0//i", "");
preg_match("/\0/i", "");
preg_match("//\0i", "");
preg_match("//i\0", "");
preg_match("/\\\0/i", "");
preg_match("\0[]i", "");
preg_match("[\0]i", "");
preg_match("[]\0i", "");
preg_match("[]i\0", "");
preg_match("[\\\0]i", "");
preg_replace("/foo/e\0/i", "echo('Eek');", "");
?>
@@ -0,0 +1,11 @@
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
HipHop Warning: %a
+10
Ver Arquivo
@@ -0,0 +1,10 @@
<?php
$subject = array('1', 'a', '2', 'b', '3', 'A', 'B', '4');
$pattern = array('/\d/', '/[a-z]/', '/[1a]/');
$replace = array('A:$0', 'B:$0', 'C:$0');
var_dump(preg_filter($pattern, $replace, $subject));
?>
===DONE===
@@ -0,0 +1,15 @@
array(6) {
[0]=>
string(5) "A:C:1"
[1]=>
string(5) "B:C:a"
[2]=>
string(3) "A:2"
[3]=>
string(3) "B:b"
[4]=>
string(3) "A:3"
[7]=>
string(3) "A:4"
}
===DONE===
@@ -0,0 +1,25 @@
<?php
/*
* proto array preg_grep(string regex, array input [, int flags])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_grep reacts to being passed bad regexes
*/
echo "*** Testing preg_grep() : error conditions ***\n";
$values = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
$array = array(123, 'abc', 'test');
foreach($values as $value) {
print "\nArg value is $value\n";
var_dump(preg_grep($value, $array));
}
$value = new stdclass(); //Object
var_dump(preg_grep($value, $array));
echo "Done"
?>
@@ -0,0 +1,32 @@
*** Testing preg_grep() : error conditions ***
Arg value is abcdef
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]
HipHop Warning: %a
bool(false)
Arg value is [a-zA-Z]/
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]/F
HipHop Warning: %a
bool(false)
Arg value is Array
HipHop Warning: %a
NULL
Arg value is /[a-zA-Z]/
array(2) {
[1]=>
string(3) "abc"
[2]=>
string(4) "test"
}
HipHop Warning: %a
NULL
Done
@@ -0,0 +1,20 @@
<?php
/*
* proto array preg_grep(string regex, array input [, int flags])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_grep reacts to being passed the wrong type of input argument
*/
echo "*** Testing preg_grep() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
$input = array('this is a string', array('this is', 'a subarray'),);
foreach($input as $value) {
print "\nArg value is: $value\n";
var_dump(preg_grep($regex, $value));
}
$value = new stdclass(); //Object
var_dump(preg_grep($regex, $value));
echo "Done";
?>
@@ -0,0 +1,16 @@
*** Testing preg_grep() : error conditions ***
Arg value is: this is a string
HipHop Warning: %a
NULL
Arg value is: Array
array(2) {
[0]=>
string(7) "this is"
[1]=>
string(10) "a subarray"
}
HipHop Warning: %a
NULL
Done
@@ -0,0 +1,23 @@
<?php
/*
* proto int preg_match_all(string pattern, string subject, [array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
$string = 'Hello, world! This is a test. This is another test. \[4]. 34534 string.';
var_dump(preg_match_all('/[0-35-9]/', $string, $match1, PREG_OFFSET_CAPTURE|PREG_PATTERN_ORDER, -10)); //finds any digit that's not 4 10 digits from the end(1 match)
var_dump($match1);
var_dump(preg_match_all('/[tT]his is a(.*?)\./', $string, $match2, PREG_SET_ORDER)); //finds "This is a test." and "This is another test." (non-greedy) (2 matches)
var_dump($match2);
var_dump(preg_match_all('@\. \\\(.*).@', $string, $match3, PREG_PATTERN_ORDER)); //finds ".\ [...]" and everything else to the end of the string. (greedy) (1 match)
var_dump($match3);
var_dump(preg_match_all('/\d{2}$/', $string, $match4)); //tries to find 2 digits at the end of a string (0 matches)
var_dump($match4);
var_dump(preg_match_all('/(This is a ){2}(.*)\stest/', $string, $match5)); //tries to find "This is aThis is a [...] test" (0 matches)
var_dump($match5);
// Test not passing in a subpatterns array.
var_dump(preg_match_all('/test/', $string));
var_dump(preg_match_all('/this isn\'t in the string/', $string));
var_dump(preg_match_all('/world/', $string));
var_dump(preg_match_all('/[0-9]/', $string));
?>
@@ -0,0 +1,65 @@
int(1)
array(1) {
[0]=>
array(1) {
[0]=>
array(2) {
[0]=>
string(1) "3"
[1]=>
int(61)
}
}
}
int(2)
array(2) {
[0]=>
array(2) {
[0]=>
string(15) "This is a test."
[1]=>
string(5) " test"
}
[1]=>
array(2) {
[0]=>
string(21) "This is another test."
[1]=>
string(11) "nother test"
}
}
int(1)
array(2) {
[0]=>
array(1) {
[0]=>
string(21) ". \[4]. 34534 string."
}
[1]=>
array(1) {
[0]=>
string(17) "[4]. 34534 string"
}
}
int(0)
array(1) {
[0]=>
array(0) {
}
}
int(0)
array(3) {
[0]=>
array(0) {
}
[1]=>
array(0) {
}
[2]=>
array(0) {
}
}
int(2)
int(0)
int(1)
int(6)
@@ -0,0 +1,23 @@
<?php
/*
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing preg_match_all() function with Zero arguments --\n";
var_dump(preg_match_all());
//Test preg_match_all with one more than the expected number of arguments
echo "\n-- Testing preg_match_all() function with more than expected no. of arguments --\n";
$pattern = '/\w/';
$subject = 'string_val';
$flags = PREG_OFFSET_CAPTURE;
$offset = 10;
$extra_arg = 10;
var_dump(preg_match_all($pattern, $subject, $matches, $flags, $offset, $extra_arg));
// Testing preg_match_all withone less than the expected number of arguments
echo "\n-- Testing preg_match_all() function with less than expected no. of arguments --\n";
$pattern = '/\w/';
var_dump(preg_match_all($pattern));
echo "Done"
?>
@@ -0,0 +1,14 @@
*** Testing preg_match_all() : error conditions ***
-- Testing preg_match_all() function with Zero arguments --
HipHop Warning: %a
bool(false)
-- Testing preg_match_all() function with more than expected no. of arguments --
HipHop Warning: %a
bool(false)
-- Testing preg_match_all() function with less than expected no. of arguments --
HipHop Warning: %a
bool(false)
Done
@@ -0,0 +1,26 @@
<?php
/*
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match_all reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
$regex_array = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
$subject = 'test';
foreach($regex_array as $regex_value) {
print "\nArg value is $regex_value\n";
var_dump(preg_match_all($regex_value, $subject, $matches1));
var_dump($matches1);
}
$regex_value = new stdclass(); //Object
var_dump(preg_match_all($regex_value, $subject, $matches));
var_dump($matches);
?>
@@ -0,0 +1,45 @@
*** Testing preg_match_all() : error conditions ***
Arg value is abcdef
HipHop Warning: %a
bool(false)
NULL
Arg value is /[a-zA-Z]
HipHop Warning: %a
bool(false)
NULL
Arg value is [a-zA-Z]/
HipHop Warning: %a
bool(false)
NULL
Arg value is /[a-zA-Z]/F
HipHop Warning: %a
bool(false)
NULL
Arg value is Array
HipHop Warning: %a
bool(false)
NULL
Arg value is /[a-zA-Z]/
int(4)
array(1) {
[0]=>
array(4) {
[0]=>
string(1) "t"
[1]=>
string(1) "e"
[2]=>
string(1) "s"
[3]=>
string(1) "t"
}
}
HipHop Warning: %a
bool(false)
NULL
@@ -0,0 +1,22 @@
<?php
/*
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match_all reacts to being passed the wrong type of input argument
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
$value = new stdclass(); //Object
var_dump(preg_match_all($regex, $value, $matches));
var_dump($matches);
$input = array(array('this is', 'a subarray'), 'test',);
foreach($input as $value) {
print "\nArg value is: $value\n";
var_dump(preg_match_all($regex, $value, $matches));
var_dump($matches);
}
echo "Done";
?>
@@ -0,0 +1,26 @@
*** Testing preg_match_all() : error conditions ***
HipHop Warning: %a
bool(false)
NULL
Arg value is: Array
HipHop Warning: %a
bool(false)
NULL
Arg value is: test
int(4)
array(1) {
[0]=>
array(4) {
[0]=>
string(1) "t"
[1]=>
string(1) "e"
[2]=>
string(1) "s"
[3]=>
string(1) "t"
}
}
Done
@@ -0,0 +1,14 @@
<?php
/*
* proto int preg_match_all(string pattern, string subject, array subpatterns [, int flags [, int offset]])
* Function is implemented in ext/pcre/php_pcre.c
*/
/*
* Testing how preg_match_all reacts to being passed the wrong type of subpatterns array argument
*/
echo "*** Testing preg_match_all() : error conditions ***\n";
$regex = '/[a-z]/';
$subject = 'string';
var_dump(preg_match_all($regex, $subject, 'test'));
echo "Done";
?>
@@ -0,0 +1 @@
HipHop Fatal error: %a
@@ -0,0 +1,23 @@
<?php
/*
* proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
echo "*** Testing preg_match() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing preg_match() function with Zero arguments --\n";
var_dump(preg_match());
//Test preg_match with one more than the expected number of arguments
echo "\n-- Testing preg_match() function with more than expected no. of arguments --\n";
$pattern = '/\w/';
$subject = 'string_val';
$flags = PREG_OFFSET_CAPTURE;
$offset = 10;
$extra_arg = 10;
var_dump(preg_match($pattern, $subject, $matches, $flags, $offset, $extra_arg));
// Testing preg_match withone less than the expected number of arguments
echo "\n-- Testing preg_match() function with less than expected no. of arguments --\n";
$pattern = '/\w/';
var_dump(preg_match($pattern));
echo "Done"
?>
@@ -0,0 +1,14 @@
*** Testing preg_match() : error conditions ***
-- Testing preg_match() function with Zero arguments --
HipHop Warning: %a
bool(false)
-- Testing preg_match() function with more than expected no. of arguments --
HipHop Warning: %a
bool(false)
-- Testing preg_match() function with less than expected no. of arguments --
HipHop Warning: %a
bool(false)
Done
@@ -0,0 +1,24 @@
<?php
/*
* proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_match() : error conditions ***\n";
$regex_array = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
$subject = 'this is a test';
foreach($regex_array as $regex_value) {
print "\nArg value is $regex_value\n";
var_dump(preg_match($regex_value, $subject));
}
$regex_value = new stdclass(); //Object
var_dump(preg_match($regex_value, $subject));
?>
@@ -0,0 +1,26 @@
*** Testing preg_match() : error conditions ***
Arg value is abcdef
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]
HipHop Warning: %a
bool(false)
Arg value is [a-zA-Z]/
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]/F
HipHop Warning: %a
bool(false)
Arg value is Array
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]/
int(1)
HipHop Warning: %a
bool(false)
@@ -0,0 +1,20 @@
<?php
/*
* proto int preg_match(string pattern, string subject [, array subpatterns [, int flags [, int offset]]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_match reacts to being passed the wrong type of subject argument
*/
echo "*** Testing preg_match() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
$input = array('this is a string', array('this is', 'a subarray'),);
foreach($input as $value) {
print "\nArg value is: $value\n";
var_dump(preg_match($regex, $value));
}
$value = new stdclass(); //Object
var_dump(preg_match($regex, $value));
echo "Done";
?>
@@ -0,0 +1,11 @@
*** Testing preg_match() : error conditions ***
Arg value is: this is a string
int(1)
Arg value is: Array
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
Done
@@ -0,0 +1,13 @@
<?php
/*
* proto string preg_quote(string str [, string delim_char])
* Function is implemented in ext/pcre/php_pcre.c
*/
$string_before = '/this *-has \ metacharacters^ in $';
print "\$string_before looks like: $string_before\n"; //$string_before is printed as is written
$string_after = preg_quote($string_before, '/');
print "\$string_after looks like: $string_after, with metacharacters and / (set as delimiter) escaped\n"; //$string_after is printed with metacharacters escaped.
$string1 = 'testing - /this *-has \ metacharacters^ in $ should work';
var_dump(preg_match('/^[tT]\w{6} - ' . preg_quote($string_before, '/') . ' [a-z]*\s*work$/', $string1, $matches1));
var_dump($matches1);
?>
@@ -0,0 +1,7 @@
$string_before looks like: /this *-has \ metacharacters^ in $
$string_after looks like: \/this \*\-has \\ metacharacters\^ in \$, with metacharacters and / (set as delimiter) escaped
int(1)
array(1) {
[0]=>
string(58) "testing - /this *-has \ metacharacters^ in $ should work"
}
@@ -0,0 +1,19 @@
<?php
/*
* proto string preg_quote(string str [, string delim_char])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_quote reacts to being passed the wrong type of input argument
*/
echo "*** Testing preg_quote() : error conditions ***\n";
$input = array('this is a string', array('this is', 'a subarray'),);
foreach($input as $value) {
print "\nArg value is: $value\n";
var_dump(preg_quote($value));
}
$value = new stdclass(); //Object
var_dump(preg_quote($value));
echo "Done";
?>
@@ -0,0 +1,11 @@
*** Testing preg_quote() : error conditions ***
Arg value is: this is a string
string(16) "this is a string"
Arg value is: Array
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
Done
+12
Ver Arquivo
@@ -0,0 +1,12 @@
<?php
var_dump(preg_replace('{{\D+}}', 'x', '{abcd}'));
var_dump(preg_replace('{{\D+}}', 'ddd', 'abcd'));
var_dump(preg_replace('/(ab)(c)(d)(e)(f)(g)(h)(i)(j)(k)/', 'a${1}2$103', 'zabcdefghijkl'));
var_dump(preg_replace_callback('//e', '', ''));
var_dump(preg_replace_callback('//e', 'strtolower', ''));
?>
@@ -0,0 +1,7 @@
string(1) "x"
string(4) "abcd"
string(8) "zaab2k3l"
HipHop Warning: %a
string(0) ""
HipHop Warning: %a
NULL
@@ -0,0 +1,20 @@
<?php
function f() {
throw new Exception();
}
try {
var_dump(preg_replace_callback('/\w/', 'f', 'z'));
} catch(Exception $e) {}
function g($x) {
return "'$x[0]'";
}
var_dump(preg_replace_callback('@\b\w{1,2}\b@', 'g', array('a b3 bcd', 'v' => 'aksfjk', 12 => 'aa bb')));
var_dump(preg_replace_callback('~\A.~', 'g', array(array('xyz'))));
var_dump(preg_replace_callback('~\A.~', create_function('$m', 'return strtolower($m[0]);'), 'ABC'));
?>
@@ -0,0 +1,14 @@
array(3) {
[0]=>
string(12) "'a' 'b3' bcd"
["v"]=>
string(6) "aksfjk"
[12]=>
string(9) "'aa' 'bb'"
}
HipHop Notice: %a
array(1) {
[0]=>
string(7) "'A'rray"
}
string(3) "aBC"
@@ -0,0 +1,16 @@
<?php
var_dump(preg_replace_callback());
var_dump(preg_replace_callback(1));
var_dump(preg_replace_callback(1,2));
var_dump(preg_replace_callback(1,2,3));
var_dump(preg_replace_callback(1,2,3,4));
$a = 5;
var_dump(preg_replace_callback(1,2,3,4,$a));
$a = "";
var_dump(preg_replace_callback("","","","",$a));
$a = array();
var_dump(preg_replace_callback($a,$a,$a,$a,$a));
echo "Done\n";
?>
@@ -0,0 +1,17 @@
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
HipHop Warning: %a
int(3)
HipHop Warning: %a
int(3)
HipHop Warning: %a
int(3)
HipHop Warning: %a
NULL
HipHop Warning: %a
NULL
Done
@@ -0,0 +1,27 @@
<?php
/*
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace_callback reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_replace_callback() : error conditions ***\n";
$regex_array = array('abcdef', //Regex without delimiters
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/'); //Regex string
$replacement = array('zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine');
function integer_word($matches) {
global $replacement;
return $replacement[$matches[0]];
}
$subject = 'number 1.';
foreach($regex_array as $regex_value) {
print "\nArg value is $regex_value\n";
var_dump(preg_replace_callback($regex_value, 'integer_word', $subject));
}
?>
===Done===
@@ -0,0 +1,24 @@
*** Testing preg_replace_callback() : error conditions ***
Arg value is abcdef
HipHop Warning: %a
NULL
Arg value is /[a-zA-Z]
HipHop Warning: %a
NULL
Arg value is [a-zA-Z]/
HipHop Warning: %a
NULL
Arg value is /[a-zA-Z]/F
HipHop Warning: %a
NULL
Arg value is Array
string(9) "number 1."
Arg value is /[a-zA-Z]/
string(3) " 1."
===Done===
@@ -0,0 +1,25 @@
<?php
/*
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_replace() : error conditions***\n";
$regex_array = array('abcdef', //Regex without delimeter
'/[a-zA-Z]', //Regex without closing delimeter
'[a-zA-Z]/', //Regex without opening delimeter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
$replace = 1;
$subject = 'a';
foreach($regex_array as $regex_value) {
print "\nArg value is $regex_value\n";
var_dump(preg_replace($regex_value, $replace, $subject));
}
$regex_value = new stdclass(); //Object
var_dump(preg_replace($regex_value, $replace, $subject));
?>
@@ -0,0 +1,25 @@
*** Testing preg_replace() : error conditions***
Arg value is abcdef
HipHop Warning: %a
NULL
Arg value is /[a-zA-Z]
HipHop Warning: %a
NULL
Arg value is [a-zA-Z]/
HipHop Warning: %a
NULL
Arg value is /[a-zA-Z]/F
HipHop Warning: %a
NULL
Arg value is Array
string(1) "a"
Arg value is /[a-zA-Z]/
string(1) "1"
Catchable fatal error: Object of class stdClass could not be converted to string in %spreg_replace_error1.php on line %d
@@ -0,0 +1,21 @@
<?php
/*
* proto string preg_replace(mixed regex, mixed replace, mixed subject [, int limit [, count]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_replace reacts to being passed the wrong type of replacement argument
*/
echo "*** Testing preg_replace() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
$replace = array('this is a string', array('this is', 'a subarray'),);
$subject = 'test';
foreach($replace as $value) {
print "\nArg value is: $value\n";
var_dump(preg_replace($regex, $value, $subject));
}
$value = new stdclass(); //Object
var_dump(preg_replace($regex, $value, $subject));
echo "Done";
?>
@@ -0,0 +1,10 @@
*** Testing preg_replace() : error conditions ***
Arg value is: this is a string
string(64) "this is a stringthis is a stringthis is a stringthis is a string"
Arg value is: Array
HipHop Warning: %a
bool(false)
Catchable fatal error: Object of class stdClass could not be converted to string in %spreg_replace_error2.php on line %d
@@ -0,0 +1,23 @@
<?php
/*
* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
* Function is implemented in ext/pcre/php_pcre.c
*/
echo "*** Testing preg_split() : error conditions ***\n";
// Zero arguments
echo "\n-- Testing preg_split() function with Zero arguments --\n";
var_dump(preg_split());
//Test preg_split with one more than the expected number of arguments
echo "\n-- Testing preg_split() function with more than expected no. of arguments --\n";
$pattern = '/_/';
$subject = 'string_val';
$limit = 10;
$flags = PREG_SPLIT_NO_EMPTY;
$extra_arg = 10;
var_dump(preg_split($pattern, $subject, $limit, $flags, $extra_arg));
// Testing preg_split withone less than the expected number of arguments
echo "\n-- Testing preg_split() function with less than expected no. of arguments --\n";
$pattern = '/\./';
var_dump(preg_split($pattern));
echo "Done"
?>
@@ -0,0 +1,14 @@
*** Testing preg_split() : error conditions ***
-- Testing preg_split() function with Zero arguments --
HipHop Warning: %a
bool(false)
-- Testing preg_split() function with more than expected no. of arguments --
HipHop Warning: %a
bool(false)
-- Testing preg_split() function with less than expected no. of arguments --
HipHop Warning: %a
bool(false)
Done
@@ -0,0 +1,24 @@
<?php
/*
* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_split reacts to being passed the wrong type of regex argument
*/
echo "*** Testing preg_split() : error conditions ***\n";
$regex_array = array('abcdef', //Regex without delimiter
'/[a-zA-Z]', //Regex without closing delimiter
'[a-zA-Z]/', //Regex without opening delimiter
'/[a-zA-Z]/F', array('[a-z]', //Array of Regexes
'[A-Z]', '[0-9]'), '/[a-zA-Z]/', //Regex string
);
$subject = '1 2 a 3 4 b 5 6';
foreach($regex_array as $regex_value) {
print "\nArg value is $regex_value\n";
var_dump(preg_split($regex_value, $subject));
}
$regex_value = new stdclass(); //Object
var_dump(preg_split($regex_value, $subject));
?>
@@ -0,0 +1,33 @@
*** Testing preg_split() : error conditions ***
Arg value is abcdef
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]
HipHop Warning: %a
bool(false)
Arg value is [a-zA-Z]/
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]/F
HipHop Warning: %a
bool(false)
Arg value is Array
HipHop Warning: %a
bool(false)
Arg value is /[a-zA-Z]/
array(3) {
[0]=>
string(4) "1 2 "
[1]=>
string(5) " 3 4 "
[2]=>
string(4) " 5 6"
}
HipHop Warning: %a
bool(false)
@@ -0,0 +1,20 @@
<?php
/*
* proto array preg_split(string pattern, string subject [, int limit [, int flags]])
* Function is implemented in ext/pcre/php_pcre.c
*/
error_reporting(E_ALL&~E_NOTICE);
/*
* Testing how preg_split reacts to being passed the wrong type of input argument
*/
echo "*** Testing preg_split() : error conditions ***\n";
$regex = '/[a-zA-Z]/';
$input = array(array('this is', 'a subarray'),);
foreach($input as $value) {
print "\nArg value is: $value\n";
var_dump(preg_split($regex, $value));
}
$value = new stdclass(); //Object
var_dump(preg_split($regex, $value));
echo "Done";
?>
@@ -0,0 +1,8 @@
*** Testing preg_split() : error conditions ***
Arg value is: Array
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
Done
+15
Ver Arquivo
@@ -0,0 +1,15 @@
<?php
var_dump(preg_split());
var_dump(preg_split('/*/', 'x'));
var_dump(preg_split('/[\s, ]+/', 'x yy,zzz'));
var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', -1));
var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 0));
var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 1));
var_dump(preg_split('/[\s, ]+/', 'x yy,zzz', 2));
var_dump(preg_split('/\d*/', 'ab2c3u'));
var_dump(preg_split('/\d*/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY));
?>
@@ -0,0 +1,66 @@
HipHop Warning: %a
bool(false)
HipHop Warning: %a
bool(false)
array(3) {
[0]=>
string(1) "x"
[1]=>
string(2) "yy"
[2]=>
string(3) "zzz"
}
array(3) {
[0]=>
string(1) "x"
[1]=>
string(2) "yy"
[2]=>
string(3) "zzz"
}
array(3) {
[0]=>
string(1) "x"
[1]=>
string(2) "yy"
[2]=>
string(3) "zzz"
}
array(1) {
[0]=>
string(8) "x yy,zzz"
}
array(2) {
[0]=>
string(1) "x"
[1]=>
string(6) "yy,zzz"
}
array(8) {
[0]=>
string(0) ""
[1]=>
string(1) "a"
[2]=>
string(1) "b"
[3]=>
string(0) ""
[4]=>
string(1) "c"
[5]=>
string(0) ""
[6]=>
string(1) "u"
[7]=>
string(0) ""
}
array(4) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "c"
[3]=>
string(1) "u"
}
+17
Ver Arquivo
@@ -0,0 +1,17 @@
<?php
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE));
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_OFFSET_CAPTURE));
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE));
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_OFFSET_CAPTURE));;
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
var_dump(preg_split('/(\d*)/', 'ab2c3u', -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_OFFSET_CAPTURE));
var_dump(preg_last_error(1));
ini_set('pcre.recursion_limit', 1);
var_dump(preg_last_error() == PREG_NO_ERROR);
var_dump(preg_split('/(\d*)/', 'ab2c3u'));
var_dump(preg_last_error() == PREG_RECURSION_LIMIT_ERROR);
?>
@@ -0,0 +1,293 @@
array(15) {
[0]=>
string(0) ""
[1]=>
string(0) ""
[2]=>
string(1) "a"
[3]=>
string(0) ""
[4]=>
string(1) "b"
[5]=>
string(1) "2"
[6]=>
string(0) ""
[7]=>
string(0) ""
[8]=>
string(1) "c"
[9]=>
string(1) "3"
[10]=>
string(0) ""
[11]=>
string(0) ""
[12]=>
string(1) "u"
[13]=>
string(0) ""
[14]=>
string(0) ""
}
array(8) {
[0]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(0)
}
[1]=>
array(2) {
[0]=>
string(1) "a"
[1]=>
int(0)
}
[2]=>
array(2) {
[0]=>
string(1) "b"
[1]=>
int(1)
}
[3]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(3)
}
[4]=>
array(2) {
[0]=>
string(1) "c"
[1]=>
int(3)
}
[5]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(5)
}
[6]=>
array(2) {
[0]=>
string(1) "u"
[1]=>
int(5)
}
[7]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(6)
}
}
array(6) {
[0]=>
string(1) "a"
[1]=>
string(1) "b"
[2]=>
string(1) "2"
[3]=>
string(1) "c"
[4]=>
string(1) "3"
[5]=>
string(1) "u"
}
array(4) {
[0]=>
array(2) {
[0]=>
string(1) "a"
[1]=>
int(0)
}
[1]=>
array(2) {
[0]=>
string(1) "b"
[1]=>
int(1)
}
[2]=>
array(2) {
[0]=>
string(1) "c"
[1]=>
int(3)
}
[3]=>
array(2) {
[0]=>
string(1) "u"
[1]=>
int(5)
}
}
array(15) {
[0]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(0)
}
[1]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(0)
}
[2]=>
array(2) {
[0]=>
string(1) "a"
[1]=>
int(0)
}
[3]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(1)
}
[4]=>
array(2) {
[0]=>
string(1) "b"
[1]=>
int(1)
}
[5]=>
array(2) {
[0]=>
string(1) "2"
[1]=>
int(2)
}
[6]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(3)
}
[7]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(3)
}
[8]=>
array(2) {
[0]=>
string(1) "c"
[1]=>
int(3)
}
[9]=>
array(2) {
[0]=>
string(1) "3"
[1]=>
int(4)
}
[10]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(5)
}
[11]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(5)
}
[12]=>
array(2) {
[0]=>
string(1) "u"
[1]=>
int(5)
}
[13]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(6)
}
[14]=>
array(2) {
[0]=>
string(0) ""
[1]=>
int(6)
}
}
array(6) {
[0]=>
array(2) {
[0]=>
string(1) "a"
[1]=>
int(0)
}
[1]=>
array(2) {
[0]=>
string(1) "b"
[1]=>
int(1)
}
[2]=>
array(2) {
[0]=>
string(1) "2"
[1]=>
int(2)
}
[3]=>
array(2) {
[0]=>
string(1) "c"
[1]=>
int(3)
}
[4]=>
array(2) {
[0]=>
string(1) "3"
[1]=>
int(4)
}
[5]=>
array(2) {
[0]=>
string(1) "u"
[1]=>
int(5)
}
}
HipHop Warning: %a
NULL
bool(true)
array(1) {
[0]=>
string(6) "ab2c3u"
}
bool(true)
+14
Ver Arquivo
@@ -0,0 +1,14 @@
<?php
foreach (array('2006-05-13', '06-12-12', 'data: "12-Aug-87"') as $s) {
var_dump(preg_match('~
(?P<date>
(?P<year>(\d{2})?\d\d) -
(?P<month>(?:\d\d|[a-zA-Z]{2,3})) -
(?P<day>[0-3]?\d))
~x', $s, $m));
var_dump($m);
}
?>
+69
Ver Arquivo
@@ -0,0 +1,69 @@
int(1)
array(10) {
[0]=>
string(10) "2006-05-13"
["date"]=>
string(10) "2006-05-13"
[1]=>
string(10) "2006-05-13"
["year"]=>
string(4) "2006"
[2]=>
string(4) "2006"
[3]=>
string(2) "20"
["month"]=>
string(2) "05"
[4]=>
string(2) "05"
["day"]=>
string(2) "13"
[5]=>
string(2) "13"
}
int(1)
array(10) {
[0]=>
string(8) "06-12-12"
["date"]=>
string(8) "06-12-12"
[1]=>
string(8) "06-12-12"
["year"]=>
string(2) "06"
[2]=>
string(2) "06"
[3]=>
string(0) ""
["month"]=>
string(2) "12"
[4]=>
string(2) "12"
["day"]=>
string(2) "12"
[5]=>
string(2) "12"
}
int(1)
array(10) {
[0]=>
string(8) "12-Aug-8"
["date"]=>
string(8) "12-Aug-8"
[1]=>
string(8) "12-Aug-8"
["year"]=>
string(2) "12"
[2]=>
string(2) "12"
[3]=>
string(0) ""
["month"]=>
string(3) "Aug"
[4]=>
string(3) "Aug"
["day"]=>
string(1) "8"
[5]=>
string(1) "8"
}
+14
Ver Arquivo
@@ -0,0 +1,14 @@
<?php
foreach (array(PREG_PATTERN_ORDER, PREG_SET_ORDER) as $flag) {
var_dump(preg_match_all('~
(?P<date>
(?P<year>(\d{2})?\d\d) -
(?P<month>(?:\d\d|[a-zA-Z]{2,3})) -
(?P<day>[0-3]?\d))
~x',
'2006-05-13 e outra data: "12-Aug-37"', $m, $flag));
var_dump($m);
}
?>
+122
Ver Arquivo
@@ -0,0 +1,122 @@
int(2)
array(10) {
[0]=>
array(2) {
[0]=>
string(10) "2006-05-13"
[1]=>
string(9) "12-Aug-37"
}
["date"]=>
array(2) {
[0]=>
string(10) "2006-05-13"
[1]=>
string(9) "12-Aug-37"
}
[1]=>
array(2) {
[0]=>
string(10) "2006-05-13"
[1]=>
string(9) "12-Aug-37"
}
["year"]=>
array(2) {
[0]=>
string(4) "2006"
[1]=>
string(2) "12"
}
[2]=>
array(2) {
[0]=>
string(4) "2006"
[1]=>
string(2) "12"
}
[3]=>
array(2) {
[0]=>
string(2) "20"
[1]=>
string(0) ""
}
["month"]=>
array(2) {
[0]=>
string(2) "05"
[1]=>
string(3) "Aug"
}
[4]=>
array(2) {
[0]=>
string(2) "05"
[1]=>
string(3) "Aug"
}
["day"]=>
array(2) {
[0]=>
string(2) "13"
[1]=>
string(2) "37"
}
[5]=>
array(2) {
[0]=>
string(2) "13"
[1]=>
string(2) "37"
}
}
int(2)
array(2) {
[0]=>
array(10) {
[0]=>
string(10) "2006-05-13"
["date"]=>
string(10) "2006-05-13"
[1]=>
string(10) "2006-05-13"
["year"]=>
string(4) "2006"
[2]=>
string(4) "2006"
[3]=>
string(2) "20"
["month"]=>
string(2) "05"
[4]=>
string(2) "05"
["day"]=>
string(2) "13"
[5]=>
string(2) "13"
}
[1]=>
array(10) {
[0]=>
string(9) "12-Aug-37"
["date"]=>
string(9) "12-Aug-37"
[1]=>
string(9) "12-Aug-37"
["year"]=>
string(2) "12"
[2]=>
string(2) "12"
[3]=>
string(0) ""
["month"]=>
string(3) "Aug"
[4]=>
string(3) "Aug"
["day"]=>
string(2) "37"
[5]=>
string(2) "37"
}
}
+74
Ver Arquivo
@@ -0,0 +1,74 @@
<?php
// this file is not used in the cron job
// use it to test the gcc regex with the sample data provided
$sampledata = "
/p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swfbitmap_init':
/p2/var/php_gcov/PHP_4_4/ext/ming/ming.c:323: warning: assignment from incompatible pointer type
/p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swftextfield_setFont':
/p2/var/php_gcov/PHP_4_4/ext/ming/ming.c:2597: warning: passing arg 2 of `SWFTextField_setFont' from incompatible pointer type
/p2/var/php_gcov/PHP_4_4/ext/oci8/oci8.c:1027: warning: `oci_ping' defined but not used
/p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getpgid':
/p2/var/php_gcov/PHP_4_4/ext/posix/posix.c:484: warning: implicit declaration of function `getpgid'
/p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getsid':
/p2/var/php_gcov/PHP_4_4/ext/posix/posix.c:506: warning: implicit declaration of function `getsid'
/p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_read_files':
/p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c:302: warning: implicit declaration of function `pread'
/p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_write_files':
/p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c:340: warning: implicit declaration of function `pwrite'
/p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_get_option':
/p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c:1862: warning: unused variable `timeout'
/p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_set_option':
/p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c:1941: warning: unused variable `timeout'
/p2/var/php_gcov/PHP_4_4/regex/regexec.c:19: warning: `nope' defined but not used
/p2/var/php_gcov/PHP_4_4/ext/standard/exec.c:50: warning: `php_make_safe_mode_command' defined but not used
/p2/var/php_gcov/PHP_4_4/ext/standard/image.c: In function `php_handle_jpc':
/p2/var/php_gcov/PHP_4_4/ext/standard/image.c:604: warning: unused variable `dummy_int'
/p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c: In function `php_gd_parse':
/p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c:1138: warning: implicit declaration of function `php_gd_lex'
/p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.y: At top level:
/p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.y:864: warning: return type defaults to `int'
/p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c: In function `zif_msg_receive':
/p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c:318: warning: passing arg 2 of `php_var_unserialize' from incompatible pointer type
/p2/var/php_gcov/PHP_4_4/ext/yp/yp.c: In function `zif_yp_err_string':
/p2/var/php_gcov/PHP_4_4/ext/yp/yp.c:372: warning: assignment discards qualifiers from pointer target type
Zend/zend_language_scanner.c:5944: warning: `yy_fatal_error' defined but not used
Zend/zend_language_scanner.c:2627: warning: `yy_last_accepting_state' defined but not used
Zend/zend_language_scanner.c:2628: warning: `yy_last_accepting_cpos' defined but not used
Zend/zend_language_scanner.c:2634: warning: `yy_more_flag' defined but not used
Zend/zend_language_scanner.c:2635: warning: `yy_more_len' defined but not used
Zend/zend_language_scanner.c:5483: warning: `yyunput' defined but not used
Zend/zend_language_scanner.c:5929: warning: `yy_top_state' defined but not used
conflicts: 2 shift/reduce
Zend/zend_ini_scanner.c:457: warning: `yy_last_accepting_state' defined but not used
Zend/zend_ini_scanner.c:458: warning: `yy_last_accepting_cpos' defined but not used
Zend/zend_ini_scanner.c:1361: warning: `yyunput' defined but not used
/p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c: In function `_safe_emalloc':
/p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 3)
/p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 4)
/p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 5)
/p2/var/php_gcov/PHP_4_4/Zend/zend_ini.c:338: warning: `zend_ini_displayer_cb' defined but not used
ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam':
/p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp'
ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam':
/p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp'
ext/ming/ming.o(.text+0xc115): In function `zim_swfmovie_namedAnchor':
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2207: undefined reference to `SWFMovie_namedAnchor'
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2209: undefined reference to `SWFMovie_xpto'
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2259: undefined reference to `SWFMovie_foo'
ext/ming/ming.o(.text+0x851): In function `zif_ming_setSWFCompression':
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:154: undefined reference to `Ming_setSWFCompression'
";
// Regular expression to select the error and warning information
// tuned for gcc 3.4, 4.0 and 4.1
$gcc_regex = '/^((.+)(\(\.text\+0x[[:xdigit:]]+\))?: In function [`\'](\w+)\':\s+)?'.
'((?(1)(?(3)[^:\n]+|\2)|[^:\n]+)):(\d+): (?:(error|warning):\s+)?(.+)'.
str_repeat('(?:\s+\5:(\d+): (?:(error|warning):\s+)?(.+))?', 99). // capture up to 100 errors
'/mS';
var_dump(preg_match_all($gcc_regex, $sampledata, $m, PREG_SET_ORDER));
print_r($m);
?>
+398
Ver Arquivo
@@ -0,0 +1,398 @@
int(24)
Array
(
[0] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swfbitmap_init':
/p2/var/php_gcov/PHP_4_4/ext/ming/ming.c:323: warning: assignment from incompatible pointer type
[1] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swfbitmap_init':
[2] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c
[3] =>
[4] => zif_swfbitmap_init
[5] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c
[6] => 323
[7] => warning
[8] => assignment from incompatible pointer type
)
[1] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swftextfield_setFont':
/p2/var/php_gcov/PHP_4_4/ext/ming/ming.c:2597: warning: passing arg 2 of `SWFTextField_setFont' from incompatible pointer type
[1] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c: In function `zif_swftextfield_setFont':
[2] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c
[3] =>
[4] => zif_swftextfield_setFont
[5] => /p2/var/php_gcov/PHP_4_4/ext/ming/ming.c
[6] => 2597
[7] => warning
[8] => passing arg 2 of `SWFTextField_setFont' from incompatible pointer type
)
[2] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/oci8/oci8.c:1027: warning: `oci_ping' defined but not used
[1] =>
[2] =>
[3] =>
[4] =>
[5] => /p2/var/php_gcov/PHP_4_4/ext/oci8/oci8.c
[6] => 1027
[7] => warning
[8] => `oci_ping' defined but not used
)
[3] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getpgid':
/p2/var/php_gcov/PHP_4_4/ext/posix/posix.c:484: warning: implicit declaration of function `getpgid'
[1] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getpgid':
[2] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c
[3] =>
[4] => zif_posix_getpgid
[5] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c
[6] => 484
[7] => warning
[8] => implicit declaration of function `getpgid'
)
[4] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getsid':
/p2/var/php_gcov/PHP_4_4/ext/posix/posix.c:506: warning: implicit declaration of function `getsid'
[1] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c: In function `zif_posix_getsid':
[2] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c
[3] =>
[4] => zif_posix_getsid
[5] => /p2/var/php_gcov/PHP_4_4/ext/posix/posix.c
[6] => 506
[7] => warning
[8] => implicit declaration of function `getsid'
)
[5] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_read_files':
/p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c:302: warning: implicit declaration of function `pread'
[1] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_read_files':
[2] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c
[3] =>
[4] => ps_read_files
[5] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c
[6] => 302
[7] => warning
[8] => implicit declaration of function `pread'
)
[6] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_write_files':
/p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c:340: warning: implicit declaration of function `pwrite'
[1] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c: In function `ps_write_files':
[2] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c
[3] =>
[4] => ps_write_files
[5] => /p2/var/php_gcov/PHP_4_4/ext/session/mod_files.c
[6] => 340
[7] => warning
[8] => implicit declaration of function `pwrite'
)
[7] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_get_option':
/p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c:1862: warning: unused variable `timeout'
[1] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_get_option':
[2] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c
[3] =>
[4] => zif_socket_get_option
[5] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c
[6] => 1862
[7] => warning
[8] => unused variable `timeout'
)
[8] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_set_option':
/p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c:1941: warning: unused variable `timeout'
[1] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c: In function `zif_socket_set_option':
[2] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c
[3] =>
[4] => zif_socket_set_option
[5] => /p2/var/php_gcov/PHP_4_4/ext/sockets/sockets.c
[6] => 1941
[7] => warning
[8] => unused variable `timeout'
)
[9] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/regex/regexec.c:19: warning: `nope' defined but not used
[1] =>
[2] =>
[3] =>
[4] =>
[5] => /p2/var/php_gcov/PHP_4_4/regex/regexec.c
[6] => 19
[7] => warning
[8] => `nope' defined but not used
)
[10] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/standard/exec.c:50: warning: `php_make_safe_mode_command' defined but not used
[1] =>
[2] =>
[3] =>
[4] =>
[5] => /p2/var/php_gcov/PHP_4_4/ext/standard/exec.c
[6] => 50
[7] => warning
[8] => `php_make_safe_mode_command' defined but not used
)
[11] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/standard/image.c: In function `php_handle_jpc':
/p2/var/php_gcov/PHP_4_4/ext/standard/image.c:604: warning: unused variable `dummy_int'
[1] => /p2/var/php_gcov/PHP_4_4/ext/standard/image.c: In function `php_handle_jpc':
[2] => /p2/var/php_gcov/PHP_4_4/ext/standard/image.c
[3] =>
[4] => php_handle_jpc
[5] => /p2/var/php_gcov/PHP_4_4/ext/standard/image.c
[6] => 604
[7] => warning
[8] => unused variable `dummy_int'
)
[12] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c: In function `php_gd_parse':
/p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c:1138: warning: implicit declaration of function `php_gd_lex'
[1] => /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c: In function `php_gd_parse':
[2] => /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c
[3] =>
[4] => php_gd_parse
[5] => /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.c
[6] => 1138
[7] => warning
[8] => implicit declaration of function `php_gd_lex'
)
[13] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.y:864: warning: return type defaults to `int'
[1] =>
[2] =>
[3] =>
[4] =>
[5] => /p2/var/php_gcov/PHP_4_4/ext/standard/parsedate.y
[6] => 864
[7] => warning
[8] => return type defaults to `int'
)
[14] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c: In function `zif_msg_receive':
/p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c:318: warning: passing arg 2 of `php_var_unserialize' from incompatible pointer type
[1] => /p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c: In function `zif_msg_receive':
[2] => /p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c
[3] =>
[4] => zif_msg_receive
[5] => /p2/var/php_gcov/PHP_4_4/ext/sysvmsg/sysvmsg.c
[6] => 318
[7] => warning
[8] => passing arg 2 of `php_var_unserialize' from incompatible pointer type
)
[15] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/ext/yp/yp.c: In function `zif_yp_err_string':
/p2/var/php_gcov/PHP_4_4/ext/yp/yp.c:372: warning: assignment discards qualifiers from pointer target type
[1] => /p2/var/php_gcov/PHP_4_4/ext/yp/yp.c: In function `zif_yp_err_string':
[2] => /p2/var/php_gcov/PHP_4_4/ext/yp/yp.c
[3] =>
[4] => zif_yp_err_string
[5] => /p2/var/php_gcov/PHP_4_4/ext/yp/yp.c
[6] => 372
[7] => warning
[8] => assignment discards qualifiers from pointer target type
)
[16] => Array
(
[0] => Zend/zend_language_scanner.c:5944: warning: `yy_fatal_error' defined but not used
Zend/zend_language_scanner.c:2627: warning: `yy_last_accepting_state' defined but not used
Zend/zend_language_scanner.c:2628: warning: `yy_last_accepting_cpos' defined but not used
Zend/zend_language_scanner.c:2634: warning: `yy_more_flag' defined but not used
Zend/zend_language_scanner.c:2635: warning: `yy_more_len' defined but not used
Zend/zend_language_scanner.c:5483: warning: `yyunput' defined but not used
Zend/zend_language_scanner.c:5929: warning: `yy_top_state' defined but not used
[1] =>
[2] =>
[3] =>
[4] =>
[5] => Zend/zend_language_scanner.c
[6] => 5944
[7] => warning
[8] => `yy_fatal_error' defined but not used
[9] => 2627
[10] => warning
[11] => `yy_last_accepting_state' defined but not used
[12] => 2628
[13] => warning
[14] => `yy_last_accepting_cpos' defined but not used
[15] => 2634
[16] => warning
[17] => `yy_more_flag' defined but not used
[18] => 2635
[19] => warning
[20] => `yy_more_len' defined but not used
[21] => 5483
[22] => warning
[23] => `yyunput' defined but not used
[24] => 5929
[25] => warning
[26] => `yy_top_state' defined but not used
)
[17] => Array
(
[0] => Zend/zend_ini_scanner.c:457: warning: `yy_last_accepting_state' defined but not used
Zend/zend_ini_scanner.c:458: warning: `yy_last_accepting_cpos' defined but not used
Zend/zend_ini_scanner.c:1361: warning: `yyunput' defined but not used
[1] =>
[2] =>
[3] =>
[4] =>
[5] => Zend/zend_ini_scanner.c
[6] => 457
[7] => warning
[8] => `yy_last_accepting_state' defined but not used
[9] => 458
[10] => warning
[11] => `yy_last_accepting_cpos' defined but not used
[12] => 1361
[13] => warning
[14] => `yyunput' defined but not used
)
[18] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c: In function `_safe_emalloc':
/p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 3)
/p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 4)
/p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c:237: warning: long int format, size_t arg (arg 5)
[1] => /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c: In function `_safe_emalloc':
[2] => /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c
[3] =>
[4] => _safe_emalloc
[5] => /p2/var/php_gcov/PHP_4_4/Zend/zend_alloc.c
[6] => 237
[7] => warning
[8] => long int format, size_t arg (arg 3)
[9] => 237
[10] => warning
[11] => long int format, size_t arg (arg 4)
[12] => 237
[13] => warning
[14] => long int format, size_t arg (arg 5)
)
[19] => Array
(
[0] => /p2/var/php_gcov/PHP_4_4/Zend/zend_ini.c:338: warning: `zend_ini_displayer_cb' defined but not used
[1] =>
[2] =>
[3] =>
[4] =>
[5] => /p2/var/php_gcov/PHP_4_4/Zend/zend_ini.c
[6] => 338
[7] => warning
[8] => `zend_ini_displayer_cb' defined but not used
)
[20] => Array
(
[0] => ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam':
/p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp'
[1] => ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam':
[2] => ext/mysql/libmysql/my_tempnam.o
[3] => (.text+0x80)
[4] => my_tempnam
[5] => /p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c
[6] => 115
[7] => warning
[8] => the use of `tempnam' is dangerous, better use `mkstemp'
)
[21] => Array
(
[0] => ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam':
/p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c:115: warning: the use of `tempnam' is dangerous, better use `mkstemp'
[1] => ext/mysql/libmysql/my_tempnam.o(.text+0x80): In function `my_tempnam':
[2] => ext/mysql/libmysql/my_tempnam.o
[3] => (.text+0x80)
[4] => my_tempnam
[5] => /p2/var/php_gcov/PHP_4_4/ext/mysql/libmysql/my_tempnam.c
[6] => 115
[7] => warning
[8] => the use of `tempnam' is dangerous, better use `mkstemp'
)
[22] => Array
(
[0] => ext/ming/ming.o(.text+0xc115): In function `zim_swfmovie_namedAnchor':
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2207: undefined reference to `SWFMovie_namedAnchor'
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2209: undefined reference to `SWFMovie_xpto'
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:2259: undefined reference to `SWFMovie_foo'
[1] => ext/ming/ming.o(.text+0xc115): In function `zim_swfmovie_namedAnchor':
[2] => ext/ming/ming.o
[3] => (.text+0xc115)
[4] => zim_swfmovie_namedAnchor
[5] => /p2/var/php_gcov/PHP_5_2/ext/ming/ming.c
[6] => 2207
[7] =>
[8] => undefined reference to `SWFMovie_namedAnchor'
[9] => 2209
[10] =>
[11] => undefined reference to `SWFMovie_xpto'
[12] => 2259
[13] =>
[14] => undefined reference to `SWFMovie_foo'
)
[23] => Array
(
[0] => ext/ming/ming.o(.text+0x851): In function `zif_ming_setSWFCompression':
/p2/var/php_gcov/PHP_5_2/ext/ming/ming.c:154: undefined reference to `Ming_setSWFCompression'
[1] => ext/ming/ming.o(.text+0x851): In function `zif_ming_setSWFCompression':
[2] => ext/ming/ming.o
[3] => (.text+0x851)
[4] => zif_ming_setSWFCompression
[5] => /p2/var/php_gcov/PHP_5_2/ext/ming/ming.c
[6] => 154
[7] =>
[8] => undefined reference to `Ming_setSWFCompression'
)
)
+19
Ver Arquivo
@@ -0,0 +1,19 @@
<?php
function evil($x) {
global $txt;
$txt[3] = "\xFF";
var_dump($x);
return $x[0];
}
$txt = "ola123";
var_dump(preg_replace_callback('#.#u', 'evil', $txt));
var_dump($txt);
var_dump(preg_last_error() == PREG_NO_ERROR);
var_dump(preg_replace_callback('#.#u', 'evil', $txt));
var_dump(preg_last_error() == PREG_BAD_UTF8_ERROR);
echo "Done!\n";
?>
+30
Ver Arquivo
@@ -0,0 +1,30 @@
array(1) {
[0]=>
string(1) "o"
}
array(1) {
[0]=>
string(1) "l"
}
array(1) {
[0]=>
string(1) "a"
}
array(1) {
[0]=>
string(1) "1"
}
array(1) {
[0]=>
string(1) "2"
}
array(1) {
[0]=>
string(1) "3"
}
string(6) "ola123"
string(6) "olaÿ23"
bool(true)
NULL
bool(true)
Done!
+4
Ver Arquivo
@@ -0,0 +1,4 @@
<?php
$data = '(#11/19/2002#)';
var_dump(preg_split('/\b/', $data));
?>
@@ -0,0 +1,16 @@
array(7) {
[0]=>
string(2) "(#"
[1]=>
string(2) "11"
[2]=>
string(1) "/"
[3]=>
string(2) "19"
[4]=>
string(1) "/"
[5]=>
string(4) "2002"
[6]=>
string(2) "#)"
}
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
class Foo {
function foo() {
$s = 'preg_replace() is broken';
var_dump(preg_replace_callback(
'/broken/',
array(&$this, 'bar'),
$s
));
}
function bar() {
return 'working';
}
} // of Foo
$o = new Foo;
?>
@@ -0,0 +1 @@
string(25) "preg_replace() is working"
+5
Ver Arquivo
@@ -0,0 +1,5 @@
<?php
$str = "a\000b";
$str_quoted = preg_quote($str);
var_dump(preg_match("!{$str_quoted}!", $str), $str_quoted);
?>
@@ -0,0 +1,2 @@
int(1)
string(6) "a\000b"
+6
Ver Arquivo
@@ -0,0 +1,6 @@
<?php
var_dump(preg_match_all('|(\w+)://([^\s"<]*[\w+#?/&=])|', "This is a text string", $matches, PREG_SET_ORDER));
var_dump($matches);
?>
@@ -0,0 +1,3 @@
int(0)
array(0) {
}
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
function func1(){
$string = 'what the word and the other word the';
preg_match_all('/(?P<word>the)/', $string, $matches);
return $matches['word'];
}
$words = func1();
var_dump($words);
?>
@@ -0,0 +1,10 @@
array(4) {
[0]=>
string(3) "the"
[1]=>
string(3) "the"
[2]=>
string(3) "the"
[3]=>
string(3) "the"
}
+21
Ver Arquivo
@@ -0,0 +1,21 @@
<?php
$s_string = '1111111111';
$s_search = '/1/';
$s_replace = 'One ';
$i_limit = 1;
$i_count = 0;
$s_output = preg_replace($s_search, $s_replace, $s_string, $i_limit,
$i_count);
echo "Output = " . var_export($s_output, True) . "\n";
echo "Count = $i_count\n";
var_dump(preg_last_error() === PREG_NO_ERROR);
$i_limit = strlen($s_string);
$s_output = preg_replace($s_search, $s_replace, $s_string, $i_limit,
$i_count);
echo "Output = " . var_export($s_output, True) . "\n";
echo "Count = $i_count\n";
var_dump(preg_last_error() === PREG_NO_ERROR);
?>
@@ -0,0 +1,6 @@
Output = 'One 111111111'
Count = 1
bool(true)
Output = 'One One One One One One One One One One '
Count = 10
bool(true)
+7
Ver Arquivo
@@ -0,0 +1,7 @@
<?php
$foo = 'bla bla bla';
var_dump(preg_match('/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/', $foo, $m));
var_dump($m);
?>
@@ -0,0 +1,3 @@
int(0)
array(0) {
}
+9
Ver Arquivo
@@ -0,0 +1,9 @@
<?php
var_dump(preg_match('@^(/([a-z]*))*$@', '//abcde', $m)); var_dump($m);
var_dump(preg_match('@^(/(?:[a-z]*))*$@', '//abcde', $m)); var_dump($m);
var_dump(preg_match('@^(/([a-z]+))+$@', '/a/abcde', $m)); var_dump($m);
var_dump(preg_match('@^(/(?:[a-z]+))+$@', '/a/abcde', $m)); var_dump($m);
?>
@@ -0,0 +1,32 @@
int(1)
array(3) {
[0]=>
string(7) "//abcde"
[1]=>
string(6) "/abcde"
[2]=>
string(5) "abcde"
}
int(1)
array(2) {
[0]=>
string(7) "//abcde"
[1]=>
string(6) "/abcde"
}
int(1)
array(3) {
[0]=>
string(8) "/a/abcde"
[1]=>
string(6) "/abcde"
[2]=>
string(5) "abcde"
}
int(1)
array(2) {
[0]=>
string(8) "/a/abcde"
[1]=>
string(6) "/abcde"
}
+16
Ver Arquivo
@@ -0,0 +1,16 @@
<?php
$pattern =
"/\s([\w_\.\/]+)(?:=([\'\"]?(?:[\w\d\s\?=\(\)\.,'_#\/\\:;&-]|(?:\\\\\"|\\\')?)+[\'\"]?))?/";
$context = "<simpletag an_attribute=\"simpleValueInside\">";
$match = array();
if ($result =preg_match_all($pattern, $context, $match))
{
var_dump($result);
var_dump($match);
}
?>
@@ -0,0 +1,18 @@
int(1)
array(3) {
[0]=>
array(1) {
[0]=>
string(33) " an_attribute="simpleValueInside""
}
[1]=>
array(1) {
[0]=>
string(12) "an_attribute"
}
[2]=>
array(1) {
[0]=>
string(19) ""simpleValueInside""
}
}
+13
Ver Arquivo
@@ -0,0 +1,13 @@
<?php
// by legolas558
$regex = '/(insert|drop|create|select|delete|update)([^;\']*('."('[^']*')+".')?)*(;|$)/i';
$sql = 'SELECT * FROM #__components';
if (preg_match($regex,$sql, $m)) echo 'matched';
else echo 'not matched';
print_r($m);
?>
@@ -0,0 +1,9 @@
matchedArray
(
[0] => SELECT * FROM #__components
[1] => SELECT
[2] =>
[3] =>
[4] =>
[5] =>
)
+45
Ver Arquivo
@@ -0,0 +1,45 @@
<?php
$letexte="<br><br>";
$ligne_horizontale = $puce = $debut_intertitre = $fin_intertitre = '';
$cherche1 = array(
/* 0 */ "/\n(----+|____+)/S",
/* 1 */ "/\n-- */S",
/* 2 */ "/\n- */S",
/* 3 */ "/\n_ +/S",
/* 4 */ "/(^|[^{])[{][{][{]/S",
/* 5 */ "/[}][}][}]($|[^}])/S",
/* 6 */ "/(( *)\n){2,}(<br[[:space:]]*\/?".">)?/S",
/* 7 */ "/[{][{]/S",
/* 8 */ "/[}][}]/S",
/* 9 */ "/[{]/S",
/* 10 */ "/[}]/S",
/* 11 */ "/(<br[[:space:]]*\/?".">){2,}/S",
/* 12 */ "/<p>([\n]*(<br[[:space:]]*\/?".">)*)*/S",
/* 13 */ "/<quote>/S",
/* 14 */ "/<\/quote>/S"
);
$remplace1 = array(
/* 0 */ "\n\n$ligne_horizontale\n\n",
/* 1 */ "\n<br />&mdash;&nbsp;",
/* 2 */ "\n<br />$puce&nbsp;",
/* 3 */ "\n<br />",
/* 4 */ "\$1\n\n$debut_intertitre",
/* 5 */ "$fin_intertitre\n\n\$1",
/* 6 */ "<p>",
/* 7 */ "<strong class=\"spip\">",
/* 8 */ "</strong>",
/* 9 */ "<i class=\"spip\">",
/* 10 */ "</i>",
/* 11 */ "<p>",
/* 12 */ "<p>",
/* 13 */ "<blockquote class=\"spip\"><p>",
/* 14 */ "</blockquote><p>"
);
$letexte = preg_replace($cherche1, $remplace1, $letexte);
$letexte = preg_replace("@^ <br />@S", "", $letexte);
print $letexte;
?>
@@ -0,0 +1 @@
<p>

Alguns arquivos não foram exibidos porque demasiados arquivos foram alterados neste diff Mostrar Mais