patch by: slugonamission at gmail dot com
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;
+ }
}
/* }}} */
?>
--EXPECT--
-int(0)
+bool(false)
bool(true)
int(10)
bool(true)
--- /dev/null
+--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
echo "Done\n";
?>
--EXPECT--
-int(0)
+bool(false)
array(0) {
}
bool(true)
?>
--EXPECT--
-int(0)
+bool(false)
bool(true)
int(1)
bool(true)