PHP7 exception handler needs to accept Throwables

Bug #1575969 reported by Aaron Wells on 2016-04-27
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
High
Aaron Wells
1.10
High
Aaron Wells
15.04
High
Aaron Wells
15.10
High
Aaron Wells
16.04
High
Aaron Wells
16.10
High
Aaron Wells

Bug Description

One of the backwards-incompatible changes in PHP7 is that some errors throw an Error object, which will go to the user-defined exception handler rather than the user-defined error handler. So the exception handler needs to accept Throwable objects (the ancestor to both Error and Exception) instead of just Exception objects.

http://php.net/manual/en/migration70.incompatible.php#migration70.incompatible.error-handling.set-exception-handler

Mahara Bot (dev-mahara) wrote :

Patch for "16.04_STABLE" branch: https://reviews.mahara.org/6439

Reviewed: https://reviews.mahara.org/6439
Committed: https://git.mahara.org/mahara/mahara/commit/d0649c9b7ad386763475b425d6f4b6639f45e156
Submitter: Aaron Wells (<email address hidden>)
Branch: 16.04_STABLE

commit d0649c9b7ad386763475b425d6f4b6639f45e156
Author: Aaron Wells <email address hidden>
Date: Thu Apr 28 11:32:01 2016 +1200

PHP7 changes the type required for exception handler

Bug 1575969. In PHP7 some errors throw an Error object (to
the exception handler) instead of generating an error
(handled by the error handler). The official way to make
an exception handler that will work in PHP 5 & 7, is to
leave off the parameter's type declaration.

Change-Id: I5fc1c3765d5a311eb499d62915e676f8d9ee07a0
behatnotneeded: Covered by existing tests

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6409
Committed: https://git.mahara.org/mahara/mahara/commit/c3d7f4f658409e200ba22a208e770efb3584649e
Submitter: Robert Lyon (<email address hidden>)
Branch: master

commit c3d7f4f658409e200ba22a208e770efb3584649e
Author: Aaron Wells <email address hidden>
Date: Thu Apr 28 11:32:01 2016 +1200

PHP7 changes the type required for exception handler

Bug 1575969. In PHP7 some errors throw an Error object (to
the exception handler) instead of generating an error
(handled by the error handler). The official way to make
an exception handler that will work in PHP 5 & 7, is to
leave off the parameter's type declaration.

Change-Id: I5fc1c3765d5a311eb499d62915e676f8d9ee07a0
behatnotneeded: Covered by existing tests

Mahara Bot (dev-mahara) wrote :

Patch for "15.04_STABLE" branch: https://reviews.mahara.org/6443

Mahara Bot (dev-mahara) wrote :

Patch for "1.10_STABLE" branch: https://reviews.mahara.org/6444

Reviewed: https://reviews.mahara.org/6443
Committed: https://git.mahara.org/mahara/mahara/commit/7f9fe57b920c2937bb0b75d9fe5b8c21e30c619b
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.04_STABLE

commit 7f9fe57b920c2937bb0b75d9fe5b8c21e30c619b
Author: Aaron Wells <email address hidden>
Date: Thu Apr 28 11:32:01 2016 +1200

PHP7 changes the type required for exception handler

Bug 1575969. In PHP7 some errors throw an Error object (to
the exception handler) instead of generating an error
(handled by the error handler). The official way to make
an exception handler that will work in PHP 5 & 7, is to
leave off the parameter's type declaration.

Change-Id: I5fc1c3765d5a311eb499d62915e676f8d9ee07a0
behatnotneeded: Covered by existing tests
(cherry picked from commit c3d7f4f658409e200ba22a208e770efb3584649e)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6444
Committed: https://git.mahara.org/mahara/mahara/commit/ede1f0b96c0120a7d4a7838fbc79798b80bf696f
Submitter: Robert Lyon (<email address hidden>)
Branch: 1.10_STABLE

commit ede1f0b96c0120a7d4a7838fbc79798b80bf696f
Author: Aaron Wells <email address hidden>
Date: Thu Apr 28 11:32:01 2016 +1200

PHP7 changes the type required for exception handler

Bug 1575969. In PHP7 some errors throw an Error object (to
the exception handler) instead of generating an error
(handled by the error handler). The official way to make
an exception handler that will work in PHP 5 & 7, is to
leave off the parameter's type declaration.

Change-Id: I5fc1c3765d5a311eb499d62915e676f8d9ee07a0
behatnotneeded: Covered by existing tests
(cherry picked from commit c3d7f4f658409e200ba22a208e770efb3584649e)

Mahara Bot (dev-mahara) wrote :

Reviewed: https://reviews.mahara.org/6442
Committed: https://git.mahara.org/mahara/mahara/commit/49956eb302a9dab4e50685303d94ceb376654b5b
Submitter: Robert Lyon (<email address hidden>)
Branch: 15.10_STABLE

commit 49956eb302a9dab4e50685303d94ceb376654b5b
Author: Aaron Wells <email address hidden>
Date: Thu Apr 28 11:32:01 2016 +1200

PHP7 changes the type required for exception handler

Bug 1575969. In PHP7 some errors throw an Error object (to
the exception handler) instead of generating an error
(handled by the error handler). The official way to make
an exception handler that will work in PHP 5 & 7, is to
leave off the parameter's type declaration.

Change-Id: I5fc1c3765d5a311eb499d62915e676f8d9ee07a0
behatnotneeded: Covered by existing tests
(cherry picked from commit c3d7f4f658409e200ba22a208e770efb3584649e)

Robert Lyon (robertl-9) on 2016-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