php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Return to Bug #52732
Patch preg_match_false_on_error revision 2010-10-07 13:39 UTC by slugonamission at gmail dot com
Patch Bug_52732_preg_match_false_on_error revision 2010-10-07 13:37 UTC by slugonamission at gmail dot com

Patch Bug_52732_preg_match_false_on_error for PCRE related Bug #52732

Patch version 2010-10-07 13:37 UTC

Return to Bug #52732 | Download this patch
This patch is obsolete

Obsoleted by patches:

Patch Revisions:

Developer: slugonamission@gmail.com

Index: ext/pcre/php_pcre.c
===================================================================
--- ext/pcre/php_pcre.c	(revision 304164)
+++ ext/pcre/php_pcre.c	(working copy)
@@ -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;
+	}
 }
 /* }}} */
 
Index: ext/pcre/tests/backtrack_limit.phpt
===================================================================
--- ext/pcre/tests/backtrack_limit.phpt	(revision 304164)
+++ ext/pcre/tests/backtrack_limit.phpt	(working copy)
@@ -19,7 +19,7 @@
 
 ?>
 --EXPECT--
-int(0)
+bool(false)
 bool(true)
 int(10)
 bool(true)
Index: ext/pcre/tests/invalid_utf8_offset.phpt
===================================================================
--- ext/pcre/tests/invalid_utf8_offset.phpt	(revision 304164)
+++ ext/pcre/tests/invalid_utf8_offset.phpt	(working copy)
@@ -22,7 +22,7 @@
 echo "Done\n";
 ?>
 --EXPECT--
-int(0)
+bool(false)
 array(0) {
 }
 bool(true)
Index: ext/pcre/tests/recursion_limit.phpt
===================================================================
--- ext/pcre/tests/recursion_limit.phpt	(revision 304164)
+++ ext/pcre/tests/recursion_limit.phpt	(working copy)
@@ -19,7 +19,7 @@
 
 ?>
 --EXPECT--
-int(0)
+bool(false)
 bool(true)
 int(1)
 bool(true)
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Sun Apr 20 03:02:42 2014 UTC