Bug #72214 [Ver->Nab]: variables doesn't passed node

From: Date: Fri, 13 May 2016 22:42:21 +0000
Subject: Bug #72214 [Ver->Nab]: variables doesn't passed node
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-201079@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72214&edit=1 ID: 72214 Updated by: bwoebi@php.net Reported by: schumacher1986 at hotmail dot com Summary: variables doesn't passed node -Status: Verified +Status: Not a bug Type: Bug Package: Scripting Engine problem Operating System: windows PHP Version: 7.0.7RC1 Block user comment: N Private report: N New Comment: Right, that behavior is intentional. It was a long-term bug fix which somehow allowed objects to be passed by-reference without being actually a reference. If the function expects a reference, you have to pass a reference. Closing as Not a Bug... Previous Comments: ------------------------------------------------------------------------ [2016-05-13 22:11:05] matias at avusto dot fi Here is the pull request to fix this for Joomla: https://github.com/joomla/joomla-cms/pull/10452 Personally I think that the new behaviour is the correct one. It doesn't break anything and referencing objects is most of the time so PHP4... :) I guess the only reason to pass object as reference is when you want to replace the object with something else, but then you'd want to pass variable instead to allow it to be read from outside. ------------------------------------------------------------------------ [2016-05-13 18:07:02] requinix@php.net Actually I just remembered that PHP 7 came with a reclassification of some strict warnings. The one I'm talking about was a strict before and a notice now. https://wiki.php.net/rfc/reclassify_e_strict#only_variables_should_be_passed_by_reference Just tried with 7.0.7RC1 too and I can confirm the message is appearing when it did not in 7.0.6. Here's the thing: every expression used as a by-ref argument triggered the strict/notice message before - except for new objects. That code was actually working fine before. But I'm more inclined to see that exception as a bug and this change in behavior a bug fix; there would be new notices popping up but code would continue to work. So even though I'm switching this to Verified, it may not be a bug after all. Or maybe its fix is postponed until 7.1. ------------------------------------------------------------------------ [2016-05-13 17:40:31] matias at avusto dot fi Believe me, I have error_reporting = E_ALL in all of the PHP versions I've installed (using phpbrew). I'm just saying as Joomla has likely thousands of developers who have never seen this error before. I haven't tried PHP 7.0.7 builds yet, but I can say that there are no errors in the log files when I'm using PHP 7.0.6 (or any PHP version I've used in the past). ------------------------------------------------------------------------ [2016-05-13 17:22:26] requinix@php.net Never *shown* it before. Your PHP 5 setup probably had notices suppressed. ------------------------------------------------------------------------ [2016-05-13 17:18:58] matias at avusto dot fi Its not a bug in PHP, though I have no idea why PHP never had the notice shown before. class JAdminCssMenu extends JObject { public function addChild(JMenuNode &$node, $setCurrent = false) { ... } ... } vs call to it: $menu->addChild(new JMenuNode(JText::_('MOD_MENU_CONTROL_PANEL'), 'index.php', 'class:cpanel')); Only variables can be passed to the function as the first parameter and what is passed is certainly not a variable. ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=72214 -- Edit this bug report at https://bugs.php.net/bug.php?id=72214&edit=1

« previous php.bugs (#201079) next »