Re: com php-src: fix empty string check: ext/mbstring/php_mbregex.c

From: Date: Fri, 19 Sep 2014 11:00:08 +0000
Subject: Re: com php-src: fix empty string check: ext/mbstring/php_mbregex.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-81770@lists.php.net to get a copy of this message
On Fri, Sep 19, 2014 at 11:23 AM, Anatol Belski <ab@php.net> wrote: > Commit: bf7203e1e02f1313a3fd8beb3bbdb102a77f1388 > Author: Anatol Belski <ab@php.net> Fri, 19 Sep 2014 11:23:23 > +0200 > Parents: 953386edfd4f0d59c3a8ead1ea90b20e49796ea3 > Branches: master > > Link: > > http://git.php.net/?p=php-src.git;a=commitdiff;h=bf7203e1e02f1313a3fd8beb3bbdb102a77f1388 > > Log: > fix empty string check > > Changed paths: > M ext/mbstring/php_mbregex.c > > > Diff: > diff --git a/ext/mbstring/php_mbregex.c b/ext/mbstring/php_mbregex.c > index 864d50a..62b3e96 100644 > --- a/ext/mbstring/php_mbregex.c > +++ b/ext/mbstring/php_mbregex.c > @@ -717,7 +717,7 @@ static void > _php_mb_regex_ereg_exec(INTERNAL_FUNCTION_PARAMETERS, int icase) > /* don't bother doing an extended regex with just a number > */ > } > > - if (!Z_STRVAL_P(arg_pattern) || Z_STRLEN_P(arg_pattern) == 0) { > + if (!Z_STRVAL_P(arg_pattern)[0] || Z_STRLEN_P(arg_pattern) == 0) { > php_error_docref(NULL TSRMLS_CC, E_WARNING, "empty > pattern"); > RETVAL_FALSE; > goto out; > The first part of the condition can be dropped altogether. The second part already checks that the length is zero, so this is kinda doing the same check twice. Nikita

« previous php.cvs (#81770) next »