Squelch PHP 5.4+ strict standards errors

Bug #1268746 reported by Aaron Wells on 2014-01-13
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Aaron Wells
1.10
Medium
Aaron Wells
1.7
Medium
Aaron Wells
1.8
Medium
Aaron Wells
1.9
Medium
Aaron Wells

Bug Description

Mahara sets its error reporting to E_ALL (in error.php). Prior to PHP 5.4, E_ALL, despite the name, did not include E_STRICT. Starting with PHP 5.4, it does include E_STRICT.

Since Mahara has been running all this time with E_STRICT messages silenced, there are a lot of E_STRICT violations in the codebase, and on PHP 5.4+ servers, the logs are so full of them as to be useless.

In the long term we should fix all the E_STRICT warnings, but for the short term we should just silence them.

Aaron Wells (u-aaronw) wrote :

In the longer term we should fix the E_STRICT warnings instead of just silencing them. I've open a separate bug for that: https://bugs.launchpad.net/mahara/+bug/1268790

Reviewed: https://reviews.mahara.org/2904
Committed: http://gitorious.org/mahara/mahara/commit/8d17e0710ed53001be9b74013784c1f7e5806b58
Submitter: Aaron Wells (<email address hidden>)
Branch: master

commit 8d17e0710ed53001be9b74013784c1f7e5806b58
Author: Aaron Wells <email address hidden>
Date: Tue Jan 14 12:35:48 2014 +1300

Silence most E_STRICT errors

Bug 1268746: In PHP 5.4 E_ALL changed to include E_STRICT, causing Mahara to throw
a lot of strict standards errors. This should silence most of them.

HOWEVER, because most strict standards happen at compile-time, this will have no
effect on strict standards errors caused in the files that have already been
loaded by the time we call error_reporting() and set_error_handler(), which includes:
- The file invoked directly by the URL
- init.php
- errors.php
- config.php
- config-defaults.php

Change-Id: I7a7fdf7facb1f30e186a0e8a27f1c3b7473200da

Aaron Wells (u-aaronw) wrote :

Should we backport this fix for the stable releases?

Changed in mahara:
status: In Progress → Fix Committed
Robert Lyon (robertl-9) on 2014-04-22
Changed in mahara:
status: Fix Committed → Fix Released
Aaron Wells (u-aaronw) wrote :

We've begun noticing this in some of the sites we host, so I think it is a good idea to backport it.

Reviewed: https://reviews.mahara.org/3475
Committed: http://gitorious.org/mahara/mahara/commit/48f3827ed7635cebe5594739da2e033d82596103
Submitter: Aaron Wells (<email address hidden>)
Branch: 1.8_STABLE

commit 48f3827ed7635cebe5594739da2e033d82596103
Author: Aaron Wells <email address hidden>
Date: Tue Jan 14 12:35:48 2014 +1300

Silence most E_STRICT errors

Bug 1268746: In PHP 5.4 E_ALL changed to include E_STRICT, causing Mahara to throw
a lot of strict standards errors. This should silence most of them.

HOWEVER, because most strict standards happen at compile-time, this will have no
effect on strict standards errors caused in the files that have already been
loaded by the time we call error_reporting() and set_error_handler(), which includes:
- The file invoked directly by the URL
- init.php
- errors.php
- config.php
- config-defaults.php

Change-Id: I7a7fdf7facb1f30e186a0e8a27f1c3b7473200da

Reviewed: https://reviews.mahara.org/3476
Committed: http://gitorious.org/mahara/mahara/commit/c418557b689858a97834fcbf322b59c5dbb9a411
Submitter: Aaron Wells (<email address hidden>)
Branch: 1.7_STABLE

commit c418557b689858a97834fcbf322b59c5dbb9a411
Author: Aaron Wells <email address hidden>
Date: Tue Jan 14 12:35:48 2014 +1300

Silence most E_STRICT errors

Bug 1268746: In PHP 5.4 E_ALL changed to include E_STRICT, causing Mahara to throw
a lot of strict standards errors. This should silence most of them.

HOWEVER, because most strict standards happen at compile-time, this will have no
effect on strict standards errors caused in the files that have already been
loaded by the time we call error_reporting() and set_error_handler(), which includes:
- The file invoked directly by the URL
- init.php
- errors.php
- config.php
- config-defaults.php

Change-Id: I7a7fdf7facb1f30e186a0e8a27f1c3b7473200da

Reviewed: https://reviews.mahara.org/3477
Committed: http://gitorious.org/mahara/mahara/commit/f38e3895883d67b3ec587611a4d07cc87ee1264c
Submitter: Ghada El-Zoghbi (<email address hidden>)
Branch: master

commit f38e3895883d67b3ec587611a4d07cc87ee1264c
Author: Aaron Wells <email address hidden>
Date: Fri Jul 4 12:19:04 2014 +1200

Fix E_STRICT "Only variables should be assigned by reference"

Bug 1268746

Change-Id: I438629b7bb03590b4f5875c07381f500569c80d1

It needs to be checked if there is also a patch for 1.9.

Mahara Bot (dev-mahara) wrote :

Patch for "1.7_STABLE" branch: https://reviews.mahara.org/3740

Mahara Bot (dev-mahara) wrote :

Patch for "1.8_STABLE" branch: https://reviews.mahara.org/3742

Robert Lyon (robertl-9) wrote :

The patch 2904 was already a part of the 1.9 branch but the patch 3475 was not.

I've added patch 3475 to the 1.9, 1.8, 1.7 branches

Reviewed: https://reviews.mahara.org/3739
Committed: http://gitorious.org/mahara/mahara/commit/ed7e07e0ee54b70f1e91d7c17bff7bfa3363cff5
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.9_STABLE

commit ed7e07e0ee54b70f1e91d7c17bff7bfa3363cff5
Author: Aaron Wells <email address hidden>
Date: Fri Jul 4 12:19:04 2014 +1200

Fix E_STRICT "Only variables should be assigned by reference"

Bug 1268746

Change-Id: I438629b7bb03590b4f5875c07381f500569c80d1

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3742
Committed: http://gitorious.org/mahara/mahara/commit/b1a1e4e8f253dda39183b680c559928c7beff597
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.8_STABLE

commit b1a1e4e8f253dda39183b680c559928c7beff597
Author: Aaron Wells <email address hidden>
Date: Fri Jul 4 12:19:04 2014 +1200

Fix E_STRICT "Only variables should be assigned by reference"

Bug 1268746

Change-Id: I438629b7bb03590b4f5875c07381f500569c80d1

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/3740
Committed: http://gitorious.org/mahara/mahara/commit/1f12435cbe86d547b54ea90a671d9b2ed62be15c
Submitter: Son Nguyen (<email address hidden>)
Branch: 1.7_STABLE

commit 1f12435cbe86d547b54ea90a671d9b2ed62be15c
Author: Aaron Wells <email address hidden>
Date: Fri Jul 4 12:19:04 2014 +1200

Fix E_STRICT "Only variables should be assigned by reference"

Bug 1268746

Change-Id: I438629b7bb03590b4f5875c07381f500569c80d1

Aaron Wells (u-aaronw) on 2014-10-21
Changed in mahara:
milestone: 1.10.0 → none
Aaron Wells (u-aaronw) on 2014-10-21
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers