DirectoryIterator::__construct(...): failed to open dir: No such file or direct

Started by stAn99, June 01, 2016, 12:36:08 PM

Previous topic - Next topic

stAn99

DirectoryIterator::__construct(/web/vm2/mero//test/images/availability/): failed to open dir: No such file or directory

if the directory set up in VM's "General Assets URL" is wrong, it's not possible to visit the Virtuemart configuration backend on joomla 3.5.1 (and possibly other 3.x versions) because JHtml::_('list.images', 'image'.... returns non-recoverable user error if the path does not exists.

To fix this you may need to wrap this code into a try and catch clause:

\administrator\components\com_virtuemart\views\config\tmpl\default_shopfront.php

original code:

echo JHtml::_('list.images', 'image', VmConfig::get('rised_availability'), " ", $this->imagePath);


suggested code:

try
{
echo JHtml::_('list.images', 'image', VmConfig::get('rised_availability'), " ", $this->imagePath);
}
catch (Exception $e)
{
echo '';
}


best regards, stan
----
RuposTel.com
www.rupostel.com
Your customized checkout solution for Virtuemart

Milbo

My current solution, directly in the layout


<?php if(!empty($this->imagePath)) {
echo JHtml::_('list.images''image'VmConfig::get('rised_availability'), " "$this->imagePath);
} else {
echo vmText::_('COM_VIRTUEMART_ADMIN_CFG_ASSETS_GENERAL_PATH_MISSING');
}
?>


Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

Studio 42

Bug is real, but I tested DirectoryIterator in a search file (with many images), this is 2 to 3 time slower as:
opendir($path)))
      while (($file = readdir ....
So perhaps changing code is better as fix it ?

Milbo

We can do that later, when we use the VMF, but atm it is a joomla function as far as I understood.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/