Commit graph

2734 commits

Author SHA1 Message Date
CHU Zhaowei
e829d08729 Implement spread operator in arrays
RFC: https://wiki.php.net/rfc/spread_operator_for_array

Closes GH-3640.
2019-05-13 14:42:43 +02:00
Nikita Popov
b8c2b43778 Merge branch 'PHP-7.4' 2019-05-09 14:35:25 +02:00
Nikita Popov
d0a56f707f Fixed bug #71030
Make sure to always fetch the RHS of a list assignment first, instead
of special casing known self-assignments, which will not detect cases
using references correctly.

As a side-effect, it is no longer possible to do something like
byRef(list($x) = $y). This worked by accident previously, but only
if $y was a CV and the self-assignment case did not trigger.
However it shouldn't work for the same reason that byRef($x = $y)
doesn't. Conversely byRef(list(&$x) = $y) and byRef($x =& $y)
continue to be legal.
2019-05-09 14:31:39 +02:00
Nikita Popov
3619cc78a8 Merge branch 'PHP-7.4' 2019-05-07 14:07:30 +02:00
Nikita Popov
09ea55cb4e Deprecate left-associative ternary
Deprecate nesting ternary operators without explicit parentheses.

RFC: https://wiki.php.net/rfc/ternary_associativity
2019-05-07 14:06:29 +02:00
Nikita Popov
79f41944ba Merge branch 'PHP-7.4' 2019-05-02 15:07:04 +02:00
Nikita Popov
f3e5bbe6f3 Implement arrow functions
Per RFC: https://wiki.php.net/rfc/arrow_functions_v2

Co-authored-by: Levi Morrison <levim@php.net>
Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
2019-05-02 15:04:03 +02:00
Dmitry Stogov
c78fc4971e Fixed access to uninitialized vaiable. 2019-04-18 10:48:04 +03:00
Nikita Popov
3fab73e24e Avoid misc uninitialized variable warnings 2019-04-12 15:12:45 +02:00
Nikita Popov
339b0af429 Avoid misc uninitialized variable warnings 2019-04-12 15:12:39 +02:00
Dmitry Stogov
39505764ad Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace "ZEND_CALL_CTOR" hack by additional live-range
2019-04-12 01:01:47 +03:00
Dmitry Stogov
88a2268d6b Replace "ZEND_CALL_CTOR" hack by additional live-range 2019-04-12 00:49:45 +03:00
Nikita Popov
8f441c90ca Merge branch 'PHP-7.4' 2019-04-11 10:49:38 +02:00
Nikita Popov
30df87f77d Generate ZEND_COUNT for sizeof()
sizeof() is an alias of count(), so we should generate the same
code for them.
2019-04-11 10:48:52 +02:00
Bob Weinand
3b23694aac Deprecate unparenthesized concatenation and addition/subtraction
Implementing RFC https://wiki.php.net/rfc/concatenation_precedence
2019-03-28 23:54:38 +01:00
Nikita Popov
0720313bd4 Merge branch 'PHP-7.4' 2019-03-28 09:31:18 +01:00
Nikita Popov
7f72d771e8 Revert "Switch to bison location tracking"
This reverts commit e528762c1c.

Dmitry reports that this has a non-trivial impact on parsing
overhead, especially on 32-bit systems. As we don't have a strong
need for this change right now, I'm reverting it.

See also comments on
e528762c1c.
2019-03-28 09:29:08 +01:00
Nikita Popov
6b7545c225 Merge branch 'PHP-7.4' 2019-03-21 16:28:19 +01:00
Nikita Popov
e528762c1c Switch to bison location tracking
Locations for AST nodes are now tracked with the help of bison
location tracking. This is more accurate than what we currently do
and easier to extend with more information.

A zend_ast_loc structure is introduced, which is used for the location
stack. Currently it only holds the start lineno, but can be extended
to also hold end lineno and offset/column information in the future.

All AST constructors now accept a zend_ast_loc* as first argument, and
will use it to determine their lineno. Previously this used either the
CG(zend_lineno), or the smallest AST lineno of child nodes.

On the parser side, the location structure for a whole rule can be
obtained using the &@$ character salad.
2019-03-21 16:27:48 +01:00
Nikita Popov
8bb5582751 Merge branch 'PHP-7.3' into PHP-7.4 2019-03-14 17:26:17 +01:00
Xinchen Hui
cc16781e9e Merge branch 'PHP-7.3'
* PHP-7.3:
  updated NEWS
  Fixed bug #77738 (Nullptr deref in zend_compile_expr)
2019-03-14 16:47:30 +08:00
Xinchen Hui
e3965913c4 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77738 (Nullptr deref in zend_compile_expr)
2019-03-14 16:46:46 +08:00
Xinchen Hui
c7920aba3e Fixed bug #77738 (Nullptr deref in zend_compile_expr) 2019-03-14 16:46:04 +08:00
Stanislav Malyshev
7803cb32af Oops, forgot error parameter 2019-03-06 22:44:16 -08:00
Stanislav Malyshev
0ef6c62685 Fix broken memcmp
We can't really do memcmp("_call", "__callStatic", sizeof("__callStatic") -1),
neither should we memcmp constants at all.
2019-03-06 22:22:58 -08:00
rjhdby
1be120f681 Cleanup some checks in zend_compile.c 2019-03-06 10:42:02 +01:00
Nikita Popov
b90730c762 Merge branch 'PHP-7.4' 2019-03-04 12:24:09 +01:00
Nikita Popov
deb44d405e Revert "Detect invalid uses of parent:: during compilation"
This reverts commit a9e6667817.

