Bug #81571 [Fbk->Nab]: Deprecation error leads to Fatal error?

From: Date: Tue, 02 Nov 2021 14:07:49 +0000
Subject: Bug #81571 [Fbk->Nab]: Deprecation error leads to Fatal error?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-237512@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81571&edit=1

 ID:                 81571
 Updated by:         cmb@php.net
 Reported by:        ondrej at mirtes dot cz
 Summary:            Deprecation error leads to Fatal error?
-Status:             Feedback
+Status:             Not a bug
 Type:               Bug
 Package:            *General Issues
 Operating System:   N/A
 PHP Version:        8.1.0RC5
 Assigned To:        cmb
 Block user comment: N
 Private report:     N

 New Comment:

Oh, I missed Nikita's comment.  So closing as not a bug.


Previous Comments:
------------------------------------------------------------------------
[2021-11-02 13:54:39] cmb@php.net

> What confuses me is the "During inheritance" part of the message
> which isn't present in the original PHP deprecation error.

Ah, right, that is caused by PHP whenever an error handler throws
an exception[1].  This is basically <https://3v4l.org/6sbhF>.

[1] <https://github.com/php/php-src/blob/ddaf64b56c88f0ae223b1aca25293dd7fec77fc0/Zend/zend_inheritance.c#L1002-L1005>

------------------------------------------------------------------------
[2021-11-02 13:51:45] nikic@php.net

This happens when a broken error handler converts a deprecation notice into an exception. Exceptions
during inheritance are not supported and converted into fatal errors.

------------------------------------------------------------------------
[2021-11-02 13:31:28] ondrej at mirtes dot cz

What confuses me is the "During inheritance" part of the message which isn't present
in the original PHP deprecation error. Do you think that's coming from PHPUnit? I don't
see that string when searching my vendor directory.

------------------------------------------------------------------------
[2021-11-02 11:08:57] cmb@php.net

This looks like a PHPUnit error handler issue.  That deprecation
notice is the first one that is reported[1].  Or am I missing
something?

[1] <https://github.com/phpstan/phpstan-src/runs/4055035108?check_suite_focus=true#step:6:7>

------------------------------------------------------------------------
[2021-10-30 12:35:31] ondrej at mirtes dot cz

Description:
------------
In my CI build I get this problem:

PHP Fatal error:  During inheritance of ArrayAccess: Uncaught Return type of
Hoa\Protocol\Node\Node::offsetExists($  
  name) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the
#[\ReturnTypeWillChan  
  ge] attribute should be used to temporarily suppress the notice    

So deprecation error somehow gets converted to a fatal error?

Also note that this isn't an issue of an error handler because other deprecation errors are
printed without crashing PHP before that too.

Here's the CI pipeline in question: https://github.com/phpstan/phpstan-src/runs/4055035108?check_suite_focus=true



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81571&edit=1


Thread (6 messages)

« previous php.bugs (#237512) next »