We help IT Professionals succeed at work.

PHP Underscores vs. Directory separators

Silas2
Silas2 asked
on
130 Views
Last Modified: 2017-04-13
Forgive my ignorance on this, but when I run composer to install magium examples, i notice many of the class names have underscores, e.g. PHPUnit_Framework_Test, but when I look in the autoload_static.php i see :
        'PHPUnit\\Framework\\Test' => __DIR__ . '/..' . '/phpunit/phpunit/src/Framework/Test.php',

Open in new window

and the files are not loading properly. Is this some setting I haven't set?
Comment
Watch Question

Most Valuable Expert 2011
Author of the Year 2014

Commented:
There must be a little more to the code, right?  By itself, that looks like a parse error.

I think the backslashes\\ are related to PHP namespaces.  The underscores__ are part of the magic constant's name.  Underscores are legit characters in PHP variable and constant names.
http://php.net/manual/en/language.constants.predefined.php

Author

Commented:
Thanks Ray, I just did a hack on the classloader.php to find the files, and now I'm getting a brick wall on
" implements \PHPUnit_Framework_TestListener"
Its not using the classloader.php to look for it....

Author

Commented:
Generally speaking, I've downloaded a test project with loads of dependencies, and I see some pointing to AppData\Local\Temp\$Metadata$\B49847A5$phpunit-4.5.phar/PHPUnit_Framework_TestCase.php (which i didn't knowingly download) and I see references broken there....I'm sure this the php version of 'DLL Hell', I was hoping the composer would take care of this stuff..

Author

Commented:
Whats' the best way out of this ?
Most Valuable Expert 2011
Author of the Year 2014
Commented:
This problem has been solved!
(Unlock this solution with a 7-day Free Trial)
UNLOCK SOLUTION

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions