FATAL ERROR on Current Staging Branch Unit Tests

42 views
Skip to first unread message

Donald Gilbert

unread,
Nov 26, 2012, 2:04:47 PM11/26/12
to joomla-de...@googlegroups.com
I downloaded the current staging branch zip just to make sure, but I am getting a fatal error and can't run the test suite. Here's the error:

Fatal error: Cannot redeclare class Color\Rgb\Red in /Users/admin/Downloads/joomla-platform-staging/tests/suites/unit/stubs/Color/rgb/red.php on line 18

Investigating further.

Donald Gilbert

unread,
Nov 26, 2012, 2:42:38 PM11/26/12
to joomla-de...@googlegroups.com
Found the problem. The JLoader namespace feature is broken as is. If a class already exists, it tries to reload it. Adding in the check if the class exists fixes the issue.

Louis Landry

unread,
Nov 26, 2012, 2:53:36 PM11/26/12
to Joomla Platform List
Great stuff Donald.  Makes me wonder what the system differences were to allow that to pass the automated tests on the build server.  Perhaps it is a file collation difference.

Anyway, thanks a bunch.

- Louis

Donald Gilbert

unread,
Nov 26, 2012, 2:59:22 PM11/26/12
to joomla-de...@googlegroups.com
That's what I couldn't figure out. I'll paste my env here, and someone can compare it to the build server test.

PHP - 5.3.15 with Suhosin-Patch
PHPUnit - 3.7.9

Andrew Eddie

unread,
Nov 26, 2012, 4:30:25 PM11/26/12
to JPlatform
Thanks Donald.  I was getting the same problem locally but hadn't had time to hunt it down.  You're a trooper!

Regards,
Andrew Eddie

Regards,
Andrew Eddie
http://learn.theartofjoomla.com - training videos for Joomla developers

Donald Gilbert

unread,
Nov 26, 2012, 4:32:32 PM11/26/12
to joomla-de...@googlegroups.com
Well, I needed to make sure my namespace prep wasn't breaking anything, and when I ran the unit tests, I was like "OH NOOO" so I hunted it down and was relieved to find out I didn't cause the issue. Thanks!
Message has been deleted

Donald Gilbert

unread,
Nov 28, 2012, 1:07:29 PM11/28/12
to joomla-de...@googlegroups.com
Funny, I just read about this today, and it has to do with the namespace autoloader (obviously). It's a problem with the PSR-0 autoloader.

See the "Some Explanation Of Inconsistencies Of PSR-0" section in this blog post from ircmaxwell - http://blog.ircmaxell.com/2011/11/on-psr-0-being-included-in-phps-core.html 
Message has been deleted

Donald Gilbert

unread,
Nov 28, 2012, 1:20:35 PM11/28/12
to joomla-de...@googlegroups.com
If you read the section on "Case Sensitivity", he goes over the same example that you gave of ordering of case sensitive class names. I realize we don't have the require error like they do, but we have the same redeclaring error.


On Wed, Nov 28, 2012 at 12:15 PM, Florian Voutzinos <voutzino...@gmail.com> wrote:
Thanks. In their case it causes a fatal error because the PSR0 loader uses "require".

But in our case, we use include_once.

I found out this issue when testing a bit : it is either a php bug with include_once and case sensitivity or it is the default behaviour, but it should be specified in the manual.

The manual says "With PHP 4, _once functionality differs with case-insensitive operating systems (like Windows)"

"This behaviour changed in PHP 5, so for example with Windows the path is normalized first so that C:\PROGRA~1\A.php is realized the same as C:\Program Files\a.php and the file is included just once."

which is right only if you include the lower case first...but if you include the camel case first it is not included once.

Regards,
Reply all
Reply to author
Forward
0 new messages