Stop preventing test runs and dev sites from seeing PHP deprecation notices #19330
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
PHP deprecations are hidden sometimes because of these lines. It seems to come from https://issues.civicrm.org/jira/browse/CRM-6327, which says "CiviCRM should automatically set E_DEPRECATED when running under PHP 5.3. Set this mode automatically to minimize support issues." In fairness, and I think I'm remembering now, it was a new constant, and by default live sites were including these notices if they had inherited the php 5.2 error_reporting settings, because the default was something like
E_ALL & ~E_STRICT
. These lines may have even been lifted verbatim from drupal 6.You can reproduce the problem by using e.g. php 7.4 and setting your error_reporting to E_ALL and doing
cv ev "$s = 'foo'; echo $s{0};"
. Before the patch you get no notice. After the patch you get the deprecation notice as you should.Before
Even dev sites or test runs don't see deprecation notices sometimes, regardless of what you've set for error_reporting.
After
Notices appear depending on your error_reporting settings.