-
Notifications
You must be signed in to change notification settings - Fork 20
Description
Since PSR-0 explicitly mandates that underscores in file names must be translated into directory separators to locate the file the following files will throw an exception:
- src/MaxCDN/OAuth/OAuthSignatureMethod_PLAINTEXT.php
- src/MaxCDN/OAuth/OAuthSignatureMethod_HMAC_SHA1.php
- src/MaxCDN/OAuth/OAuthSignatureMethod_RSA_SHA1.php
unless the "composer dumpautoload --optimize" was executed either directly or via the install/update commands (with the "--optimize-autoloader" option).
[Wed Jul 08 15:12:34.182097 2015] [:error] [pid 1324] [client 192.168.122.1:41655] PHP Fatal error: Class 'MaxCDN\OAuth\OAuthSignatureMethod_HMAC_SHA1' not found in /var/www/site/releases/20150708154715/vendor/maxcdn/php-maxcdn/src/MaxCDN.php on line 44, referer: https://site.localhost/.....
[Wed Jul 08 15:12:34.182146 2015] [:error] [pid 1324] [client 192.168.122.1:41655] PHP Stack trace:, referer: https://site.localhost/.....
...........
[Wed Jul 08 15:12:34.182268 2015] [:error] [pid 1324] [client 192.168.122.1:41655] PHP 11. MaxCDN->delete(....)
[Wed Jul 08 15:12:34.182279 2015] [:error] [pid 1324] [client 192.168.122.1:41655] PHP 12. MaxCDN->execute(...)
There are two possible solutions:
- move the files in subdirectories according to PSR-0, e.g. src/MaxCDN/OAuth/OAuthSignatureMethod_HMAC_SHA1.php shold be moved to src/MaxCDN/OAuth/OAuthSignatureMethod/HMAC/SHA1.php
- update the composer to use classmap to include those files
The project's readme currently states that
It is advised that you understand how to optimze Composer's usage in Production environments.
But this could prove to be ill advice as what the --optimize-autoloader option actually does is to scan all included files and dump a classmap for you. This could be an optimization if the project has a sane amount of dependencies/classes, but on legacy projects with tons of seldom used files this has the potential to produce monstrous classmap file (in my case ~600kB :) ) and become anti-optimisation.