User tests: Successful: Unsuccessful:
This is one of several PRs to separate out the fixes from #38471. The track_errors
feature was removed in PHP 7.2 and this code isn't working anyway in this method.
Codereview
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
Status | New | ⇒ | Pending |
Category | ⇒ | Libraries |
Yes, you are right, it isn't removed in 7.2. I didn't introduce error_get_last() here, because we aren't handling the $php_errormsg right now anyway. It is simply a bunch of dead code.
Just because we aren't handling errors properly doesn't mean we should just remove the error handling
Labels |
Added:
PR-4.3-dev
|
But there is no error handling and I don't see how we could or would want to include error handling at this point. parse_ini_file()
and parse_ini_string()
both don't throw any exceptions and only either return an array or false on error. We've so far also swallowed up all errors in this case. We added an @ in front of both parsing calls, which would suppress any errors anyway, then even when it returns a false value, it silently is swallowed up by returning an empty array. All this means that even if we wanted, we couldn't change the behavior of the method at this point. And I honestly don't think we should log an error in a language file to a log file by default.
@Hackwar @wilsonge
Suggestion for 4.4,
$php_errormsg
codeerror_get_last()
if $strings
While checking the source code I found out that most of the functions calling the parseFile
are unable to handle a return value of false
some of them directly access it as array
and at least one call give the return value directly to a function which has the parameter typed as array which would lead to an exception...
is this ok for you george if you can you rework this pr hannes and rebase it for 4.4 and create a new pr for 5.0 which adds the exception? and of course don't forget the documentation pr.
thanks
I'm happy with that
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-04-18 12:06:32 |
Closed_By | ⇒ | Hackwar | |
Labels |
Added:
?
?
|
Status | Closed | ⇒ | New |
Closed_Date | 2023-04-18 12:06:32 | ⇒ | |
Closed_By | Hackwar | ⇒ |
Status | New | ⇒ | Pending |
Title |
|
Labels |
Added:
Feature
PR-5.0-dev
Removed: ? PR-4.3-dev |
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2023-09-25 14:09:58 |
Closed_By | ⇒ | Quy | |
Labels |
Added:
PHP 8.x
|
track errors was deprecated in 7.2 and removed in 8. so that's not actually true (https://www.php.net/manual/en/errorfunc.configuration.php#ini.track-errors)
There is a recommended alternative - https://www.php.net/manual/en/migration72.deprecated.php#migration72.deprecated.track_errors-and-php_errormsg using error_get_last. Which is also something we use in the framework package - https://github.com/joomla-framework/language/blob/2.0-dev/src/Parser/IniParser.php#L126-L132 - so is there a reason not to implement it?