? ? Pending

User tests: Successful: Unsuccessful:

avatar echterhoff
echterhoff
28 May 2021

I would prefer to know where a problematic file is located during a failed update.

Pull Request for Issue # .

Summary of Changes

Added a check for JDEBUG and present a full path of the undeletable file to the user in case the system runs in debug mode.

Testing Instructions

Make a core file inaccessible to the web server and run a core refresh or update. In case it can't delete a file, it will raise an error with just the file name or in debug mode with the full path name.

Actual result BEFORE applying this Pull Request

Just a filename without any information where to find that file.

Expected result AFTER applying this Pull Request

A full path to the file...

Documentation Changes Required

avatar echterhoff echterhoff - open - 28 May 2021
avatar echterhoff echterhoff - change - 28 May 2021
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 28 May 2021
Category External Library Libraries Composer Change
avatar richard67
richard67 - comment - 28 May 2021

@HLeithner @nibra Shouldn't this change be made upstream here https://github.com/joomla-framework/filesystem and then a new release of the upstream package should be fetched into the CMS? Or shall the change be made at both places? Or is it ok to make it only here like this PR does?

avatar Quy
Quy - comment - 28 May 2021

@richard67 This should be done upstream and not here.

avatar echterhoff
echterhoff - comment - 28 May 2021

Should I request the pull on the upstream package? If so, its no problem.

I was not sure wheter the use of JDEBUG constant actually belongs to the filesystem sources or not...

avatar PhilETaylor
PhilETaylor - comment - 28 May 2021

passing METHOD as a string in the exception message is simply wrong too - an Exception knows what method threw it, users should never be shown internal tokens like filenames and method names :) We have been removing those from Joomla.

avatar echterhoff
echterhoff - comment - 28 May 2021

@PhilETaylor not sure if I missed something but I changed the message only for the debug mode. Throwing errors at developers that are meaningless is quite pointless. The exception stack in debug mode tells me enought to know which method throwed what from where but in this case actually nothing about the file that is the reason for the exception.

avatar nibra
nibra - comment - 28 May 2021

The Framework is completely unaware of JDEBUG.

avatar echterhoff
echterhoff - comment - 28 May 2021

2021-05-28 20_26_01-Error_ 0 Joomla_Filesystem_File__delete_ Failed deleting inaccessible file webli

avatar PhilETaylor
PhilETaylor - comment - 28 May 2021

@echterhoff Sorry if I confused you, I was making a general point about the whole throwing of exceptions and not specifically about your changes.

The point I was making is that this:

throw new FilesystemException(__METHOD__ . ': Failed deleting inaccessible file ' . $filename);

should be this:

throw new FilesystemException('Failed deleting inaccessible file ' . $filename);

and that the __METHOD__ should never be part of a string message from an exception (and even more importantly, should never then be rendered to the user to tell the user the exception - The internals of code should never be shown to users - when was the last time you got an error page on Amazon.com and they told you that the error was in a method named chargeTheUser20PercentMore() .. you would never see PayPal.com show you their method names or class names... but yet Joomla and Joomla Framework classes do this a lot...

avatar HLeithner
HLeithner - comment - 29 May 2021

and that the __METHOD__ should never be part of a string message from an exception (and even more importantly, should never then be rendered to the user to tell the user the exception - The internals of code should never be shown to users - when was the last time you got an error page on Amazon.com and they told you that the error was in a method named chargeTheUser20PercentMore() .. you would never see PayPal.com show you their method names or class names... but yet Joomla and Joomla Framework classes do this a lot...

ever used a java website ;-)

@echterhoff I think we can change $filename to $file in the framework but this would and in an information disclosure.

What we can do is to extend the FilesystemException adding the relevant information to it (like the full path) and then expose this information in the cms if needed.

I'm closing this pr because it can't be merged but discussion should continue.

avatar HLeithner HLeithner - change - 29 May 2021
Status Pending Closed
Closed_Date 0000-00-00 00:00:00 2021-05-29 08:39:33
Closed_By HLeithner
Labels Added: ? ?
avatar HLeithner HLeithner - close - 29 May 2021

Add a Comment

Login with GitHub to post a comment