silverstripe-external-content
silverstripe-external-content copied to clipboard
Cannot run tests when external-content is installed: Zend_Loader
Whenever I try and run Behat tests or unit-tests with the external-content module installed, I get the following error which means I need to comment the class it to get them running:
PHP Fatal error: Cannot redeclare class Zend_Loader in /path/to/htdocs/external-content/thirdparty/Zend/Loader.php on line 31.
Framework includes its own version of Zend_Loader
and it's newer, so can the module just swap the location of the required thirdparty/Zend
directory for the one in Framework? A change to _config.php would be all that's required right?
It should be okay to do that now yes.
I just tested that and it doesn't work since the zend_http is not included in the framework.
One solution would be to include necessary zend libraries via composer:
"repositories": [
{
"type": "composer",
"url": "https://packages.zendframework.com/"
}
],
"require": {
"silverstripe/framework": ">=3.0.0",
"zendframework/zend-uri": "2.0.*",
"zendframework/zend-http": "2.0.*",
"zendframework/zend-validator": "2.0.*"
}
However the current included zend libraries was last updated around " @version $Id: Exception.php 9656 2008-06-10 16:21:13Z dasprid $"
So I don't believe that this will just slot in there nicely... It smells like a rewrite.
The immediate issue has been fixed for now with ff11b83ad3d7c3c2b4445c9b65a01e3d6d337c33 (same approach as Michael's commit mentioned above). Should we leave this ticket open for discussing a rewrite approach, or is that too unlikely to happen?
Leave open for now, I recently swapped something else over to the zend packagist repos so will replicat that config here