Re: [PHP4BETA] bugs and a leak

From: Date: Thu, 13 Apr 2000 16:37:32 +0000
Subject: Re: [PHP4BETA] bugs and a leak
References: 1  Groups: php.version4 
Request: Send a blank email to php-version4+get-13512@lists.php.net to get a copy of this message
I have nothing to add to this discussion, but at least the memory leak is now fixed. Zeev On Thu, 13 Apr 2000, Chad Cunningham wrote: > > I'm not sure if these are bugs or if I'm just expecting too much... Using > RC1. > > First problem I've noticed is that fread($fp, -128) does not move the > offset at all, much less to 128 bytes from the end... Shouldn't this work? > > Second, there seems to be inconsistency in the way php deals with > hex. For example, php does not consider 0xff and ff to be equal. Shouldn't > PHP ignore the 0x when doing a comparison? I noticed this reading a byte > from a file which had the value 0xff, however php stores it as just ff and > doing a comparison between the read byte and 0xff failed when they > should both have the same value. In other words, if the first byte of a > file is 11111111 and I do > > $fp = fopen($file, "r"); > $byte = bin2hex(fread($fp, 1)); > $byte == 0xff ? print "Yep" : print "Nope"; > > This will output Nope even though they are the same value. > > Also, if $byte is read from a file to and converted to hex for the value > ff, the following two things do not do the same thing > > $byte &= f0; > $byte &= 0xf0; > > The first one, while giving the correct answer, issues the following > > zend_execute.c(1937) : Freeing 0x08142B2C (3 bytes), script=./test.php > zend_variables.c(125) : Actual location (location was relayed) > > The second one, while not giving the correct answer, does not leak. Should > not both of these do the same thing (without leaking memory..)? > > -- Zeev Suraski <zeev@zend.com> http://www.zend.com/

« previous php.version4 (#13512) next »