Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop preventing test runs and dev sites from seeing PHP deprecation notices #19330

Merged
merged 1 commit into from
Jan 7, 2021

Conversation

demeritcowboy
Copy link
Contributor

@demeritcowboy demeritcowboy commented Jan 6, 2021

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.

@civibot
Copy link

civibot bot commented Jan 6, 2021

(Standard links)

@civibot civibot bot added the master label Jan 6, 2021
@eileenmcnaughton
Copy link
Contributor

It should go IMHO - if people don't have rights to set the error level I don't think we need to escalate it

@demeritcowboy demeritcowboy changed the title [WIP] Stop preventing test runs and dev sites from seeing PHP deprecation notices Jan 7, 2021
@demeritcowboy
Copy link
Contributor Author

Have updated description.

if people don't have rights to set the error level

I'm not fully sure what that means. I understand on some hosting you can't edit php.ini or .htaccess, but you can edit e.g. drupal settings.php or civicrm.settings.php to call error_reporting(). It might run after some very early booting, but it will be pretty early on.

@eileenmcnaughton
Copy link
Contributor

OK I'm going to merge this - we are moving towards just expecting people to configure their own servers & not doing random stuff in core - which this aligns with. And it seems like some old weird legacy thing as you say

@eileenmcnaughton eileenmcnaughton merged commit 1d2cb41 into civicrm:master Jan 7, 2021
@demeritcowboy demeritcowboy deleted the why branch January 8, 2021 01:10
@demeritcowboy
Copy link
Contributor Author

Noting this surfaced two more: #19350

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants