Re: cvs: php4 /ext/standard array.c
| From: | Jeroen van Wolffelaar | Date: | Fri, 05 Oct 2001 21:13:40 +0000 |
| Subject: | Re: cvs: php4 /ext/standard array.c | ||
| References: | 1 2 3 4 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-7674@lists.php.net to get a copy of this message | ||
There's one small error, second parameter of RETURN_STRING is duplicate or
not,
RETURN_STRINGL(str,strlen,dup) is what you meant.
With that fix indeed I think it's correct then. (dup should be 1 I think).
Though the difference with returning or not is wether there are multiple
occurences, the one gives the first occurance, the current behaviour gives
the last.
Also, please CC to php-cvs, or in general, always use reply all.
--Jeroen
----- Original Message -----
From: "Edin Kadribasic" <edink@proventum.net>
To: "Jeroen van Wolffelaar" <jeroen@A-Eskwadraat.nl>
Sent: Friday, October 05, 2001 11:11 PM
Subject: Re: [PHP-CVS] cvs: php4 /ext/standard array.c
> When I aplied this patch, everything seem to work as it was supposed to.
>
> ----- Original Message -----
> From: "Jeroen van Wolffelaar" <jeroen@a-eskwadraat.nl>
> To: "Edin Kadribasic" <edink@proventum.net>
> Sent: Friday, October 05, 2001 10:53 PM
> Subject: Re: [PHP-CVS] cvs: php4 /ext/standard array.c
>
>
> > I know, but I don't know wether there was a reason to not do so.
> >
> > --Jeroen
> > ----- Original Message -----
> > From: "Edin Kadribasic" <edink@proventum.net>
> > To: "Jeroen van Wolffelaar" <jeroen@A-Eskwadraat.nl>
> > Sent: Friday, October 05, 2001 10:49 PM
> > Subject: Re: [PHP-CVS] cvs: php4 /ext/standard array.c
> >
> >
> > > To accomplish that I think that RETVAL_STRING should be replaced with
> > > RETURN_STRING and RETVAL_LONG with RETURN_LONG. This should fix the
> > problem.
> > >
> > > ----- Original Message -----
> > > From: "Jeroen van Wolffelaar" <jeroen@A-Eskwadraat.nl>
> > > To: "Edin Kadribasic" <edink@proventum.net>
> > > Cc: <php-cvs@lists.php.net>; "PHP Development List"
> > <php-dev@lists.php.net>
> > > Sent: Friday, October 05, 2001 10:42 PM
> > > Subject: Re: [PHP-CVS] cvs: php4 /ext/standard array.c
> > >
> > >
> > > > Because for some reason php_search_array decides to not stop at
first
> > > > match, but take the last match when returning keys... I don't
> understand
> > > > why. Any objections against stopping at first match? That's the
> quickest
> > > > for this function, since you don't need to go through the whole
array
> if
> > > > the match is near the beginning anymore.
> > > >
> > > >
> > > > I was going to add a test anyway, because this is a typical function
> > > > which NEEDS a test...
> > > >
> > > > --Jeroen
> > > >
> > > > On Fri, 5 Oct 2001, Edin Kadribasic wrote:
> > > >
> > > > > Hi Jeroen,
> > > > >
> > > > > Why does this:
> > > > >
> > > > > $a=array(1=>'a', 2=>'b');
> > > > > $c=array_search ('b', $a);
> > > > > $d=in_array ('b', $a);
> > > > > var_dump($c);
> > > > > var_dump($d);
> > > > >
> > > > > prints:
> > > > >
> > > > > bool(false)
> > > > > bool(true)
> > > > >
> > > > > Edin
> > > > > ----- Original Message -----
> > > > > From: "Jeroen van Wolffelaar" <jeroen@A-Eskwadraat.nl>
> > > > > To: <php-cvs@lists.php.net>
> > > > > Sent: Friday, October 05, 2001 10:14 PM
> > > > > Subject: [PHP-CVS] cvs: php4 /ext/standard array.c
> > > > >
> > > > >
> > > > > > jeroen Fri Oct 5 16:14:33 2001 EDT
> > > > > >
> > > > > > Modified files:
> > > > > > /php4/ext/standard array.c
> > > > > > Log:
> > > > > > Fix bug 13567 and don't depend on a boolean int-value to be
> either
> > 1
> > > or
> > > > > 0
> > > > > >
> > > > > >
> > > > > > Index: php4/ext/standard/array.c
> > > > > > diff -u php4/ext/standard/array.c:1.138
> > > php4/ext/standard/array.c:1.139
> > > > > > --- php4/ext/standard/array.c:1.138 Fri Oct 5 14:38:51 2001
> > > > > > +++ php4/ext/standard/array.c Fri Oct 5 16:14:33 2001
> > > > > > @@ -21,7 +21,7 @@
> > > > > >
> > > > >
> > +----------------------------------------------------------------------+
> > > > > > */
> > > > > >
> > > > > > -/* $Id: array.c,v 1.138 2001/10/05 18:38:51 edink Exp $ */
> > > > > > +/* $Id: array.c,v 1.139 2001/10/05 20:14:33 jeroen Exp $ */
> > > > > >
> > > > > > #include "php.h"
> > > > > > #include "php_ini.h"
> > > > > > @@ -1071,7 +1071,7 @@
> > > > > > zend_hash_internal_pointer_reset_ex(target_hash, &pos);
> > > > > > while(zend_hash_get_current_data_ex(target_hash, (void
> **)&entry,
> > > &pos)
> > > > > == SUCCESS) {
> > > > > > compare_func(&res, *value, *entry TSRMLS_CC);
> > > > > > - if (Z_LVAL(res) == 1) {
> > > > > > + if (Z_LVAL(res)) {
> > > > > > if (behavior==0) {
> > > > > > RETURN_TRUE;
> > > > > > } else {
> > > > > > @@ -1090,11 +1090,7 @@
> > > > > > zend_hash_move_forward_ex(target_hash, &pos);
> > > > > > }
> > > > > >
> > > > > > - if (behavior == 0) {
> > > > > > - RETURN_FALSE;
> > > > > > - } else {
> > > > > > - return;
> > > > > > - }
> > > > > > + RETURN_FALSE;
> > > > > > }
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > PHP CVS Mailing List (http://www.php.net/)
> > > > > > To unsubscribe, e-mail: php-cvs-unsubscribe@lists.php.net
> > > > > > For additional commands, e-mail: php-cvs-help@lists.php.net
> > > > > > To contact the list administrators, e-mail:
> > > php-list-admin@lists.php.net
> > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > > Jeroen van Wolffelaar
> > > > Jeroen@A-Eskwadraat.nl
> > > > http://www.A-Eskwadraat.nl/~jeroen
> > > >
> > > >
> > > >
> > >
> > >
> >
> >
> >
>