Doc #77476 [NEW]: empty should be in the list of changed functions

From: Date: Thu, 17 Jan 2019 07:47:55 +0000
Subject: Doc #77476 [NEW]: empty should be in the list of changed functions
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16336@lists.php.net to get a copy of this message
From: php at sandstrom dot im Operating system: PHP version: Irrelevant Package: Documentation problem Bug Type: Documentation Problem Bug description:empty should be in the list of changed functions Description: ------------ --- From manual page: https://php.net/migration70.changed-functions --- Usage of the empty function in combination with magic methods that in PHP 5.6 returns false will return true in PHP 7. The cause is most likely the introduction of the null coalescing operator which causes the empty function to bail early. When running the test script on PHP 5.6 it will output Foo::__get(foo) Foo::__isset(bar) Foo::__get(bar) is not empty and when running on PHP 7 the output will be Foo::__isset(foo) is empty Test script: --------------- <?php class Foo { public function __get($name) { echo __METHOD__ . "($name)" . PHP_EOL; switch ($name) { case 'foo': return new Foo(); case 'bar': return 'bar'; default: return null; } } public function __isset($name) { echo __METHOD__ . "($name)" . PHP_EOL; return $name === 'bar'; } } $foo = new Foo(); echo (empty($foo->foo->bar) ? 'is empty' : 'is not empty') . PHP_EOL; -- Edit bug report at https://bugs.php.net/bug.php?id=77476&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=77476&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=77476&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=77476&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=77476&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=77476&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=77476&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=77476&r=needscript Try newer version: https://bugs.php.net/fix.php?id=77476&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=77476&r=support Expected behavior: https://bugs.php.net/fix.php?id=77476&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=77476&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=77476&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=77476&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=77476&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=77476&r=dst IIS Stability: https://bugs.php.net/fix.php?id=77476&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=77476&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=77476&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=77476&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=77476&r=mysqlcfg

« previous php.doc.bugs (#16336) next »