dev/core#2730 - Replace fopen call in CRM_Utils_File::isIncludable with one that doesn't need error-supression to avoid problems in php8 #21060
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
https://lab.civicrm.org/dev/core/-/issues/2730
Before
One (extreme) way to see the before situation is #21064. Lots of stuff like:
Failure in api call for UFGroup create: fopen(api/v3/UFGroup/Getfields.php): failed to open stream: No such file or directory'
While this is an E_WARNING and doesn't change anything in normal usage in php 8, what does change in php 8 is when you have an error handler that takes the incoming
$errno
and acts when it has a value of E_WARNING. In php 7, errno is always set to 0 when the error_supression (@
) operator is used. In php 8 it passes the actual value in.(There are other changes, like it also changes the value of error_reporting(), but that doesn't apply to this specifically).
After
Quiet
Technical Details
This should be an equivalent call but at the time the function was written it's possible not all sites had a high enough php version. There's more in the lab ticket if interested.
Comments
Has test, which passed before on the current code so is at least a partial check that there's some equivalence: https://test.civicrm.org/job/CiviCRM-Core-PR/42883/