Bug #78476 [Ver]: Segfault when running Monolog test suite on 7.4snapshot

From: Date: Thu, 12 Sep 2019 10:08:49 +0000
Subject: Bug #78476 [Ver]: Segfault when running Monolog test suite on 7.4snapshot
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222701@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78476&edit=1

 ID:                 78476
 Updated by:         nikic@php.net
 Reported by:        seld@php.net
 Summary:            Segfault when running Monolog test suite on
                     7.4snapshot
 Status:             Verified
 Type:               Bug
 Package:            Reproducible crash
 Operating System:   Linux
 PHP Version:        7.4Git-2019-08-30 (snap)
 Block user comment: N
 Private report:     N

 New Comment:

@seld: If I patch https://github.com/Seldaek/monolog/blob/a053af62ad5bfb0355dfb55d3d15126f1c836708/src/Monolog/Handler/ElasticsearchHandler.php#L148
to throw an exception if $responses is null, then I do get that exception. So the notice should also
be thrown -- there's probably still an error handler around that suppresses it.

That said, I get the null value there both with and without opcache, so I'm not sure what the
role of opcache was here originally...


Previous Comments:
------------------------------------------------------------------------
[2019-09-05 13:29:36] seld@php.net

Ok thanks for the find. I fixed it in https://github.com/Seldaek/monolog/commit/0f39561898a66334fe5f2a6768eb8043d2f34cd5
which fixes the build. 

It seems to pass without notice either so I am not sure how this is possible. If opcache caused the
notice which then crashed with the segfault the notice should still be there. If opcache had only an
issue with the error handler then it should show a notice now?

------------------------------------------------------------------------
[2019-09-02 08:10:51] nikic@php.net

@seld: The problematic error handler is set up here: https://github.com/Seldaek/monolog/blob/21b1705c3e6a6312687a275870e3e539af0a3896/tests/Monolog/ErrorHandlerTest.php#L40-L42

So while there is presumably also an opcache bug here that causes the notice in the first place,
this code should probably also be fixed to make sure that any notice thrown in the testsuite does
not automatically turn into a stack overflow segfault.

------------------------------------------------------------------------
[2019-09-02 07:57:29] nikic@php.net

Heh, this is a stack overflow caused by infinite recursion in the error handler for a "Trying
to access array offset on value of type null" notice.

The original notice is triggered in https://github.com/Seldaek/monolog/blob/21b1705c3e6a6312687a275870e3e539af0a3896/src/Monolog/Handler/ElasticsearchHandler.php#L150
and the infinite recursion occurs in https://github.com/Seldaek/monolog/blob/21b1705c3e6a6312687a275870e3e539af0a3896/src/Monolog/ErrorHandler.php#L201.

Not sure where the opcache-specific bit in this is.

------------------------------------------------------------------------
[2019-09-01 13:28:23] nikic@php.net

Can reproduce with opcache ... didn't know that's enabled on Travis.

------------------------------------------------------------------------
[2019-08-30 13:57:59] nikic@php.net

Can't reproduce with current 7.4 HEAD.

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=78476


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


Thread (8 messages)

« previous php.bugs (#222701) next »