example code:
JHtml::_('list.images', 'image', ....
for a non-existent image path.
PROBLEM: instead of giving a warning or an empty reply, joomla 3.5.1 provides a non-recoverable user error 500.
non-logged error 500 without a backtrace even when system-debug and global debug config is enabled.
possible solution:
\libraries\cms\html\list.php
inside the images function:
if (!file_exists(JPATH_SITE . '/' . $directory)) { return ''; }
php5.5 + mysql 5.7 + joomla 3.5.1
since this is a rendering function i do not think that error 500 is an expected result. i would suggest to return either empty html, or at least provide more information about the error (log in into php error log)
hello, yes, it's possible to fix in the 3rd party code as well with try/catch or with checking the path, but the real problem is that there is no information from joomla about what and why it actually happened
the problem here is that the function gives:
a non-recoverable error (error 500 / blank screen)
Actually no. As the method is only throwing Exceptions the error is recoverable as long as those are being caught, which at the highest level should trigger Joomla's error page (based on the PHP docs for all supported versions it will unless the constructor is throwing an undocumented error).
does not provide any debugging information on why and from where this had came at the screen OR at the php error log
As long as it's throwing Exceptions, you should get Joomla's error page, which in debug mode (as long as the template supports it, the core templates do) will give you a backtrace; otherwise the error page just spits out the Exception message. If you're getting anything else, then this error case isn't the culprit for your error condition/white screen (if it's a white screen then turn on error reporting). Also, Joomla doesn't have any place where it is instructed to write to PHP's logs so that is reliant on your PHP runtime configuration.
I'm not saying it shouldn't be patched somehow in core, but the severity of this error case isn't as fatal as it seems. The constructor from DirectoryIterator is throwing an Exception that goes uncaught up the entire trace, something that's easy to deal with.
well, i was at the backend, but i did not receive the joomla's default error page - maybe a combination of other problems, but for such exceptions i haven't seen the error page in the backend for quite time now.
Status | New | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2016-08-03 16:16:28 |
Closed_By | ⇒ | brianteeman |
Closed as nothing for core to do here based on the comments above
DirectoryIterator::__construct()
throws either aRuntimeException
orUnexpectedValueException
(see http://php.net/manual/en/directoryiterator.construct.php), so you can catch those in your code calling the JHtml method as a short term solution.As for just returning an empty string, this IMO is a no-go as it silently discards the error and the CMS in general already has too many places where there is either no error handling at all or errors are caught and silently discarded.