Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.0.7

Bug #10805 Invalid num values on x86_64 AMD
Submitted: 2007-04-22 19:04 UTC
From: ps84 Assigned:
Status: Wont fix Package: Net_DNS (version 1.0.0)
PHP Version: 5.2.1 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2007-04-22 19:04 UTC] ps84 (Petr Stastny)
Description: ------------ PHP 5.2.1 has a bug in unpack() function that incorrectly converts integers from packet on x86_64 AMD Opteron processor machines. See: http://bugs.php.net/bug.php?id=40543 A a result, DNS resolver returns invalid values in SOA (for example). Net_DNS should count with this problem. I used simple function to correct unpacked number: function unpack_n_amd64fix($num) { $nbin = sprintf('%b',$num); if (strlen($nbin) == 64) { $new = substr($nbin, 33); return bindec($new); } return $num; } When the binary representation of the number is 64 chars long (so we are in 64bit architecture), cut away first 32 bits.

Comments

 [2007-07-03 20:45 UTC] fa (Florian Anderiasch)
PHP 5.2.2or 5.2.3 should fix this - not a PEAR package bug