Bug #72754 [Opn->Nab]: Compile-time Fatal Error from "[] + 1;" ?
Edit report at https://bugs.php.net/bug.php?id=72754&edit=1
ID: 72754
Updated by: kalle@php.net
Reported by: ryosuke_i_628 at yahoo dot co dot jp
Summary: Compile-time Fatal Error from "[] + 1;" ?
-Status: Open
+Status: Not a bug
Type: Bug
Package: *General Issues
PHP Version: 7.0.9
Block user comment: N
Private report: N
New Comment:
Gonna mark it as NaB
Previous Comments:
------------------------------------------------------------------------
[2016-08-05 12:46:39] ryosuke_i_628 at yahoo dot co dot jp
Although I have no problem with this, it seems to be an unexpected change. If developers have
explicitly changed the feature, there are nothing to say. Sorry and appreciate for your response.
------------------------------------------------------------------------
[2016-08-04 11:59:58] nikic@php.net
I'm sorry, could you please be more precise about what the issue is here. Yes, it changed to a
compile-time error... but what of it? Why is this a problem for you?
------------------------------------------------------------------------
[2016-08-04 11:54:02] ryosuke_i_628 at yahoo dot co dot jp
In PHP 5, direct call for __clone() causes E_COMPILE_ERROR. So we should change Compilte-time
E_ERROR into E_COMPILE_ERROR or Runtime E_ERROR.
------------------------------------------------------------------------
[2016-08-04 11:22:13] ryosuke_i_628 at yahoo dot co dot jp
Description:
------------
In PHP 7, "[] + 1;" seems to cause compile-time Fatal Error.
The important thing is that the issue occurrs on "array literal + non-array literal"
expressions. If either opereand gets turned to be a variable, PHP 7 behaves as same as PHP 5.
Test script:
---------------
<?php
exit;
[] + 1;
Expected result:
----------------
No outputs.
Actual result:
--------------
PHP Fatal error: Unsupported operand types in - on line 3
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=72754&edit=1
Thread (5 messages)