Commit Graph

2527 Commits

Author SHA1 Message Date
Dmitry Stogov
d5943f5a11 Use run-time cache to avoid repeatable hash lookups when creating anonymous functions and classes 2019-07-19 10:43:49 +03:00
Dmitry Stogov
5ac3580b9b Merge branch 'PHP-7.4'
* PHP-7.4:
  ZEND_DECLARE_ANON_CLASS doesn't need to skip anything now. It's immediatelly followed by ZEND_NEW.
2019-07-19 10:10:50 +03:00
Dmitry Stogov
b065fbde19 ZEND_DECLARE_ANON_CLASS doesn't need to skip anything now. It's immediatelly followed by ZEND_NEW. 2019-07-19 10:09:26 +03:00
Nikita Popov
9207aef60c Merge branch 'PHP-7.4' 2019-07-15 16:26:25 +02:00
Nikita Popov
c5f1b384b5 Move shebang handling into the lexer
Instead of handling shebang lines by adjusting the file pointer in
individual SAPIs, move the handling into the lexer, where this is
both a lot simpler and more robust. Whether the shebang should be
skipped is controlled by CG(skip_shebang) -- we might want to do
that in more cases.

This fixed bugs #60677 and #78066.
2019-07-15 16:25:49 +02:00
Dmitry Stogov
1b5b8175af Merge branch 'PHP-7.4'
* PHP-7.4:
  Replace ZEND_ASSIGN_ADD (and others) by ZEND_ASSIGN_OP, ZEND_ASSIGN_DIM_OP, ZEND_ASSGIN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP
2019-07-05 12:16:30 +03:00
Dmitry Stogov
48ca5a1e17 Replace ZEND_ASSIGN_ADD (and others) by ZEND_ASSIGN_OP, ZEND_ASSIGN_DIM_OP, ZEND_ASSGIN_OBJ_OP and ZEND_ASSIGN_STATIC_PROP_OP 2019-07-05 12:03:25 +03:00
Nikita Popov
b4121f4930 Merge branch 'PHP-7.4' 2019-06-28 12:45:26 +02:00
Nikita Popov
9f81c56e42 Fix out-of-bounds read in array compilation
UNPACK elements only have one child. Don't access the second one
until we have excluded this case.
2019-06-28 12:44:46 +02:00
Dmitry Stogov
e2effc96b4 Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid double checks on early binding
2019-06-27 02:25:57 +03:00
Dmitry Stogov
83b99527df Avoid double checks on early binding 2019-06-27 02:13:06 +03:00
Dmitry Stogov
0655598280 Merge branch 'PHP-7.4'
* PHP-7.4:
  Set ZEND_ACC_LINKED flag after early binding (for consistency)
2019-06-25 15:06:19 +03:00
Dmitry Stogov
1d534b9da5 Set ZEND_ACC_LINKED flag after early binding (for consistency) 2019-06-25 15:05:27 +03:00
Dmitry Stogov
e4f4be1a05 Merge branch 'PHP-7.4'
* PHP-7.4:
  Reduce overhead of delayed early binding
2019-06-25 14:21:23 +03:00
Dmitry Stogov
e8f1f70101 Reduce overhead of delayed early binding 2019-06-25 14:20:41 +03:00
Dmitry Stogov
ca22c456ca Merge branch 'PHP-7.4'
* PHP-7.4:
  Keep lowercased parent class name as second argument of DECLARE_CLASS to avoid extra work at run-time
