[PHP-BUG] Bug #78337 [NEW]: Typed properties references inconsistency due to gc
[email protected] ("jascha dot php at ja-s dot de") Sat, 27 Jul 2019 12:52:48 +0000
| Newsgroups | php.standards |
|---|---|
| Message-ID | <[email protected]> |
From: jascha dot php at ja-s dot de Operating system: PHP version: 7.4.0beta1 Package: PHP Language Specification Bug Type: Bug Bug description:Typed properties references inconsistency due to gc Description: ------------ I've just looked into PHP 7.4s property typing. I'm a little disappointed, that this is currently limited to properties, and can not be applied to any variables. Luckily v2 supports references to properties. So I'm pretty sure somebody is gonna provide a little library to construct typed variables by linkin a variable to the reference set of a typed property. But what isn't mentioned in the typed_properties_v2 RFC, is how the garbage collector affects the typing due to reducing the reference set. This can produce unexpected behavior. Possible solutions: * Forbid references: https://wiki.php.net/rfc/typed_properties_v2#forbid_references * Add typed variables (seems unlikely, but i'm hoping for this) * Just document the behavior Test script: --------------- https://3v4l.org/ctEgn Expected result: ---------------- string(3) "123" string(3) "123" Actual result: -------------- int(123) string(3) "123" -- Edit bug report at https://bugs.php.net/bug.php?id=78337&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=78337&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=78337&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=78337&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=78337&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=78337&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=78337&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=78337&r=needscript Try newer version: https://bugs.php.net/fix.php?id=78337&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=78337&r=support Expected behavior: https://bugs.php.net/fix.php?id=78337&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=78337&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=78337&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=78337&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=78337&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=78337&r=dst IIS Stability: https://bugs.php.net/fix.php?id=78337&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=78337&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=78337&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=78337&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=78337&r=mysqlcfg