Opened 12 years ago

Closed 11 years ago

Last modified 11 years ago

#35291 closed defect (wontfix)

pear-PHPUnit doesn't work with php 5.4.5

Reported by: Garfield-fr (Bertrand Zuchuat) Owned by: pixilla (Bradley Giesbrecht)
Priority: Normal Milestone:
Component: ports Version: 2.1.1
Keywords: Cc: modemmonkey@…, kasperligaard+macports@…, ciaran.lyons@…, simon@…, macjoost@…, miken32 (Michael Newton)
Port: pear-PHPUnit

Description (last modified by ryandesign (Ryan Carsten Schmidt))

Hi,

I have this error after upgrade 5.4.4 to 5.4.5:

Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php54/pear/share/pear/PHPUnit/Autoload.php on line 45

Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:') in /opt/local/lib/php54/pear/share/pear/PHPUnit/Autoload.php on line 45

before upgrade, my phpunit work.

My pear install is on: /opt/local/lib/php54/pear/

My php.ini config:

include_path = ".:/opt/local/lib/php54/pear/:/opt/local/lib/php54/pear/share/pear/"

Please help me.

Thanks

Change History (32)

comment:1 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Description: modified (diff)
Keywords: phpunit removed
Port: phpunit added

Remember to use WikiFormatting when writing in Trac.

Which port have you used to install phpunit: "pear-PHPUnit" or one of the older ports whose names begin with "php5-unit"?

comment:2 Changed 12 years ago by Garfield-fr (Bertrand Zuchuat)

Thanks to formatting my request ;)

I use this for phpunit install: http://www.phpunit.de/manual/3.6/en/installation.html

comment:3 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: pixilla@… added
Resolution: invalid
Status: newclosed

If you installed phpunit not using MacPorts commands, then you'll need to ask for help elsewhere.

comment:4 Changed 12 years ago by Garfield-fr (Bertrand Zuchuat)

This is a standard procedure to install de phpunit.

With php 5.4.4 (MacPorts) and this install. This is work fine.

Why ?