Breakage found in the wild: Mockery uses a parent:: call in the
implementation regardless of whether the class has a parent or not:
4324afeaf9/library/Mockery/Mock.php (L600)

This change is not worth the compat break in 7.4.
2019-03-04 12:24:02 +01:00
Bob Weinand
76e3828978 Merge branch 'PHP-7.4' 2019-02-27 18:47:03 +01:00
Bob Weinand
94d3e40102 Delay array to string conversion notice until runtime 2019-02-27 18:46:31 +01:00
Nikita Popov
a8daef51e1 Merge branch 'PHP-7.3' into PHP-7.4 2019-02-25 13:02:58 +01:00
Xinchen Hui
761b0639bb Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed compiler warning
2019-02-25 15:04:13 +08:00
Xinchen Hui
4ac954ac3e Fixed compiler warning 2019-02-25 15:04:04 +08:00
Xinchen Hui
249f7df221 Merge branch 'PHP-7.3'
* PHP-7.3:
  Update NEWS
  Fixed bug #77660 (Segmentation fault on break 2147483648)
2019-02-25 15:00:44 +08:00
Xinchen Hui
e8768b338c Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77660 (Segmentation fault on break 2147483648)
2019-02-25 15:00:23 +08:00
Xinchen Hui
1c22ace058 Fixed bug #77660 (Segmentation fault on break 2147483648) 2019-02-25 15:00:14 +08:00
Peter Kokot
20addf88e4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove unused PHP_AC_BROKEN_SPRINTF and AC_ZEND_BROKEN_SPRINTF
2019-02-23 22:29:16 +01:00
Peter Kokot
b33fa18eab Remove unused PHP_AC_BROKEN_SPRINTF and AC_ZEND_BROKEN_SPRINTF
The sprintf function has been normalized to php_sprintf via
61364b5bb1.

This patch removes the checks to make a custom sprintf function

The ZEND_BROKEN_SPRINTF has been removed and the
hardcoded #define zend_sprintf sprintf is used.

The php_sprintf and zend_sprintf are now symbols to sprintf.

This patch now removes the custom PHP definitions of the php_sprintf and
zend_sprintf functions in favor of the C99 sprintf which is also
standardized in C89 already. Once, on some systems sprintf didn't behave
in same way.
2019-02-23 22:26:47 +01:00
Nikita Popov
276de41014 Merge branch 'PHP-7.4' 2019-02-22 15:44:13 +01:00
Nikita Popov
52605aafc5 Fix anon class handling in ext mode
Opcode order changes in 7.4 and the EXT_STMT is now declare the
DECLARE_ANON. Fix this by returning the opline from compile_class_decl
to avoid any fragile opcode searching.
2019-02-22 15:43:08 +01:00
Nikita Popov
bd2a00acdf Merge branch 'PHP-7.2' into PHP-7.3 2019-02-22 10:13:21 +01:00
Nikita Popov
5388143855 Fixed bug #77652 2019-02-22 10:11:54 +01:00
Joe Watkins
97e09049e2
Merge branch 'PHP-7.4'
* PHP-7.4:
  While the compiler does not have the FBC set for zend_get_call_op, optimizer does, and so incorrectly results in ignoring these flags.
2019-02-21 23:55:54 +01:00
Joe Watkins
4d3415636d
While the compiler does not have the FBC set for zend_get_call_op, optimizer does, and so incorrectly results in ignoring these flags.
If someone has a better patch, please merge it ASAP, this appears to be correct as I and Nikita originally thought.

Revert "Revert "zend_get_call_op ignoring compiler flags zend_get_call_op will ignore ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_USER_FUNCTIONS, breaking the intention of these flags""

This reverts commit 0bbbd0f9e7.
2019-02-21 23:54:26 +01:00
Joe Watkins
75ef3eac21
Merge branch 'PHP-7.4'
* PHP-7.4:
  Revert "zend_get_call_op ignoring compiler flags zend_get_call_op will ignore ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_USER_FUNCTIONS, breaking the intention of these flags"
2019-02-21 22:41:13 +01:00
Joe Watkins
0bbbd0f9e7
Revert "zend_get_call_op ignoring compiler flags zend_get_call_op will ignore ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_USER_FUNCTIONS, breaking the intention of these flags"
This reverts commit 46807ec5da.
2019-02-21 22:40:02 +01:00
Joe Watkins
7a9d638302
Merge branch 'PHP-7.4'
* PHP-7.4:
  zend_get_call_op ignoring compiler flags zend_get_call_op will ignore ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_USER_FUNCTIONS, breaking the intention of these flags
2019-02-21 11:22:43 +01:00
Joe Watkins
46807ec5da
zend_get_call_op ignoring compiler flags zend_get_call_op will ignore ZEND_COMPILE_IGNORE_USER_FUNCTIONS and ZEND_COMPILE_IGNORE_USER_FUNCTIONS, breaking the intention of these flags 2019-02-21 11:22:30 +01:00
Christoph M. Becker
44ebbf0de1 Merge branch 'PHP-7.4'
* PHP-7.4:
  fix #77642: typo "incompatibe" in Zend/zend_compile.c [ci skip]
2019-02-20 19:41:25 +01:00
divinity76
876369bea2 fix #77642: typo "incompatibe" in Zend/zend_compile.c [ci skip]
the word "incompatible" was accidentally written as "incompatibe"

guilty commit: 7e597f48e9
2019-02-20 19:41:09 +01:00