PHPUnit problem

Discuss general development subjects that are not specific to a particular version like the versioning control system we use or other infrastructure.
User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: PHPUnit problem

Post by callumacrae »

Oleg wrote:That really should not happen. phpunit checks for file existence immediately before requiring the file.

You can try:

1. ls -l /Users/callumacrae/pear/share/pear/PHPUnit/Extensions/Database/Operation/Exception.php
Yup, works. Permissions are 644.
Oleg wrote:2. Replace require_once with include_once on line 56. See what php says about that.
New output:
callum-mbp:phpbb3 callumacrae$ phpunit
PHPUnit 3.5.15 by Sebastian Bergmann.

I............................................................ 61 / 1176 ( 5%)
.............................................EEEEEEEEEEEEEEEE 122 / 1176 ( 10%)
EEEEEEEEEEEEEEEEEEEEEE....................................... 183 / 1176 ( 15%)
.............................................EEEEEEEEEEEEEEEE 244 / 1176 ( 20%)
EEEEEEEEEEE
Pretty sure that isn't right.
Oleg wrote:3. Try requiring that file in php code yourself, see what happens.
That works fine.
Oleg wrote:4. Install a different version of phpunit.
How?
Oleg wrote:5. Do you have anything like selinux running?
No
Oleg wrote:6. Copy all pear files into the current directory (/Users/callumacrae/pear/share/pear/ -> .), without preserving permissions.
Will try that if installing a different version doesn't work.


Thanks :-)
Made by developers, for developers!
My blog
User avatar
ledzef
Registered User
Posts: 4
Joined: Fri Nov 11, 2011 1:27 am

Re: PHPUnit problem

Post by ledzef »

it works for me too. It fixes some other errors. Thanks for the tip though. :D
User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: PHPUnit problem

Post by callumacrae »

Bump. Still haven't managed to fix it.

I've reinstalled several times, made sure that everything is readable, confirmed that it is in the include_path.

The error:
callum-imac:phpbb3 callumacrae$ phpunit
PHPUnit 3.6.10 by Sebastian Bergmann.

Configuration read from /Applications/XAMPP/xamppfiles/htdocs/phpbb-github/phpbb3/phpunit.xml.dist

............................................................. 61 / 1036 ( 5%)
.............................PHP Fatal error: phpunit_dbunit_autoload(): Failed opening required '/Users/callumacrae/pear/share/pear/PHPUnit/Extensions/Database/Operation/Exception.php' (include_path='.:/Applications/XAMPP/xamppfiles/lib/php:/Applications/XAMPP/xamppfiles/lib/php/pear:/usr/share/pear:/Users/callumacrae/pear/share/pear') in /Users/callumacrae/pear/share/pear/PHPUnit/Extensions/Database/Autoload.php on line 161
Line 161 is the require statement. Changing it to an include kills it silently. Putting an is_readable statement before the require confirms that it is readable.


I haven't a clue what is wrong, anyone got any ideas?
Made by developers, for developers!
My blog
User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: PHPUnit problem

Post by naderman »

What's the result of running ls -l /Users/callumacrae/pear/share/pear/PHPUnit/Extensions/Database/Operation/Exception.php
User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: PHPUnit problem

Post by callumacrae »

Not at my computer right now, but I own it and it is 644.
Made by developers, for developers!
My blog
User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: PHPUnit problem

Post by naderman »

I was hoping for the actual output.
User avatar
callumacrae
Former Team Member
Posts: 1046
Joined: Tue Apr 27, 2010 9:37 am
Location: England
Contact:

Re: PHPUnit problem

Post by callumacrae »

Forgot to do it when I got back, sorry:
-rw-r--r-- 1 callumacrae staff 4013 6 Apr 20:07 /Users/callumacrae/pear/share/pear/PHPUnit/Extensions/Database/Operation/Exception.php
Made by developers, for developers!
My blog
User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: PHPUnit problem

Post by naderman »

Well try and do what Oleg recommended:
Oleg wrote:6. Copy all pear files into the current directory (/Users/callumacrae/pear/share/pear/ -> .), without preserving permissions.
Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: PHPUnit problem

Post by Oleg »

Replace require $file on line 161 with:

restore_error_handler();
restore_error_handler();
restore_error_handler();
restore_error_handler();
restore_error_handler();
error_reporting(E_ALL);
include($file);

post output here.
User avatar
naderman
Consultant
Posts: 1727
Joined: Sun Jan 11, 2004 2:11 am
Location: Berlin, Germany
Contact:

Re: PHPUnit problem

Post by naderman »

He actually got me access to the machine yesterday. It turns out that if you read any file just there (before the original require), e.g. file_get_contents('/etc/hosts'); PHP will crash. Require seems to avoid that, and returns that error instead, while include also crashes. I recommended he upgrade his PHP, since he was using 5.3.4 which is outdated by several versions.
Post Reply