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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Mar 14, 2011 at 11:39 PM, Adam Richardson <simpleshot@xxxxxxxxx> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux