Issues

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

The error message has been changed in 5.4 - thats not a problem but I'll update the test case to solve it.

you did it already - thanks

fixed at latest HEAD