2019-06-25 11:32:03 +03:00
Dmitry Stogov
759f4ecd8b Keep lowercased parent class name as second argument of DECLARE_CLASS to avoid extra work at run-time 2019-06-25 11:30:58 +03:00
Dmitry Stogov
e18c60cd8d Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug 78175 (Preloading must store default values of static variables and properties)
2019-06-24 20:34:05 +03:00
Dmitry Stogov
0f29fb5cd8 Fixed bug 78175 (Preloading must store default values of static variables and properties) 2019-06-24 20:32:27 +03:00
twosee
61f78de486 Constify some char* arguments or return values of ZEND_API
Closes GH-4247.
2019-06-12 16:49:32 +02:00
Nikita Popov
477d1e02ae Merge branch 'PHP-7.4' 2019-06-12 11:54:21 +02:00
Nikita Popov
f601eb15e6 Fix -Wmissing-braces warnings
Unfortunate that = {} is a GNU extension.
2019-06-12 11:54:12 +02:00
Nikita Popov
e4fae9c061 Merge branch 'PHP-7.4' 2019-06-11 13:16:38 +02:00
Nikita Popov
8f8fcbbd39 Support full variance if autoloading is used
Keep track of delayed variance obligations and check them after
linking a class is otherwise finished. Obligations may either be
unresolved method compatibility (because the necessecary classes
aren't available yet) or open parent/interface dependencies. The
latter occur because we allow the use of not fully linked classes
as parents/interfaces now.

An important aspect of the implementation is we do not require
classes involved in variance checks to be fully linked in order for
the class to be fully linked. Because the involved types do have to
exist in the class table (as partially linked classes) and we do
check these for correct variance, we have the guarantee that either
those classes will successfully link lateron or generate an error,
but there is no way to actually use them until that point and as
such no possibility of violating the variance contract. This is
important because it ensures that a class declaration always either
errors or will produce an immediately usable class afterwards --
there are no cases where the finalization of the class declaration
has to be delayed until a later time, as earlier variants of this
patch did.

Because variance checks deal with classes in various stages of
linking, we need to use a special instanceof implementation that
supports this, and also introduce finer-grained flags that tell us
which parts have been linked already and which haven't.

Class autoloading for variance checks is delayed into a separate
stage after the class is otherwise linked and before delayed
variance obligations are processed. This separation is needed to
handle cases like A extends B extends C, where B is the autoload
root, but C is required to check variance. This could end up
loading C while the class structure of B is in an inconsistent
state.
2019-06-11 13:09:33 +02:00
Nikita Popov
89b2d88659 Register class before fetching parent
We want the class declaration to be available while compiling the
parent class.
2019-06-11 13:09:33 +02:00
Joe Watkins
1b9ffcb21b
Merge branch 'PHP-7.4'
* PHP-7.4:
  BIND_LEXICAL has a meaningless line number
2019-06-10 14:19:58 +02:00
Joe Watkins
42d60addef
BIND_LEXICAL has a meaningless line number 2019-06-10 14:19:39 +02:00
Joe Watkins
a583241704
Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix #78132 wrong line number on ZEND_BIND_STATIC for lexical vars
2019-06-08 21:48:00 +02:00
Joe Watkins
006b191126
Fix #78132 wrong line number on ZEND_BIND_STATIC for lexical vars 2019-06-08 21:47:07 +02:00
Nikita Popov
775e86344f Merge branch 'PHP-7.4' 2019-05-31 12:56:51 +02:00
Nikita Popov
67b84e4548 Fixed uninitialized var warning
Causes build failure on release+zts azure build. I'm rewriting this
code to separate the if/else handling, because they don't really
have anything in common anyway...
2019-05-31 12:55:13 +02:00
Nikita Popov
45c663a9d3 Merge branch 'PHP-7.4' 2019-05-27 17:13:00 +02:00
Nikita Popov
fd23f9104a BIND_STATIC of implicit binding may be undef
Even though we don't need it at runtime, add the BIND_IMPLICIT
flag to BIND_STATIC as well, so we can distinguish this case in
type inference.

This fixes a JIT miscompile in arrow_functions/002.phpt.
2019-05-27 17:12:20 +02:00
Nikita Popov
13f675b858 Merge branch 'PHP-7.4' 2019-05-27 09:38:33 +02:00
Nikita Popov
e6fac86dc3 Accept flags argument in zend_lookup_class_ex()
Instead of a single boolean, so we have space for extension here.
2019-05-27 09:36:25 +02:00
Nikita Popov
038db18496 Merge branch 'PHP-7.4' 2019-05-24 11:02:03 +02:00
Nikita Popov
d7f3844c87 Deprecate use of parent where no parent exists
This deprecation is part of the covariance RFC.
2019-05-24 10:58:46 +02:00
Nikita Popov
e06ec226bc Merge branch 'PHP-7.4' 2019-05-24 09:33:58 +02:00
Nikita Popov
afec3a9208 Avoid early-binding on unresolved types
Fixes bug #76451, and more importantly lays necessary groundwork for
covariant/contravariant types. Bug #76451 is just an edge case, but
once covariance is introduced this will become a common problem instead.
2019-05-24 09:30:13 +02:00
Dmitry Stogov
1e10c06f20 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #78014 (Preloaded classes may depend on non-preloaded classes due to unresolved consts)
2019-05-20 18:16:01 +03:00
Dmitry Stogov
f53b9939fe Fixed bug #78014 (Preloaded classes may depend on non-preloaded classes due to unresolved consts) 2019-05-20 18:15:38 +03:00
Bob Weinand
cbc90b1f6e Merge branch 'deprecate_concat_add_sub' into PHP-8.4 2019-05-16 18:31:28 +02:00
Nikita Popov
f106f57164 Merge branch 'PHP-7.4' 2019-05-13 14:43:10 +02:00
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
Joe Watkins
b7a442ed7b
Merge branch 'PHP-7.4'
* PHP-7.4:
  begin handlers are currently invoked without access to the arguments being sent, this moves the opcode after SEND
2019-02-19 18:21:49 +01:00
Joe Watkins
a3994a9e16
begin handlers are currently invoked without access to the arguments being sent, this moves the opcode after SEND 2019-02-19 18:21:32 +01:00
Nikita Popov
f37c70c7fb Merge branch 'PHP-7.4' 2019-02-19 10:12:01 +01:00
Joe Watkins
f8cd8eb740
ZEND_COMPILE_EXTENDED_INFO split Currently a tool may not decide between debugging and profiling behaviour: We split ZEND_COMPILE_EXTENDED_INFO into ZEND_COMPILE_EXTENDED_FCALL and ZEND_COMPILE_EXTENDED_STMT We define ZEND_COMPILE_EXTENDED_INFO as ZEND_COMPILE_EXTENDED_STMT|ZEND_COMPILE_EXTENDED_FCALL 2019-02-19 10:07:02 +01:00
Peter Kokot
18295b396f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fix typos in code comments in Zend/ [skip ci]
2019-02-18 17:56:38 +01:00
Tyson Andre
da3316ff0f Fix typos in code comments in Zend/ [skip ci] 2019-02-18 17:56:28 +01:00
Christoph M. Becker
47bcc02823 Merge branch 'PHP-7.4'
* PHP-7.4:
  Unify clone method error message
2019-02-15 15:08:41 +01:00
rjhdby
d6a53ed5e0 Unify clone method error message 2019-02-15 15:08:02 +01:00
Nikita Popov
903821b1c7 Merge branch 'PHP-7.4' 2019-02-15 11:28:14 +01:00
Nikita Popov
3cafa7f4df Assign (un)serialize_func during compilation
This avoids writing this cache at runtime, which is illegal if
preloading is used.

Not every serialize/unserialize function actually belongs to the
Serializable interface, but I think it's not a problem to assign
these anyway -- whether they are used ultimately depends on whether
Serializable is implemented.

Alternatively it might make sense to just drop these entirely. I
don't think this is performance critical functionality.
2019-02-15 11:20:28 +01:00
Dmitry Stogov
4474cf43e6 Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #77613 (method visibility change) (reverted ZEND_ACC_CTOR and ZEND_ACC_DTOR flags removal)
2019-02-14 13:18:45 +03:00
Dmitry Stogov
43a7d95016 Fixed bug #77613 (method visibility change) (reverted ZEND_ACC_CTOR and ZEND_ACC_DTOR flags removal) 2019-02-14 13:12:50 +03:00
Nikita Popov
8afa2c632b Merge branch 'PHP-7.4' 2019-02-12 17:37:34 +01:00
Nikita Popov
9364153942 Fixed bug #76430
It's somewhat ambiguous what exactly the correct behavior is
supposed to be, I'm just picking something more or less reasonable
here.
2019-02-12 17:36:07 +01:00
Peter Kokot
623911f993 Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove local variables
2019-02-03 21:23:18 +01:00
Peter Kokot
92ac598aab Remove local variables
This patch removes the so called local variables defined per
file basis for certain editors to properly show tab width, and
similar settings. These are mainly used by Vim and Emacs editors
yet with recent changes the once working definitions don't work
anymore in Vim without custom plugins or additional configuration.
Neither are these settings synced across the PHP code base.

A simpler and better approach is EditorConfig and fixing code
using some code style fixing tools in the future instead.

This patch also removes the so called modelines for Vim. Modelines
allow Vim editor specifically to set some editor configuration such as
syntax highlighting, indentation style and tab width to be set in the
first line or the last 5 lines per file basis. Since the php test
files have syntax highlighting already set in most editors properly and
EditorConfig takes care of the indentation settings, this patch removes
these as well for the Vim 6.0 and newer versions.

With the removal of local variables for certain editors such as
Emacs and Vim, the footer is also probably not needed anymore when
creating extensions using ext_skel.php script.

Additionally, Vim modelines for setting php syntax and some editor
settings has been removed from some *.phpt files.  All these are
mostly not relevant for phpt files neither work properly in the
middle of the file.
2019-02-03 21:03:00 +01:00
Nikita Popov
aad39879f2 Remove bareword fallback for constants
Access to undefined constants will now always result in an Error
exception being thrown.

This required quite a few test changes, because there were many
buggy tests that unintentionally used bareword fallback in combination
with error suppression.
2019-01-31 13:52:06 +01:00
Nikita Popov
3d39479f4d Remove support for case-insensitive constants
The only remaining case-insensitive constants are null, true and
false, which are handled explicitly.

In the future we may convert them from constants to reserved keywords.
2019-01-31 13:52:06 +01:00
Nikita Popov
0dfd918ee7 Remove support for __autoload()
There are probably some improvements we can do to the SPL
implementation now that __autoload() is gone. In particular having
EG(autoload_func) as a property zend function, rather than a simple
callback probably doesn't make sense.
2019-01-30 14:00:16 +01:00
Zeev Suraski
a81202ac49 Adios, yearly copyright ranges 2019-01-30 11:48:28 +01:00
Zeev Suraski
02557f87bc Adios, yearly copyright ranges 2019-01-30 11:23:29 +02:00
Nikita Popov
6c73b50cf6 Remove static calls to non-static methods 2019-01-30 09:19:02 +01:00
Nikita Popov
682b54f687 Remove support for legacy constructors
This has been deprecated in PHP 7.0 by
https://wiki.php.net/rfc/remove_php4_constructors.
2019-01-29 13:04:20 +01:00
Nikita Popov
55dbb57322 Remove support for custom assert() function
Deprecated in PHP 7.3 as part of
https://wiki.php.net/rfc/deprecations_php_7_3.
2019-01-29 11:10:47 +01:00
Nikita Popov
d74d3922ce Remove (unset) cast
Deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-29 11:10:47 +01:00
Nikita Popov
46d38aa7cd Merge branch 'PHP-7.4' 2019-01-29 09:40:38 +01:00
Nikita Popov
16460ebc81 Merge branch 'PHP-7.3' into PHP-7.4 2019-01-29 09:40:19 +01:00
Nikita Popov
14684af0d0 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-29 09:40:06 +01:00
Nikita Popov
34898e9766 Make special assert() handling independent of compiler flags 2019-01-29 09:39:12 +01:00
Nikita Popov
331e56ce38 Remove mbstring.func_overload
Deprecated in PHP 7.2 as part of
https://wiki.php.net/rfc/deprecations_php_7_2.
2019-01-28 15:58:23 +01:00
Nikita Popov
768bc7a0b8 Merge branch 'PHP-7.3' 2019-01-28 09:23:53 +01:00
Nikita Popov
ab3c94a54f Merge branch 'PHP-7.2' into PHP-7.3 2019-01-28 09:23:23 +01:00
ekinhbayar
ef68cd3249 Fixed bug #77530: PHP crashes when parsing "(2)::class" 2019-01-28 09:22:18 +01:00
Nikita Popov
b93aefc1a7 Fix assign to self detection 2019-01-27 20:50:08 +01:00
rjhdby
3a0fc00424
zend_compile.c: zend_is_variable(). Removed unnecessary checks. Naming according to internal logic. 2019-01-27 08:38:08 +01:00
Nikita Popov
1d984cc707 Merge branch 'PHP-7.3' 2019-01-24 10:58:24 +01:00
Nikita Popov
e0f97ae7ec Merge branch 'PHP-7.2' into PHP-7.3 2019-01-24 10:57:45 +01:00
Nikita Popov
526344aa5e Add flag to disable jumptable optimization
This is useful for coverage. While it is currently safe to just
skip over the SWITCH_* opcodes, this may not be true in the future
due to opcache optimizations, so it's safer to disable emission of
SWITCH_* opcodes entirely.
2019-01-24 10:56:04 +01:00
Nikita Popov
a50198d0fe Implement ??= operator
RFC: https://wiki.php.net/rfc/null_coalesce_equal_operator

$a ??= $b is $a ?? ($a = $b), with the difference that $a is only
evaluated once, to the degree that this is possible. In particular
in $a[foo()] ?? $b function foo() is only ever called once.
However, the variable access themselves will be reevaluated.
2019-01-22 11:12:04 +01:00
Dmitry Stogov
960f922ed2 Fixed odd ROPE_ADD instruction placement. 2019-01-21 23:34:09 +03:00
Nikita Popov
3269e88468 Implement single-pass live range calculation
Instead of interleaving creation of live-ranges with the main
compiler code, compute them in a separate pass over the opcodes
as part of pass_two. Additionally, do not keep live ranges
synchronized during optimization in opcache and instead use the
same mechanism to recompute them after optimization.
2019-01-21 11:47:27 +01:00
Nikita Popov
e219ec144e Implement typed properties
RFC: https://wiki.php.net/rfc/typed_properties_v2

This is a squash of PR #3734, which is a squash of PR #3313.

Co-authored-by: Bob Weinand <bobwei9@hotmail.com>
Co-authored-by: Joe Watkins <krakjoe@php.net>
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2019-01-11 15:49:06 +01:00
Nikita Popov
9ca217f506 Resolve parent::class at compile-time if possible
And remove some dead code.
2019-01-04 12:10:22 +01:00
Nikita Popov
a9e6667817 Detect invalid uses of parent:: during compilation
We already detect the case where we're entirely outside a class --
now also check whether there actually is a parent.

This is a minor BC break, in that code that was never executed
might have previously contained an invalid parent:: reference without
generating an error.
2019-01-04 11:55:41 +01:00
Nikita Popov
447b3470de Support parent::class inside constexpr contexts 2019-01-04 11:46:57 +01:00
Nikita Popov
f58846a15d Handle self::class separately from __CLASS__ in const eval 2019-01-04 11:46:57 +01:00
Nikita Popov
9b3fda4342 Don't replace self::class with __CLASS__ during const eval
Instead delay this until const expression compilation. Otherwise
self::class and [self::class] have different behavior...
2019-01-04 11:16:59 +01:00
Nikita Popov
290adc4132 Introduce separate ZEND_AST_CLASS_NAME AST node
Instead of representing this as a ZEND_AST_CLASS_CONST with a
"class" constant name.

Class constants and ::class are unrelated features that happen to
share syntax, so represent and handle them separately.
2019-01-04 10:49:23 +01:00
Nikita Popov
03094c7af3 Merge branch 'PHP-7.3' 2019-01-04 09:53:36 +01:00
Nikita Popov
1ed20669c5 Merge branch 'PHP-7.2' into PHP-7.3 2019-01-04 09:53:30 +01:00
Nikita Popov
41af1e6781 Fix self::class inside constant in global scope
Previously this triggered an assertion failure. The behavior is
not quite correct, in that self::class should generate an exception
if there is no self, but returns an empty string here. Fixing that
would be a bit too intrusive for the 7.2 branch.
2019-01-04 09:52:04 +01:00
Nikita Popov
f9208e9bf8 Merge branch 'PHP-7.3' 2019-01-02 11:34:24 +01:00
Nikita Popov
613683580b Merge branch 'PHP-7.2' into PHP-7.3 2019-01-02 11:34:15 +01:00
Nikita Popov
73596c56e7 Partial fix for bug #75426
This does not print the exact line of the comma, but rather the line
of the previous element. This should generally be "good enough", as
the line number is close (off by one) to the actual issue now.
Previously it would point to the start of the array, which may be
very far away.
2019-01-02 11:32:48 +01:00
Nikita Popov
636b1c3d26 Drop _ex from zend_compile_class_ref_ex
The non-ex version no longer exists.
2019-01-02 09:56:40 +01:00
Michael Moravec
f5044a12dd Implement ZEND_ARRAY_KEY_EXISTS opcode to speed up array_key_exists() 2018-12-26 23:54:11 +03:00
Dmitry Stogov
636b16402b Fixed crashes introduced by 7e597f48e9 (only master was affected) 2018-12-25 23:30:59 +03:00