Bug #72754 [Com]: Compile-time Fatal Error from "[] + 1;" ?
| From: | ryosuke_i_628 at yahoo dot co dot jp | Date: | Thu, 04 Aug 2016 11:54:03 +0000 |
| Subject: | Bug #72754 [Com]: Compile-time Fatal Error from "[] + 1;" ? | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-202920@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=72754&edit=1
ID: 72754
Comment by: ryosuke_i_628 at yahoo dot co dot jp
Reported by: ryosuke_i_628 at yahoo dot co dot jp
Summary: Compile-time Fatal Error from "[] + 1;" ?
Status: Open
Type: Bug
Package: *General Issues
PHP Version: 7.0.9
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[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