Bullshit :(

comment:5 Changed 12 years ago by Garfield-fr (Bertrand Zuchuat)

Resolution: invalid
Status: closedreopened

I desinstalled the phpunit (install phpunit.de) and install with mac port (sudo port pear-PHPUnit) but i have the same error.

comment:6 Changed 12 years ago by Garfield-fr (Bertrand Zuchuat)

For info:

port installed | grep pear
  pear-Archive_Tar @1.3.10_0 (active)
  pear-Console_Getopt @1.3.1_0 (active)
  pear-install-phar @20110901_3 (active)
  pear-PEAR @1.9.4_0 (active)
  pear-PHPUnit @3.6.11_0 (active)
  pear-Structures_Graph @1.0.4_0 (active)
  pear-XML_Util @1.2.1_0 (active)
  php54-pear @20110901_3 (active)

comment:7 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Cc: pixilla@… removed
Owner: changed from macports-tickets@… to pixilla@…
Status: reopenednew

comment:8 Changed 12 years ago by ryandesign (Ryan Carsten Schmidt)

Port: pear-PHPUnit added; phpunit removed
Summary: phpunit doesn't work with php 5.4.5pear-PHPUnit doesn't work with php 5.4.5

comment:9 Changed 12 years ago by pixilla (Bradley Giesbrecht)

pear-PHPUnit does not provide "File/Iterator/Autoload.php".

Perhaps you are missing/wanting pear-File_Iterator:

$ port contents pear-File_Iterator
Port pear-File_Iterator contains:
  /opt/local/lib/php/pear/File/Iterator.php
  /opt/local/lib/php/pear/File/Iterator/Autoload.php
...

comment:10 Changed 12 years ago by Garfield-fr (Bertrand Zuchuat)

Why not provide ?

PHPUnit work with File_Iterator:

File /opt/local/lib/php/pear/PHPUnit:

require_once 'File/Iterator/Autoload.php';

Do you have a commandline to install this ?

Thanks

comment:11 in reply to:  10 Changed 12 years ago by pixilla (Bradley Giesbrecht)

Replying to bertrand.zuchuat@…:

Why not provide ?

Is File_Iterator a "REQUIRED" dependency of PHPUnit?

I see no mention here: phpunit installation

Do you have a commandline to install this ?

$ port echo pear-*
$ sudo port install pear-File_Iterator

comment:12 Changed 12 years ago by Garfield-fr (Bertrand Zuchuat)

Yes

File_Iterator is required with phpunit 3.6

You show that on file autoload.php of phpunit.

comment:13 Changed 12 years ago by Garfield-fr (Bertrand Zuchuat)

I don't find pear-File_iterator when i check with

port echo pear-*

comment:14 Changed 12 years ago by modemmonkey@…

I also have the same issue, however I'm on the basic php5 port (which is 5.3).

I ran into this with pear-PHPUnit@3.6.11_0. When I change the active version back to @3.5.13_0, it works fine.

Like bertrand, I also don't see any pear-File_Iterator port available.

comment:15 Changed 12 years ago by modemmonkey@…

Cc: modemmonkey@… added

Cc Me!

comment:16 Changed 12 years ago by kasperligaard+macports@…

I am also in the basic php5 port (currently 5.3.15) and have the exact same problem. PHPUnit requires File/Iterator.

I searched for pear-File_Iterator, but no such port exists. I tried installing php5-file-iterator (1.2.6_0), but that didn't help.

My guess is that if the pear-File_Iterator port was added, and the pear_PHPUnit port was updated to require pear-File_Iterator, then phpunit would work.

Another thing I noticed is a problem of PATH setting: The new pear-* ports put their executable files in /opt/local/lib/php/PEAR/bin, but that path is not added to the PATH environment variable, when the pear-PEAR port is installed. I dug in a little further and found that I have both ports "php5-pear" and "pear-PEAR". Probably only one of then should be installed, so they should exclude each other when installing. I have two "pear" executables: One in /opt/local/bin (from php5-pear) and another in /opt/local/lib/php/PEAR/bin (from pear-PEAR); Naturally, the same happens with PHPUnit when I install both php5-unit and pear_PHPUnit.

Like "modemmonkey" above, I can confirm that installing the port php5-unit, phpunit works. Note that php5-unit has php5-file-iterator as a dependency - which reinforces my belief that if the port pear_File_Iterator is added and made dependency for pear-PHPUnit, then things would work.

PS: The thing about port pear-PEAR not adding the /opt/local/lib/php/PEAR/bin directory to the PATH variable might need a seperate ticket..?

comment:17 Changed 12 years ago by kasperligaard+macports@…

Cc: kasperligaard+macports@… added

Cc Me!

comment:18 in reply to:  16 Changed 12 years ago by pixilla (Bradley Giesbrecht)

Replying to kasperligaard+macports@…:

The new pear-* ports put their executable files in /opt/local/lib/php/PEAR/bin

The pear-* ports are designed to install the pear packages using MacPorts, not pear. There is no need to call the "pear" command directly.

The php5-pear port installs an ini and php file to add the pear data dir to php's path. See for yourself:

port contents php5-pear
cat /opt/local/var/db/php5/pear.ini
cat /opt/local/var/db/php5/pear/pear-ini.php
port contents pear-file_iterator

phpinfo() shows:

...
auto_prepend_file	/opt/local/var/db/php54/pear/pear-ini.php
...
include_path	.::/opt/local/lib/php/pear
...

If for some reason you do not have /opt/local/lib/php/pear in php's include_path then you will need to add it or use the full path to the pear class files installed by the pear-* ports.

The php5-unit port is not related to any of the pear-* ports and has these for dependencies:

php5-unit-db, php5-file-iterator, php5-code-coverage, php5-timer, php5-unit-selenium, php5-unit-mock-objects

It looks like these ports may install the same packages as there pear-* counterparts. I don't know anything about these php5-* ports but I do know neither pear-phpunit nor pear-phpunit2 depend on them.

port info pear-phpunit
port info pear-phpunit2

comment:19 Changed 12 years ago by pixilla (Bradley Giesbrecht)

To look at the MacPorts package coverage of multiple pear channels see this, it's pretty complete:

port echo pear-*

comment:20 in reply to:  19 ; Changed 12 years ago by kasperligaard+macports@…

Replying to pixilla@…:

To look at the MacPorts package coverage of multiple pear channels see this, it's pretty complete:

port echo pear-*

True, but the point is that pear-File_Iterator is not there, and PHPUnit must have it (just as Bertrand already stated in comment:12). You can verify this yourself by executing: port echo pear-* |grep -i iterator

comment:21 Changed 12 years ago by ciaran.lyons@…

Cc: ciaran.lyons@… added

Cc Me!

comment:22 in reply to:  20 Changed 12 years ago by petr.snyder@…

Replying to kasperligaard+macports@…:

Replying to pixilla@…:

To look at the MacPorts package coverage of multiple pear channels see this, it's pretty complete:

port echo pear-*

True, but the point is that pear-File_Iterator is not there, and PHPUnit must have it (just as Bertrand already stated in comment:12). You can verify this yourself by executing: port echo pear-* |grep -i iterator



The ports-installscript seems to be incomplete. It's not just the Iterator, that's missing: You may revert to the pear installer. Those commands fixed it here (SnowLeopard):


pear install pear.phpunit.de/File_Iterator

pear install pear.phpunit.de/PHP_CodeCoverage

pear install pear.phpunit.de/PHP_Timer

pear install pear.phpunit.de/PHPUnit_MockObject


( and probably pear channel-discover pear.phpunit.de just at the start of it )

Last edited 12 years ago by petr.snyder@… (previous) (diff)

comment:23 Changed 12 years ago by simon@…

Cc: simon@… added

Cc Me!

comment:24 Changed 12 years ago by simon@…

I've not managed to get this working, even with Petr's suggested "manual" Pear commands… anyone got this working with the standard PHP5 package?

Failing that… any news on when this might be fixed in MacPorts? :)

