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 Tue, Mar 15, 2011 at 12:15 PM, Adam Richardson <simpleshot@xxxxxxxxx>wrote:

> On Tue, Mar 15, 2011 at 11:50 AM, Andy McKenzie <amckenzie4@xxxxxxxxx>wrote:
>
>> > Now:  I did a little more looking around this morning, and it looks
>> > like I may well run into problems here given that I'm moving from a
>> > 32-bit architecture to a 64-bit architecture.  Bitwise math is still
>> > fairly obscure to me, so it's likely that I'm overlooking something
>> > obvious, but maybe instead of asking "How do I fix this?" I should be
>> > asking "What would the right way to do this have been?"  As I think I
>> > said before, I didn't actually write most of this code, I inherited
>> > it, and as long as the input and output of the class remain the same,
>> > I don't actually care how the work is done.
>> >
>> >
>> > If anyone has any useful input here, I'd appreciate it!
>> >
>> > -Alex
>> >
>>
>> As it turns out, the most important lesson here is:  "Don't trust what
>> anyone tells you."  The old server is 64-bit.  The new server is
>> 32-bit.  Once I stopped to check that myself, it all became clear.
>> For the archives, here's what happened.
>>
>> Everything worked fine until I ran bindec() on the binary netmask;  at
>> that point it returned a float rather than an int, as it it used to.
>> Therefore, when I ran ip2long on the result, it choked, and returned
>> bool(false).  Which isn't really useful when you're trying to produce
>> a human-readable netmask, when you get right down to it.
>>
>> I still don't have a solution that will work on a 32-bit server, but
>> now that I know what's going on, I should be able to either find
>> something that will work, or get things moved to a 64-bit machine.
>>
>>
>> -Alex
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
> Nice detective work, Alex.
>
> Thanks for posting this info back to the list. I'm sure some tired-eyed
> developer some time in the future will benefit from having this information
> available in the list archives (it might even be me once my shabby memory
> has lost the index for this valuable info.)
>
> Adam
>
> --
> Nephtali:  A simple, flexible, fast, and security-focused PHP framework
> http://nephtaliproject.com
>

My apologies:

Nice detective work ANDY (sorry, Andy, see earlier note about my shabby
memory.) I'd just replied to an Alex on another list.

Sorry.

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com

[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