Re: [PHP4BETA] propose for bool -> string conversion:

From: Date: Fri, 02 Jul 1999 12:23:02 +0000
Subject: Re: [PHP4BETA] propose for bool -> string conversion:
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-1787@lists.php.net to get a copy of this message
On Fri, 2 Jul 1999 bourbon@netvision.net.il wrote: > On Fri, 2 Jul 1999, Thies C. Arntzen wrote: > > > diff -w -u -r1.14 zend_operators.c > > --- zend_operators.c 1999/06/26 11:48:22 1.14 > > +++ zend_operators.c 1999/07/02 12:08:46 > > @@ -287,8 +287,13 @@ > > case IS_STRING: > > break; > > case IS_BOOL: > > - op->value.str.val = > > (op->value.lval?estrndup("1",1):estrndup("0",1)); > > + if (op->value.lval) { > > + op->value.str.val = estrndup("1",1); > > op->value.str.len = 1; > > + } else { > > + op->value.str.val = empty_string; > > + op->value.str.len = 0; > > + } > > break; > > case IS_LONG: > > lval = op->value.lval; > > > > this patch will get us the "good old php3 behaviour" back: > > > > true -> "1" > > false -> "" (instead of "0") > > Why does it matter? 'cause otherwise it'll break a lot of php-code that's around;-) eg: the "good ole "if (strlen(strpos..." won't work otherwise <? echo strlen(strpos("hallo","h"))."\n"; echo strlen(strpos("hallo","w"))."\n"; ?> php3: Content-type: text/html 1 0 php4: Content-Type: text/html 1 1 i don't think people will like this! regards, tc > > Zeev > > -- > ----------------------------------------------------- > Zeev Suraski <zeev@zend.com> > For a PGP public key, finger bourbon@netvision.net.il > > > Thies C. Arntzen "One Big-Mac, Small Fries and a Coke!" Digital Collections Phone +49 40 235350 Fax +49 40 23535180 Hammerbrookstr. 93 20097 Hamburg / Germany

« previous php.version4 (#1787) next »