comment:25 in reply to:  24 Changed 12 years ago by pixilla (Bradley Giesbrecht)

Replying to simon@…:

I've not managed to get this working, even with Petr's suggested "manual" Pear commands… anyone got this working with the standard PHP5 package?

Failing that… any news on when this might be fixed in MacPorts? :)

I have installed EVERY pear-* port on my system many times. Email me sample code that uses PHPUnit and fails on your system and I will test it.

comment:26 Changed 12 years ago by z.aliakseyeu@…

i have such problem and broke my mind out, but i have resolve it. Firstly i have checked

$ which phpunit
/usr/bin/phpunit

then i have uninstall it, because it need to be in /opt/local/bin/phpunit.

$ sudo pear uninstall phpunit/PHPUnit
$ which phpunit

if it still ouputs /usr/bin/phpunit, then execute

$ sudo rm /usr/bin/phpunit

then

$ which pear

if it outputs

/usr/local/bin/pear

or something which not equals

/opt/local/bin/pear

, then it wrong too

$ sudo pear uninstall pear
$ which pear

if its still outputs old path, then, how you may guess

$ sudo rm /usr/local/bin/pear

after that my

which pear

shows

/opt/local/bin/pear

(right path).

If you don't have anything in output for which pear, so you need to install pear via macports.

Then i just have done such actions

$ sudo pear channel-discover pear.phpunit.de
$ sudo pear install pear.phpunit.de/PHPUnit

then add to

/opt/local/etc/php54/php.ini
include_path = ".:/opt/local/lib/php54/pear/:/opt/local/lib/php54/pear/share/pear/"

restarted apache and thats it)

$ phpunit --version
PHPUnit 3.7.8 by Sebastian Bergmann.

PS: sorry for my english and php version is 5.4.7

Last edited 12 years ago by z.aliakseyeu@… (previous) (diff)

comment:27 Changed 11 years ago by macjoost@…

Hi,

Simple test-file that fails for php 5.4, both using mod_php and mod_fcgid, as requested in #comment:25

<?php
include 'PHPUnit' . DIRECTORY_SEPARATOR . 'Autoload.php';

The error is:

Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php/pear/PHPUnit/Autoload.php on line 45

Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.::/opt/local/lib/php/pear') in /opt/local/lib/php/pear/PHPUnit/Autoload.php on line 45

I installed PHPUnit using port install pear-PHPUnit

Later I just installed all pear packages: port install pear-*

I still get the error. On the filesystem I can confirm that in the MacPorts pear directory ( /opt/local/lib/php/pear/ ) there is no File/Iterator directory.

comment:28 Changed 11 years ago by macjoost@…

Cc: macjoost@… added

Cc Me!

comment:29 Changed 11 years ago by sporring@…

Hi,

I just tried to install phpunit via macports and I'm also getting the

Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php/pear/PHPUnit/Autoload.php on line 45

etc. So I guess this is still an issue. On my fairly recent install (hard disk crash in the spring, followed by a recent Maverick update, sigh), I have installed php54, but not apache, and I've fund the problematic Iterator to be placed in /opt/local/lib/php. So my conclusion is that it's not missing, but that the path needs to be set in the right php.ini. I did many things, but I think this is a summary of my solution:

sudo port select php php54
sudo port install php54-unit
sudo ln -s /opt/local/etc/php54/php.ini-development /opt/local/etc/php54/php.ini
sudo emacs /opt/local/etc/php54/php.ini

in the above mentioned file, the include_path was not set, so I added

include_path = ".:/opt/local/lib/php"

at which point, I was able to run phpunit without the mentioned error. I'll test my solution over the holidays.

Best, Jon

Last edited 11 years ago by sporring@… (previous) (diff)

comment:30 Changed 11 years ago by pixilla (Bradley Giesbrecht)

Resolution: wontfix
Status: newclosed

Phpunit's shebang is causing this error:

$ head -n1 /opt/local/lib/php/pear/bin/phpunit
#!/usr/bin/php
$ /opt/local/lib/php/pear/bin/phpunit --version

Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such file or directory in /opt/local/lib/php/pear/PHPUnit/Autoload.php on line 45

Fatal error: require_once(): Failed opening required 'File/Iterator/Autoload.php' (include_path='.:') in /opt/local/lib/php/pear/PHPUnit/Autoload.php on line 45

Call phpunit with your desired php interpreter:

$ /opt/local/bin/php54 /opt/local/lib/php/pear/bin/phpunit --version
PHPUnit 3.6.11 by Sebastian Bergmann.

comment:31 Changed 11 years ago by miken32 (Michael Newton)

You need to install php54-file-iterator as well as php54-timer. Should be a dependency for the pear-phpunit port. And also the problems with the shebang on the phpunit script don't help matters. Even then you still have to run pear install --force phpunit/PHPUnit_MockObject because this port doesn't include all required parts.

Last edited 11 years ago by miken32 (Michael Newton) (previous) (diff)

comment:32 Changed 11 years ago by miken32 (Michael Newton)

Cc: miken32@… added

Cc Me!

Note: See TracTickets for help on using tickets.