ZF2-179: Serializer\Adapter\PhpCode 's testcase will fail in PHP 5.4
Description
Serializer/Adapter/PhpCodeTest.php ' testUnserialzeInvalid will fail in PHP 5.4
$ ~/php-src-trunk/sapi/cli/php ~/tmp/phpunit35_14/bin/phpunit -c tests/phpunit.xml tests/Zend/Serializer/Adapter/PhpCodeTest.php
will return
PHPUnit 3.5.15 by Sebastian Bergmann.
.........F
Time: 0 seconds, Memory: 2.25Mb
There was 1 failure:
1) ZendTest\Serializer\Adapter\PhpCodeTest::testUnserialzeInvalid
Failed asserting that contains "eval failed: syntax error, unexpected T_STRING".
This fail is caused by PHP 5.4 's error_get_last() 's messsage change
--
eval.php
<?php
$code = 'not a serialized string';
$eval = @eval('$ret=' . $code . ';');
var_dump(error_get_last());
run php-5.4
$ ./php-5.4.0RC8/sapi/cli/php eval.php
return
array(4) {
["type"]=>
int(4)
["message"]=>
string(39) "syntax error, unexpected 'a' (T_STRING)"
run php-5.3.10
$ ./php-5.3.10/sapi/cli/php eval.php
return
array(4) {
["type"]=>
int(4)
["message"]=>
string(33) "syntax error, unexpected T_STRING"
By the way, in ZF1 (current trunk) ' testcode
$this->setExpectedException('Zend_Serializer_Exception');
So this issue will not occure in ZF1..
Comments
Posted by Kazusuke Sasezaki (sasezaki) on 2012-02-25T18:09:04.000+0000
Travis-CI'S environment report is
PHP 5.3 http://travis-ci.org/#!/sasezaki/zf2/jobs/727792 PHP 5.4 http://travis-ci.org/#!/sasezaki/zf2/jobs/727793
Posted by Marc Bennewitz (private) (mabe) on 2012-02-25T18:43:00.000+0000
The error message has been changed in 5.4 - thats not a problem but I'll update the test case to solve it.
Posted by Kazusuke Sasezaki (sasezaki) on 2012-02-25T18:43:08.000+0000
pull request https://github.com/zendframework/zf2/pull/837
Posted by Marc Bennewitz (private) (mabe) on 2012-02-25T18:56:45.000+0000
you did it already - thanks
Posted by Kazusuke Sasezaki (sasezaki) on 2012-02-28T14:17:06.000+0000
fixed at latest HEAD