svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/pcre/php_pcre.c branches/PHP_5_3/ext/pcre/tests/backtrack_limit.phpt
branches/PHP_5_3/ext/pcre/tests/bug52732.phpt branches/PHP_5_3/ext/pcre/tests/invalid_utf8_offset.phpt
branches/PHP_5_3/ext/pcre/tests/recursion_limit.phpt trunk/ext/pcre/php_pcre.c trunk/ext/pcre/tests/backtrack_limit.phpt
trunk/ext/pcre/tests/bug52732.phpt trunk/ext/pcre/tests/invalid_utf8_offset.phpt trunk/ext/pcre/tests/recursion_limit.phpt
| From: | Felipe Pena | Date: | Sat, 06 Nov 2010 18:32:10 +0000 |
| Subject: | svn: /php/php-src/ branches/PHP_5_3/NEWS branches/PHP_5_3/ext/pcre/php_pcre.c branches/PHP_5_3/ext/pcre/tests/backtrack_limit.phpt branches/PHP_5_3/ext/pcre/tests/bug52732.phpt branches/PHP_5_3/ext/pcre/tests/invalid_utf8_offset.phpt branches/PHP_5_3/ext/pcre/tests/recursion_limit.phpt trunk/ext/pcre/php_pcre.c trunk/ext/pcre/tests/backtrack_limit.phpt trunk/ext/pcre/tests/bug52732.phpt trunk/ext/pcre/tests/invalid_utf8_offset.phpt trunk/ext/pcre/tests/recursion_limit.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-63771@lists.php.net to get a copy of this message | ||
felipe Sat, 06 Nov 2010 18:32:10 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=305132
Log:
- Fixed bug #52732 (Docs say preg_match() returns FALSE on error, but it returns int(0))
patch by: slugonamission at gmail dot com
Bug: http://bugs.php.net/52732 (Open) Docs say preg_match()
returns FALSE on error, but it returns int(0)
Changed paths:
U php/php-src/branches/PHP_5_3/NEWS
U php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c
U php/php-src/branches/PHP_5_3/ext/pcre/tests/backtrack_limit.phpt
A php/php-src/branches/PHP_5_3/ext/pcre/tests/bug52732.phpt
U php/php-src/branches/PHP_5_3/ext/pcre/tests/invalid_utf8_offset.phpt
U php/php-src/branches/PHP_5_3/ext/pcre/tests/recursion_limit.phpt
U php/php-src/trunk/ext/pcre/php_pcre.c
U php/php-src/trunk/ext/pcre/tests/backtrack_limit.phpt
A php/php-src/trunk/ext/pcre/tests/bug52732.phpt
U php/php-src/trunk/ext/pcre/tests/invalid_utf8_offset.phpt
U php/php-src/trunk/ext/pcre/tests/recursion_limit.phpt
Modified: php/php-src/branches/PHP_5_3/NEWS
===================================================================
--- php/php-src/branches/PHP_5_3/NEWS 2010-11-06 18:24:47 UTC (rev 305131)
+++ php/php-src/branches/PHP_5_3/NEWS 2010-11-06 18:32:10 UTC (rev 305132)
@@ -106,6 +106,8 @@
get_class_name before calling it). (Kalle, Gustavo)
- Fixed bug #52744 (cal_days_in_month incorrect for December 1 BCE).
(gpap at internet dot gr, Adam)
+- Fixed bug #52732 (Docs say preg_match() returns FALSE on error, but it
+ returns int(0)). (slugonamission at gmail dot com)
- Fixed bug #52725 (gcc builtin atomic functions were sometimes used when they
were not available). (fat)
- Fixed bug #52745 (Binding params doesn't work when selecting a date inside a
Modified: php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c 2010-11-06 18:24:47 UTC (rev 305131)
+++ php/php-src/branches/PHP_5_3/ext/pcre/php_pcre.c 2010-11-06 18:32:10 UTC (rev 305132)
@@ -754,7 +754,13 @@
efree(offsets);
efree(subpat_names);
- RETVAL_LONG(matched);
+ /* Did we encounter an error? */
+ if(PCRE_G(error_code) == PHP_PCRE_NO_ERROR) {
+ RETVAL_LONG(matched);
+ }
+ else {
+ RETVAL_FALSE;
+ }
}
/* }}} */
Modified: php/php-src/branches/PHP_5_3/ext/pcre/tests/backtrack_limit.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pcre/tests/backtrack_limit.phpt 2010-11-06 18:24:47 UTC (rev
305131)
+++ php/php-src/branches/PHP_5_3/ext/pcre/tests/backtrack_limit.phpt 2010-11-06 18:32:10 UTC (rev
305132)
@@ -19,7 +19,7 @@
?>
--EXPECT--
-int(0)
+bool(false)
bool(true)
int(10)
bool(true)
Added: php/php-src/branches/PHP_5_3/ext/pcre/tests/bug52732.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pcre/tests/bug52732.phpt (rev 0)
+++ php/php-src/branches/PHP_5_3/ext/pcre/tests/bug52732.phpt 2010-11-06 18:32:10 UTC (rev 305132)
@@ -0,0 +1,13 @@
+--TEST--
+Bug #52732 (Docs say preg_match() returns FALSE on error, but it returns int(0))
+--INI--
+pcre.backtrack_limit=1
+--FILE--
+<?php
+$ret = preg_match('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar');
+
+var_dump($ret);
+
+?>
+--EXPECT--
+bool(false)
\ No newline at end of file
Property changes on: php/php-src/branches/PHP_5_3/ext/pcre/tests/bug52732.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/branches/PHP_5_3/ext/pcre/tests/invalid_utf8_offset.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pcre/tests/invalid_utf8_offset.phpt 2010-11-06 18:24:47 UTC
(rev 305131)
+++ php/php-src/branches/PHP_5_3/ext/pcre/tests/invalid_utf8_offset.phpt 2010-11-06 18:32:10 UTC
(rev 305132)
@@ -22,7 +22,7 @@
echo "Done\n";
?>
--EXPECT--
-int(0)
+bool(false)
array(0) {
}
bool(true)
Modified: php/php-src/branches/PHP_5_3/ext/pcre/tests/recursion_limit.phpt
===================================================================
--- php/php-src/branches/PHP_5_3/ext/pcre/tests/recursion_limit.phpt 2010-11-06 18:24:47 UTC (rev
305131)
+++ php/php-src/branches/PHP_5_3/ext/pcre/tests/recursion_limit.phpt 2010-11-06 18:32:10 UTC (rev
305132)
@@ -19,7 +19,7 @@
?>
--EXPECT--
-int(0)
+bool(false)
bool(true)
int(1)
bool(true)
Modified: php/php-src/trunk/ext/pcre/php_pcre.c
===================================================================
--- php/php-src/trunk/ext/pcre/php_pcre.c 2010-11-06 18:24:47 UTC (rev 305131)
+++ php/php-src/trunk/ext/pcre/php_pcre.c 2010-11-06 18:32:10 UTC (rev 305132)
@@ -754,7 +754,13 @@
efree(offsets);
efree(subpat_names);
- RETVAL_LONG(matched);
+ /* Did we encounter an error? */
+ if(PCRE_G(error_code) == PHP_PCRE_NO_ERROR) {
+ RETVAL_LONG(matched);
+ }
+ else {
+ RETVAL_FALSE;
+ }
}
/* }}} */
Modified: php/php-src/trunk/ext/pcre/tests/backtrack_limit.phpt
===================================================================
--- php/php-src/trunk/ext/pcre/tests/backtrack_limit.phpt 2010-11-06 18:24:47 UTC (rev 305131)
+++ php/php-src/trunk/ext/pcre/tests/backtrack_limit.phpt 2010-11-06 18:32:10 UTC (rev 305132)
@@ -19,7 +19,7 @@
?>
--EXPECT--
-int(0)
+bool(false)
bool(true)
int(10)
bool(true)
Added: php/php-src/trunk/ext/pcre/tests/bug52732.phpt
===================================================================
--- php/php-src/trunk/ext/pcre/tests/bug52732.phpt (rev 0)
+++ php/php-src/trunk/ext/pcre/tests/bug52732.phpt 2010-11-06 18:32:10 UTC (rev 305132)
@@ -0,0 +1,13 @@
+--TEST--
+Bug #52732 (Docs say preg_match() returns FALSE on error, but it returns int(0))
+--INI--
+pcre.backtrack_limit=1
+--FILE--
+<?php
+$ret = preg_match('/(?:\D+|<\d+>)*[!?]/', 'foobar foobar foobar');
+
+var_dump($ret);
+
+?>
+--EXPECT--
+bool(false)
\ No newline at end of file
Property changes on: php/php-src/trunk/ext/pcre/tests/bug52732.phpt
___________________________________________________________________
Added: svn:keywords
+ Id Rev Revision
Added: svn:eol-style
+ native
Modified: php/php-src/trunk/ext/pcre/tests/invalid_utf8_offset.phpt
===================================================================
--- php/php-src/trunk/ext/pcre/tests/invalid_utf8_offset.phpt 2010-11-06 18:24:47 UTC (rev 305131)
+++ php/php-src/trunk/ext/pcre/tests/invalid_utf8_offset.phpt 2010-11-06 18:32:10 UTC (rev 305132)
@@ -22,7 +22,7 @@
echo "Done\n";
?>
--EXPECT--
-int(0)
+bool(false)
array(0) {
}
bool(true)
Modified: php/php-src/trunk/ext/pcre/tests/recursion_limit.phpt
===================================================================
--- php/php-src/trunk/ext/pcre/tests/recursion_limit.phpt 2010-11-06 18:24:47 UTC (rev 305131)
+++ php/php-src/trunk/ext/pcre/tests/recursion_limit.phpt 2010-11-06 18:32:10 UTC (rev 305132)
@@ -19,7 +19,7 @@
?>
--EXPECT--
-int(0)
+bool(false)
bool(true)
int(1)
bool(true)