Issues

ZF2-179: Serializer\Adapter\PhpCode 's testcase will fail in PHP 5.4

Issue Type: Unit Tests: Problem Created: 2012-02-25T18:04:58.000+0000 Last Updated: 2012-02-28T14:17:06.000+0000 Status: Resolved Fix version(s): Reporter: Kazusuke Sasezaki (sasezaki) Assignee: Kazusuke Sasezaki (sasezaki) Tags: - Zend\Serializer

Related issues: Attachments:

Description

Serializer/Adapter/PhpCodeTest.php ' testUnserialzeInvalid will fail in PHP 5.4

<pre class="highlight">
$ ~/php-src-trunk/sapi/cli/php ~/tmp/phpunit35_14/bin/phpunit -c tests/phpunit.xml tests/Zend/Serializer/Adapter/PhpCodeTest.php 

will return

<pre class="highlight">
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

<pre class="highlight">
<?php
$code = 'not a serialized string';
$eval = @eval('$ret=' . $code . ';');
var_dump(error_get_last());

run php-5.4

<pre class="highlight">
$ ./php-5.4.0RC8/sapi/cli/php eval.php

return

<pre class="highlight">
array(4) {
  ["type"]=>
  int(4)
  ["message"]=>
  string(39) "syntax error, unexpected 'a' (T_STRING)"

run php-5.3.10

<pre class="highlight">
$ ./php-5.3.10/sapi/cli/php eval.php

return

<pre class="highlight">
array(4) {
  ["type"]=>
  int(4)
  ["message"]=>
  string(33) "syntax error, unexpected T_STRING"

By the way, in ZF1 (current trunk) ' testcode

<pre class="highlight">
$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

Have you found an issue?

See the Overview section for more details.

Copyright

© 2006-2016 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.

Contacts