com php-src: - Fixed bug #63409 (php-dba function test fails on big-endian machine) patch by: tianhonglouis at gmail dot com:
ext/dba/tests/bug38698.phpt
| From: | Felipe Pena | Date: | Wed, 26 Jun 2013 16:50:37 +0000 |
| Subject: | com php-src: - Fixed bug #63409 (php-dba function test fails on big-endian machine) patch by: tianhonglouis at gmail dot com: ext/dba/tests/bug38698.phpt |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-72512@lists.php.net to get a copy of this message | ||
Commit: 7e33b5d2fa89a6bf167fc4061dcf6aedab1cc6b8
Author: Felipe Pena <felipensp@gmail.com> Wed, 26 Jun 2013 13:50:37 -0300
Parents: f477ad22c2c23a1237dcd3a2c67165b838315241
Branches: PHP-5.4 PHP-5.5 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=7e33b5d2fa89a6bf167fc4061dcf6aedab1cc6b8
Log:
- Fixed bug #63409 (php-dba function test fails on big-endian machine) patch by: tianhonglouis at
gmail dot com
Bugs:
https://bugs.php.net/63409
Changed paths:
M ext/dba/tests/bug38698.phpt
Diff:
diff --git a/ext/dba/tests/bug38698.phpt b/ext/dba/tests/bug38698.phpt
index 56dde85..1d1ed67 100644
--- a/ext/dba/tests/bug38698.phpt
+++ b/ext/dba/tests/bug38698.phpt
@@ -8,10 +8,18 @@ Bug #38698 (Bug #38698 for some keys cdbmake creates corrupted db and cdb
can't
--FILE--
<?php
+function isLittleEndian() {
+ return 0x00FF === current(unpack('v', pack('S',0x00FF)));
+}
+
$db_file = dirname(__FILE__) .'/129php.cdb';
if (($db_make=dba_open($db_file, "n", 'cdb_make'))!==FALSE) {
- dba_insert(pack('i',129), "Booo!", $db_make);
+ if (isLittleEndian() === FALSE) {
+ dba_insert(pack('V',129), "Booo!", $db_make);
+ } else{
+ dba_insert(pack('i',129), "Booo!", $db_make);
+ }
dba_close($db_make);
// write md5 checksum of generated database file
var_dump(md5_file($db_file));