Re: Bug #1235: string arithmetical misbehaviour

From: Date: Mon, 15 Mar 1999 18:25:14 +0000
Subject: Re: Bug #1235: string arithmetical misbehaviour
References: 1 2  Groups: php.dev 
Request: Send a blank email to php-dev+get-4630@lists.php.net to get a copy of this message
The leak should be fixed now. Andi At 14:04 15/03/99 +0100, Sascha Schumann wrote: >On Mon, Mar 15, 1999 at 11:13:04AM -0000, tolj@pwi.de wrote: >> From: tolj@pwi.de >> Operating system: Linux 2.0.36 >> PHP version: 3.0.7 >> PHP Bug Type: Misbehaving function >> Bug description: string arithmetical misbehaviour >> >> what about this misbehaviour of string arithmetics: >> >> $foo = "04"; >> $foo++; >> echo $foo; ## reports "05" >> >> $foo = "04"; >> $foo--; >> echo $foo; ## reports "3" without leading zero !! >> >> I suppose both should react the same, or am I wrong?! > >Btw, running the above script yields: > >[sas@flaubert php3]$ ./php ><? >$foo = "04"; >$foo++; >echo $foo; ## reports "05" > >$foo = "04"; >$foo--; >echo $foo; ## reports "3" without leading zero !! >Content-type: text/html > >053Freeing 0x201A9650 (3 bytes), allocated in operators.c on line 730<br> > >--- >if (op1->value.str.len == 0) { > /* Takes care of empty_string etc. cases where we can't erealloc() */ > result->value.str.val = (char *) emalloc(result->value.str.len + 1); > STR_FREE(op1->value.str.val); >} >--- > >CVS version from yesterday. > >-- > > Regards, > > Sascha Schumann | > Consultant | finger sas@schell.de > | for PGP public key > >-- >PHP Development Mailing List http://www.php.net/ >To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net >For help: php-dev-help@lists.php.net > > > --- Andi Gutmans <andi@zend.com> ICQ: 1568297 PGP: finger andi@vipe.technion.ac.il -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#4630) next »