Bug #78956 [NEW]: ArrayObject becomes SEGV under certain conditions.

From: Date: Thu, 12 Dec 2019 16:30:25 +0000
Subject: Bug #78956 [NEW]: ArrayObject becomes SEGV under certain conditions.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224254@lists.php.net to get a copy of this message
From:             zeriyoshi at gmail dot com
Operating system: Linux
PHP version:      7.4.0
Package:          SPL related
Bug Type:         Bug
Bug description:ArrayObject becomes SEGV under certain conditions.

Description:
------------
Call property_exists function in offsetExists method, ArrayObject raise
Segmentation fault.

Test script:
---------------
<?php

// OK (Handled with memory-size over.)
// property_exists(
//     new class ([], \ArrayObject::ARRAY_AS_PROPS) extends \ArrayObject
{
//         public function offsetExists($index)
//         {
//             return $this->offsetExists($index);
//         }
//     }, 
//     'foo'
// );

// NG (SEGV)
property_exists(
    new class ([], \ArrayObject::ARRAY_AS_PROPS) extends \ArrayObject {
        public function offsetExists($index)
        {
            return property_exists($this, $index);
        }
    }, 
    'foo'
);

Expected result:
----------------
Fatal error: Allowed memory size of %d bytes exhausted (tried to
allocate %d bytes) in %s on line %d

Actual result:
--------------
Segmentation fault

-- 
Edit bug report at https://bugs.php.net/bug.php?id=78956&edit=1
-- 
Fix committed:                    https://bugs.php.net/fix.php?id=78956&r=fixed
Fixed in release:                 https://bugs.php.net/fix.php?id=78956&r=alreadyfixed
Need backtrace:                   https://bugs.php.net/fix.php?id=78956&r=needtrace
Need Reproduce Script:            https://bugs.php.net/fix.php?id=78956&r=needscript
Try newer version:                https://bugs.php.net/fix.php?id=78956&r=oldversion
Not developer issue:              https://bugs.php.net/fix.php?id=78956&r=support
Expected behavior:                https://bugs.php.net/fix.php?id=78956&r=notwrong
Not enough info:                  https://bugs.php.net/fix.php?id=78956&r=notenoughinfo
Submitted twice:                  https://bugs.php.net/fix.php?id=78956&r=submittedtwice
register_globals:                 https://bugs.php.net/fix.php?id=78956&r=globals
PHP version support discontinued: https://bugs.php.net/fix.php?id=78956&r=phptooold
Daylight Savings:                 https://bugs.php.net/fix.php?id=78956&r=dst
IIS Stability:                    https://bugs.php.net/fix.php?id=78956&r=isapi
Install GNU Sed:                  https://bugs.php.net/fix.php?id=78956&r=gnused
Floating point limitations:       https://bugs.php.net/fix.php?id=78956&r=float
No Zend Extensions:               https://bugs.php.net/fix.php?id=78956&r=nozend
MySQL Configuration Error:        https://bugs.php.net/fix.php?id=78956&r=mysqlcfg


Thread (3 messages)

« previous php.bugs (#224254) next »