Skip to content

PHPUnit Fatal Errors for PHP 5.2.17 #687

Closed

Description

@tm1000

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

Activity

  1. edorian commented on Oct 12, 2012

    @edorian
    SponsorContributor

    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

  2. tm1000 commented on Oct 12, 2012

    @tm1000
    Author

    @edorian makes sense I think we'll get it figured out in https://github.com/CHH/php-build-plugin-phpunit/issues/1 I understand about moving up and onward. 5.2 is something like 4-5 years old anyways.

  3. CHH commented on Oct 13, 2012

    @CHH

    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://pear.phpunit.de/File_Iterator-1.3.3 found
    Duplicate package channel://pear.phpunit.de/File_Iterator-1.3.2 found
    install failed
    

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

  4. sebastianbergmann commented on Oct 13, 2012

    @sebastianbergmann
    Owner

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

  5. edorian commented on Oct 13, 2012

    @edorian
    SponsorContributor

    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

  6. sebastianbergmann commented on Oct 13, 2012

    @sebastianbergmann
    Owner
    [sb@sb]/webspace/phpunit.de/pear/html/get% ll PHPUnit-3.6.12.tgz
    -rw-r--r-- 1 sb sb 120240 Oct 11 22:26 PHPUnit-3.6.12.tgz
    
  7. CHH commented on Oct 13, 2012

    @CHH

    @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.

  8. sebastianbergmann commented on Oct 13, 2012

    @sebastianbergmann
    Owner

    Looks like a bug in PEAR to me: https://pear.php.net/bugs/bug.php?id=19650

  9. CHH commented on Oct 13, 2012

    @CHH

    Thanks Sebastian! 😃

  10. dexbarrett commented on Oct 25, 2012

    @dexbarrett

    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.

  11. Cinderella-Man commented on Nov 23, 2012

    @Cinderella-Man

    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.

    Thanks,

    Kamil

  12. locked as resolved and limited conversation to collaborators on Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions