msgpack / msgpack-php

msgpack.org[PHP]
BSD 3-Clause "New" or "Revised" License
774 stars 120 forks source link

tests/041.phpt failure #108

Closed glensc closed 4 years ago

glensc commented 7 years ago

i've built 2.0.1 for php 7.0.12 and notice tests/041.phpt failing. a 64bit linux platform.

i don't really understand the test hex2bin of NAN should be cb7ff8000000000000 but is cb8000000000000000 huh?

$ export 'NO_INTERACTION=1' 'REPORT_EXIT_STATUS=1' 'MALLOC_CHECK_=2'
$ /usr/bin/make -j7 test 'PHP_EXECUTABLE=/usr/bin/php70' 'PHP_TEST_SHARED_SYSTEM_EXTENSIONS=pcre spl session' 'RUN_TESTS_SETTINGS=-q tests/041.phpt --show-all'

Build complete.
Don't forget to run 'make test'.

=====================================================================
PHP         : /usr/bin/php70 
PHP_SAPI    : cli
PHP_VERSION : 7.0.12
ZEND_VERSION: 3.0.0
PHP_OS      : Linux - Linux carme-pld 4.1.34-1 #1 SMP Fri Oct 21 13:55:58 CEST 2016 x86_64
INI actual  : /home/users/glen/rpm/BUILD/x86_64-linux/php70-pecl-msgpack-2.0.1/tmp-php.ini
More .INIs  :   
CWD         : /home/users/glen/rpm/BUILD/x86_64-linux/php70-pecl-msgpack-2.0.1
Extra dirs  : 
VALGRIND    : Not used
=====================================================================
Running selected tests.
TEST 1/1 [tests/041.phpt]
========TEST========
<?php
function test($type, $variable) {
    $serialized = msgpack_serialize($variable);
    $unserialized = msgpack_unserialize($serialized);

    echo $type, PHP_EOL;
    var_dump($variable);
    var_dump($unserialized);

    echo bin2hex($serialized), PHP_EOL;
    echo PHP_EOL;
}

test('double NaN:', NAN);
test('double Inf:', INF);
test('double -Inf:', -INF);
test('double 0.0:', 0.0);
test('double -0.0:', -0.0);
========DONE========

========OUT========
double NaN:
float(NAN)
float(NAN)
cb7ff8000000000000

double Inf:
float(INF)
float(INF)
cb7ff0000000000000

double -Inf:
float(-INF)
float(-INF)
cbfff0000000000000

double 0.0:
float(0)
float(0)
cb0000000000000000

double -0.0:
float(-0)
float(-0)
cb8000000000000000
========DONE========

========EXP========
double NaN:
float(NAN)
float(NAN)
cb7ff8000000000000

double Inf:
float(INF)
float(INF)
cb7ff0000000000000

double -Inf:
float(-INF)
float(-INF)
cbfff0000000000000

double 0.0:
float(0)
float(0)
cb0000000000000000

double -0.0:
float(0)
float(0)
cb0000000000000000
========DONE========

========DIFF========
022+ float(-0)
023+ float(-0)
024+ cb8000000000000000
022- float(0)
023- float(0)
024- cb0000000000000000
========DONE========
FAIL Check for double NaN, Inf, -Inf, 0, and -0 [tests/041.phpt] 
=====================================================================
Number of tests :    1                 1
Tests skipped   :    0 (  0.0%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :    1 (100.0%) (100.0%)
Expected fail   :    0 (  0.0%) (  0.0%)
Tests passed    :    0 (  0.0%) (  0.0%)
---------------------------------------------------------------------
Time taken      :    0 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
Check for double NaN, Inf, -Inf, 0, and -0 [tests/041.phpt]
=====================================================================
glensc commented 7 years ago

seems very similar to this problem i've encountered in the past: https://github.com/jedisct1/libsodium-php/issues/82