From f4927c28bc3b1d7d50a81c9cd1655d003b4a8202 Mon Sep 17 00:00:00 2001 From: Felipe Pena Date: Sat, 6 Nov 2010 18:32:10 +0000 Subject: - Fixed bug #52732 (Docs say preg_match() returns FALSE on error, but it returns int(0)) patch by: slugonamission at gmail dot com --- ext/pcre/php_pcre.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'ext/pcre/php_pcre.c') diff --git a/ext/pcre/php_pcre.c b/ext/pcre/php_pcre.c index ccb0a51c0e..ef7e051d86 100644 --- a/ext/pcre/php_pcre.c +++ b/ext/pcre/php_pcre.c @@ -754,7 +754,13 @@ PHPAPI void php_pcre_match_impl(pcre_cache_entry *pce, char *subject, int subjec 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; + } } /* }}} */ -- cgit v1.2.1