Bug #72214 [Com]: variables doesn't passed node
| From: | matias at avusto dot fi | Date: | Fri, 13 May 2016 22:11:06 +0000 |
| Subject: | Bug #72214 [Com]: variables doesn't passed node | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-201078@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
Comment by: matias at avusto dot fi
Reported by: schumacher1986 at hotmail dot com
Summary: variables doesn't passed node
Status: Verified
Type: Bug
Package: Scripting Engine problem
Operating System: windows
PHP Version: 7.0.7RC1
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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.
------------------------------------------------------------------------
[2016-05-13 14:59:00] requinix@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.
A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc. If the script requires a
database to demonstrate the issue, please make sure it creates
all necessary tables, stored procedures etc.
Please avoid embedding huge scripts into the report.
------------------------------------------------------------------------
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