PHPUnit Fatal Errors for PHP 5.2.17 #687

tm1000 opened this Issue Oct 11, 2012 · 11 comments


None yet

6 participants

tm1000 commented Oct 11, 2012

When using Travis-CI and PHP-Build along with PHP-Unit on PHP 5.2.17 we are running into this error

Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in /home/travis/.phpenv/versions/5.2.17/pear/File/Iterator/Autoload.php on line 45

Perhaps some bad code was pushed into pear a while back and it is just now trickling down.

We've been pointed in several different directions on this one after doing some code review myself it seems as though the offending file is actually part of PHP-Unit. (though It might have already been fixed)

Please reference: php-build/php-build#82 and travis-ci/travis-ci#722

For more details

edorian commented Oct 12, 2012

It seems travis-ci upgraded you to PHPUnit 3.7 which is PHP >= 5.3.3.

Given that PHP 5.2 isn't supported anymore for 2 years we decided to switch PHPUnit to 5.3 for the new version.

If you depend on 5.2 support downgrade to PHPUnit 3.6 ( you seem to be doing so in CHH/php-build-plugin-phpunit#1 anyways).

From a PHPUnit side there is not much we can do here. The version change is needed and the old version is not going away. I think we pushed out another 3.6 release to help with dependency management but for all 5.2 projects CI envs have to use PHPUnit 3.6

hope thats fine and feel free to join #phpunit on freenode if you run into issues

@edorian edorian closed this Oct 12, 2012
tm1000 commented Oct 12, 2012

@edorian makes sense I think we'll get it figured out in I understand about moving up and onward. 5.2 is something like 4-5 years old anyways.

CHH commented Oct 13, 2012

Is it possible to make PHPUnit 3.6 depend on File_Iterator <= 1.3.2, PHP_Timer <= 1.0.3 and Text_Template <= 1.1.2?

Seems like the autoloading was changed to use Closures in the latest versions of these packages. So when one does just pear install phpunit/PHPUnit-3.6.12 he has a broken PHPUnit on 5.2.

Also I get the error of "duplicate" packages when trying to install PHPUnit 3.6.12:

vagrant@lucid32:/tmp/php-5.2.17$ ./bin/pear install phpunit/PHPUnit-3.6.12
Did not download optional dependencies: phpunit/PHP_Invoker, use --alldeps to download automatically
Duplicate package channel:// found
Duplicate package channel:// found
install failed

When I manually install File_Iterator then I will get the same error just with Text_Template and PHP_Timer.


What you suggest has already been done: PHPUnit 3.6.12 has been re-released with updated metadata information.

edorian commented Oct 13, 2012

I don't know how graceful pear is when it comes to downgrading versions but for installing a new phpunit (what you seem to be doing in your vbox) I think it should pick up the right dependencies. The re-release was done a couple weeks back iirc to ease "staying on 3.6" without installing fixed versions for all deps.

If that doesn't work out like planned I'll have another look

[sb@sb]/webspace/ ll PHPUnit-3.6.12.tgz
-rw-r--r-- 1 sb sb 120240 Oct 11 22:26 PHPUnit-3.6.12.tgz
CHH commented Oct 13, 2012

@edorian Could you please have another look? PEAR complains about duplicate packages, just like in the error message I've posted.

I got the error I've posted just about half an hour ago, when trying to do pear install PHPUnit-3.6.12. For travis, I explicitly install the right versions of these dependencies for now, then it works.


Looks like a bug in PEAR to me:

CHH commented Oct 13, 2012

Thanks Sebastian! 😃


I was having the same issue and did something similar to CHH to install 3.6.12; I installed manually the dependencies that threw an error and then installed the phpUnit package.


Hi Sebastian,

Today I spend some time searching why I couldn't install PHPUnit 3.6.12. Beside bug above there was also below error:
Fatal error: Call to undefined function php_timer_autoload() in .....

For the benefit of people that are still using this version could you please add a rule that phpunit/PHP_Timer package should have version of 1.0.2. Bug was appearing in version 1.0.4 - probably method have been deleted there.

PS. Sorry for not creating separate bug ticket.



Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment