Bug #77339 [NEW]: __callStatic may get incorrect arguments

From: Date: Sun, 23 Dec 2018 02:02:53 +0000
Subject: Bug #77339 [NEW]: __callStatic may get incorrect arguments
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218575@lists.php.net to get a copy of this message
From: php at zsxsoft dot com Operating system: macOS 10.14.2 PHP version: 7.3.0 Package: Class/Object related Bug Type: Bug Bug description:__callStatic may get incorrect arguments Description: ------------ This only happened in PHP 7.3. Test script followed. $arguments should be ['getSomeWhat'], but __callStatic get [?] here. I checked *myht->arData, $arguments[0] got a wrong type. The normal one, you can see type = 0x6: (_zval_struct::(anonymous union)) u1 = { (_zval_struct::(anonymous struct)) v = { (zend_uchar) type = '\x06' (zend_uchar) type_flags = '\x01' (_zval_struct::(anonymous union)) u = { (uint16_t) call_info = 0 (uint16_t) extra = 0 } } (uint32_t) type_info = 262 } (lldb) fr v --show-types *myht->arData->val.value.str (zend_string) *myht->arData->val.value.str = { (zend_refcounted_h) gc = { (uint32_t) refcount = 1 (_zend_refcounted_h::(anonymous union)) u = { (uint32_t) type_info = 6 } } (zend_ulong) h = 0 (size_t) len = 6 (char [1]) val = "aaazzz" } The __callStatic's argument, you can see data is normal but type is not initialized. (_zval_struct::(anonymous union)) u1 = { (_zval_struct::(anonymous struct)) v = { (zend_uchar) type = '\0' (zend_uchar) type_flags = '\0' (_zval_struct::(anonymous union)) u = { (uint16_t) call_info = 0 (uint16_t) extra = 0 } } (uint32_t) type_info = 0 } (_zval_struct::(anonymous union)) u2 = { (uint32_t) next = 4294967295 (uint32_t) cache_slot = 4294967295 (uint32_t) opline_num = 4294967295 (uint32_t) lineno = 4294967295 (uint32_t) num_args = 4294967295 (uint32_t) fe_pos = 4294967295 (uint32_t) fe_iter_idx = 4294967295 (uint32_t) access_flags = 4294967295 (uint32_t) property_guard = 4294967295 (uint32_t) constant_flags = 4294967295 (uint32_t) extra = 4294967295 } Test script: --------------- <?php class Foo { static function __callStatic($name, $arguments) { if ($name === 'get') { if (!isset($arguments[0])) { var_dump(['getSomeWhat']); var_dump($arguments); exit; } } echo 'OK'; } protected function get ($key) { // BUG!!! } } class Bar { static function __callStatic($name, $arguments) { echo Foo::get('getSomeWhat'); } } Bar::someUndefinedStaticFunction(); Expected result: ---------------- OK Actual result: -------------- array(1) { [0]=> string(11) "getSomeWhat" } array(1) { } -- Edit bug report at https://bugs.php.net/bug.php?id=77339&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77339&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77339&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77339&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77339&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77339&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77339&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77339&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77339&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77339&r=support Expected behavior: https://bugs.php.net/fix.php?id=77339&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77339&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77339&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77339&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77339&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77339&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77339&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77339&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77339&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77339&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77339&r=mysqlcfg

« previous php.bugs (#218575) next »