php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80805 create simple class and get error in opcache.so
Submitted: 2021-02-26 19:09 UTC Modified: 2021-03-01 14:11 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: alexandr dot budko at gmail dot com Assigned: nikic (profile)
Status: Closed Package: opcache
PHP Version: 7.4.15 OS: Debian 10
Private report: No CVE-ID: None
 [2021-02-26 19:09 UTC] alexandr dot budko at gmail dot com
Description:
------------
If run this script after a few second I get 502 nginx error.

there will be no error if:
 - change type in property <int $foo;> to <?int $foo = null;>
 - clear type in property <int $foo;> to <$foo;>
 - change method inc() to <$result = $this->foo += 2; return $result;>

Info:
------
OS System	Linux devtest 4.19.0-14-amd64 #1 SMP Debian 4.19.171-2 (2021-01-30) x86_64
php-fpm 7.4.15 || php-fpm 7.4.9 || php-fpm 7.4.4
nginx 1.18.0
xdebug disabled. When xdebug enabled (with remote IDE) script works without error.
opcache default settings.

--------
GDB bt
[New LWP 412]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php-fpm: pool www                                                            '.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00007ff739942263 in ?? () from /usr/lib/php/20190902/opcache.so
#1  0x00007ff739952444 in ?? () from /usr/lib/php/20190902/opcache.so
#2  0x00007ff7399589b8 in ?? () from /usr/lib/php/20190902/opcache.so
#3  0x00007ff739958b64 in ?? () from /usr/lib/php/20190902/opcache.so
#4  0x00007ff73993c08a in ?? () from /usr/lib/php/20190902/opcache.so
#5  0x00007ff73992d9bf in ?? () from /usr/lib/php/20190902/opcache.so
#6  0x00007ff7399195f1 in ?? () from /usr/lib/php/20190902/opcache.so
#7  0x0000558a4680089c in zend_execute_scripts ()
#8  0x0000558a4679fc90 in php_execute_script ()
#9  0x0000558a46668a49 in ?? ()
#10 0x00007ff73bcb909b in __libc_start_main (main=0x558a46667bc0, argc=4, argv=0x7ffdd6b35a68, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7ffdd6b35a58) at ../csu/libc-start.c:308
#11 0x0000558a4666985a in _start ()

Test script:
---------------
class Test {
    public int $foo;
    public function __construct()
    {
        $this->foo = 2;
    }
    public function inc(): int
    {
        return $this->foo += 2;
    }
}
$ee = new Test();

Expected result:
----------------
no errors

Actual result:
--------------
502 nginx error

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-02-26 20:01 UTC] requinix@php.net
-Status: Open +Status: Verified -Package: FPM related +Package: opcache
 [2021-03-01 14:11 UTC] nikic@php.net
-Assigned To: +Assigned To: nikic
 [2021-03-01 14:11 UTC] nikic@php.net
This was fixed in PHP-8.0 by https://github.com/php/php-src/commit/8446e2827585c37d0739f8d44fa8d359cbbb6551, needs backport.
 [2021-03-01 14:14 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e8579365181d8e61c00968715ed8be5ec151002d
Log: Fixed bug #80805
 [2021-03-01 14:14 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC