Re: Failure in bitwise operations moving from 5.2.x to 5.3.x
| From: | Adam Richardson | Date: | Tue, 15 Mar 2011 16:18:17 +0000 |
| Subject: | Re: Failure in bitwise operations moving from 5.2.x to 5.3.x | ||
| References: | 1 2 3 4 5 6 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311868@lists.php.net to get a copy of this message | ||
On Tue, Mar 15, 2011 at 12:15 PM, Adam Richardson <simpleshot@gmail.com>wrote:
> On Tue, Mar 15, 2011 at 11:50 AM, Andy McKenzie <amckenzie4@gmail.com>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