Re: Failure in bitwise operations moving from 5.2.x to 5.3.x

From: Date: Tue, 15 Mar 2011 12:07:22 +0000
Subject: Re: Failure in bitwise operations moving from 5.2.x to 5.3.x
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-311858@lists.php.net to get a copy of this message
On Mon, Mar 14, 2011 at 11:39 PM, Adam Richardson <simpleshot@gmail.com> wrote: >> >> This one's got me stumped.  I >> have the following line in a script: >> >> $this->bc = ($this->network | (~$this->netmask)) & 4294967295; >> >> $this->network and $this->netmask should both be of type long, and I >> should wind up with another long.  I didn't write the original method, >> and I can't remember what "bc" stands for at the moment, but it's part >> of a tool for working out first and last IP address, netmask, and a >> few other things from a subnet definition. >> >> On the old system, it works fine.  On the new system, I get the following >> error: >> >> "PHP Fatal error:  Unsupported operand types in >> /var/www/test/common_subnet.inc on line 39" >> > > Have you checked the types being operated on? I'm wondering if somehow one > of the object properties you're operating on has changed has changed in > terms of type. > > I'd try var_dumping each of the properties ($this->network and > $this->netmask) the line above just to make sure they didn't somehow get > switched to a type that bitwise operators complain about (array, Object.) > > Adam > > -- > Nephtali:  A simple, flexible, fast, and security-focused PHP framework > http://nephtaliproject.com > I'll check when I get back to work, but I doubt that's it: the last time either is touched, it's being converted from an network address or netmask to a long, using ip2long. I would assume that if there was a problem with that, it would show up there, not when it got further down. I'll check the values, though, as I say... I hadn't really considered that something might be failing silently earlier on. -Alex

« previous php.general (#311858) next »