Commit Graph

2587 Commits

Author SHA1 Message Date
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
Dmitry Stogov
773ed62555 Merge branch 'PHP-7.3'
* PHP-7.3:
  Fixed bug #77339 (__callStatic may get incorrect arguments)
2018-12-24 13:25:24 +03:00
Dmitry Stogov
ddfb44f2cf Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77339 (__callStatic may get incorrect arguments)
2018-12-24 13:23:47 +03:00
Dmitry Stogov
7e597f48e9 Fixed bug #77339 (__callStatic may get incorrect arguments) 2018-12-24 13:22:43 +03:00
Nikita Popov
6debea2fd8 Merge branch 'PHP-7.3' 2018-12-10 13:36:54 +01:00
Nikita Popov
93aabf1533 Fixed bug #77275
Instead of juggling with this problem during literal compaction,
make sure that we always initialize Z_EXTRA for literals, which
seems like the more robust solution.
2018-12-10 13:36:23 +01:00
Dmitry Stogov
f12e6a076f Reorder conditions 2018-12-07 19:21:26 +03:00
Dmitry Stogov
99658f682e Improve zend_check_live_ranges() 2018-12-07 18:15:14 +03:00
Dmitry Stogov
be4c67a40a Stop passing CG(active_op_array) between internal compiler functions. 2018-12-07 17:47:56 +03:00
Gabriel Caruso
cdd8368d6f Clean up unnecessary ternary expressions and simplify some returns
- Simplify conditions
- Use ZEND_HASH_APPLY_* instead of hard-coded booleans
- Use ZEND_NORMALIZE_BOOL
- Drop sign in favor of ZEND_NORMALIZE_BOOL
2018-12-03 01:22:14 +01:00
Nikita Popov
9adc8d546c Merge branch 'PHP-7.3' 2018-11-27 19:44:52 +01:00
Nikita Popov
12e88781e1 Merge branch 'PHP-7.2' into PHP-7.3 2018-11-27 19:44:45 +01:00
Nikita Popov
b565c85b9e Improve fix for #76046
Also locate the JMP at the start of the foreach.

Patch suggested by Derick.
2018-11-27 19:43:25 +01:00
Nikita Popov
6faa625cb8 Merge branch 'PHP-7.3' 2018-11-27 16:39:35 +01:00
Nikita Popov
d78211aec0 Merge branch 'PHP-7.2' into PHP-7.3 2018-11-27 16:39:21 +01:00
Nikita Popov
d6595f276f Fixed bug #76046
Place FE_FREE on start line of foreach, instead of whatever random
line number might be in CG(zend_lineno) at the time.
2018-11-27 16:37:55 +01:00
Levi Morrison
74d15b535a Remove do_bind_inherited_class; use do_bind_class
Pass NULL as the second parameter. I don't know if in the past these
differed more, but there isn't any point to having both of them
anymore.
2018-11-07 18:54:00 +01:00
Zeev Suraski
9afce019e0 Future-proof email addresses 2018-11-01 18:35:32 +02:00
Zeev Suraski
54dc07f3dc Update email addresses. We're still @Zend, but future proofing it... 2018-11-01 17:20:07 +02:00
Dmitry Stogov
3fe698b904 Mark "top-level" functions. 2018-10-19 13:22:29 +03:00
Dmitry Stogov
9226695c22 Mark "top-level" classes 2018-10-17 16:12:46 +03:00
Dmitry Stogov
d57cd36e47 Immutable clases and op_arrays.
Squashed commit of the following:

commit cd0c36c3f9
Merge: 4740dabb84 ad6738e886
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 14:43:38 2018 +0300

    Merge branch 'master' into immutable

    * master:
      Remove the "auto" encoding
      Fixed bug #77025
      Add vtbls for EUC-TW encoding

commit 4740dabb84
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 14:12:28 2018 +0300

    Reverted back ce->iterator_funcs_ptr. Initialize ce->iterator_funcs_ptr fields in immutable classes.

commit ad7a78b253
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:46:30 2018 +0300

    Added comment

commit 0276ea5187
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:42:43 2018 +0300

    Added type cast

commit c63fc5d5f1
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:36:51 2018 +0300

    Moved static class members initialization into the proper place.

commit b945548e93
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:21:03 2018 +0300

    Removed redundand assertion

commit d5a4108840
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:19:13 2018 +0300

    Removed duplicate code

commit 8dadca8864
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 11:05:43 2018 +0300

    Hide offset encoding magic in ZEND_MAP_PTR_IS_OFFSET(), ZEND_MAP_PTR_OFFSET2PTR() and ZEND_MAP_PTR_PTR2OFFSET() macros.

commit 9ef07c88bd
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 10:48:29 2018 +0300

    typo

commit a06f0f3d3a
Merge: 94099586ec 3412345ffe
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Oct 17 10:47:07 2018 +0300

    Merge branch 'master' into immutable

    * master:
      Remove unused variable makefile_am_files
      Classify object handlers are required/optional
      Add support for getting SKIP_TAGSTART and SKIP_WHITE options
      Remove some obsolete config_vars.mk occurrences
      Remove bsd_converted from .gitignore
      Remove configuration parser and scanners ignores
      Remove obsolete buildconf.stamp from .gitignore
      [ci skip] Add magicdata.patch exception to .gitignore
      Remove outdated ext/spl/examples items from .gitignore
      Remove unused test.inc in ext/iconv/tests

commit 94099586ec
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon Oct 15 23:34:01 2018 +0300

    Immutable clases and op_arrays
2018-10-17 15:52:50 +03:00
Peter Kokot
902d39a3a7 Trim trailing whitespace in source code files 2018-10-13 14:14:50 +02:00
Bob Weinand
dcdf1ccf68 Initialize ce->parent_name to NULL 2018-10-07 11:21:48 +02:00
Nikita Popov
a515f60790 Remove unused backpatch_count field 2018-10-05 12:14:42 +02:00
Dmitry Stogov
a2e8334613 Allocate only necessary space for static properties of internal classes in ZTS mode. 2018-10-01 19:05:31 +03:00
Nikita Popov
c4cb3250ca Generalize compile_typename
Return zend_type instead of assigning to arg_info. Also move
nullable handling into the function.
2018-09-29 18:53:48 +02:00
Nikita Popov
2ae2e820be Merge branch 'PHP-7.3' 2018-09-29 14:23:13 +02:00
Nikita Popov
8b8b625d08 Fixed bug #72635
This seems to be a simple oversight, where we did not enable
exceptions. Other constexpr conditions already throw, so there is
no particular reason to stick to a fatal error here.
2018-09-29 14:21:08 +02:00
Dmitry Stogov
ef00e7e547 Remove zend_hash_exists() 2018-09-19 12:22:58 +03:00
Dmitry Stogov
2df91cb519 Fixed crashes in ZTS build introduced by 689c6fb188 2018-09-18 16:49:58 +03:00
Dmitry Stogov
689c6fb188 Replace ZEND_ACC_ANON_BOUND, ZEND_ACC_UNRESOLVED_PARENT and ZEND_ACC_UNRESOLVED_INTERFACES with single ZEND_ACC_LINKED. 2018-09-18 11:41:40 +03:00
Dmitry Stogov
8939c4d96b Get rid of ZEND_ACC_CTOR, ZEND_ACC_DTOR and ZEND_ACC_IMPLEMENTED_ABSTRACT 2018-09-05 13:16:10 +03:00
Dmitry Stogov
887e126240 Fixed condition 2018-09-03 14:50:35 +03:00
Dmitry Stogov
cd9f0a22fc Perform run-time binding reusing HashTable bucket (without new bucket insertion). 2018-08-29 00:35:07 +03:00
Dmitry Stogov
2fbfdde1b6 Cleanup class linking 2018-08-27 16:40:25 +03:00
Dmitry Stogov
02eded868c Avoid function copying 2018-08-27 12:47:32 +03:00
Dmitry Stogov
6136a20544 ZEND_DECLARE_CLASS, ZEND_DECLARE_INHERITED_CLASS and ZEND_DECLARE_INHERITED_CLASS_DELAYED don't need return value anymore. 2018-08-24 15:40:53 +03:00
Dmitry Stogov
b36dbdd1dd Perform "early-binding" directly during compilation 2018-08-24 15:18:38 +03:00
Dmitry Stogov
8050f4a334 Keep information about unresolved parent class in zend_class_entry->parent_name 2018-08-24 00:20:57 +03:00
Dmitry Stogov
d140df58e6 Keep information about unresolved interfaces in zend_class_entry->interface_names.
Move interface implementation code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_INTERFACE and ZEND_VERIFY_ABSTRACT_CLASS opcodes.
2018-08-23 17:16:28 +03:00
Dmitry Stogov
67397970b2 Replace zend_class_entry->traits by persistent zend_class_entry->trait_names.
Move trait binding code into ZEND_DECLARE_*CLASS opcodes.
Remove ZEND_ADD_TRIAIT and ZEND_BIND_TRAITS opcodes.
2018-08-23 02:02:26 +03:00
Dmitry Stogov
92fdf9d629 Change zend_lookup_class_ex() and zend_fetch_class_by_name() prototypes to accept optional lower-case class name as zend_string*, instead of zval*. 2018-08-22 17:07:31 +03:00
Dmitry Stogov
fc8d6b6797 Introduced ZEND_COMPILE_IGNORE_OTHER_FILES compiler option, to allow "separate" file compilation (unaffected but previously compiled files), without CG(function_table)/CG(class_table) manipulation. 2018-08-22 13:45:56 +03:00
Nikita Popov
850b53df0e Unify unpack checking in compile_special_func()
Instead of handling this separately for each specialized function,
do one check directly in zend_compile_special_func().
2018-08-22 11:38:28 +02:00
Dmitry Stogov
e3bbfbe6a2 Removed op_array->static_variables duplication code. They can't be "shared" during comilation. 2018-08-22 08:24:28 +03:00
Nikita Popov
045b74c12c Drop dead code
var_ast is always a ZEND_AST_ZVAL.
2018-08-21 13:43:29 +02:00
Dmitry Stogov
6d88e1ccd6 Don't use second operand of BIND_STATIC instruction. 2018-08-21 12:22:04 +03:00
Dmitry Stogov
64f8b0185f Merge branch 'PHP-7.3'
* PHP-7.3:
  Avoid hash lookups in BIND_STATIC and BIND_LEXICAL opcode handlers. Encode static variable offset into opline->extended_value.
2018-08-20 16:11:40 +03:00
Dmitry Stogov
b8828926f2 Avoid hash lookups in BIND_STATIC and BIND_LEXICAL opcode handlers.
Encode static variable offset into opline->extended_value.
2018-08-20 16:10:09 +03:00
Gabriel Caruso
84b195d9fc Fix some misspellings 2018-08-12 16:15:45 +02:00
Dmitry Stogov
3ced766da9 Removed duplicate code. zend_fetch_dimension_address_LIST_w() was a copy of zend_fetch_dimension_address_W(), ZEND_FETCH_LIST_W_SPEC_CV_... a copy of ZEND_FETCH_DIM_W_SPEC_CV_... 2018-07-30 10:53:39 +03:00
Dmitry Stogov
ab8094c666 Pack zend_constant.flags and zend_constant.module_number into reserved space inside zend_constant.value. 2018-07-26 12:58:07 +03:00
Dmitry Stogov
f950128cd6 Encode parent class name as IS_CONST operand in DECLARE_INHERITED_CLASS and DECLARE_ANON_INHERITED_CLASS opcodes (eliminate FETCH_CLAS
S opcode).
2018-07-25 13:40:47 +03:00
Peter Kokot
8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Nikita Popov
5c4047b339 Deprecate defining a free-standing assert() function
Part of https://wiki.php.net/rfc/deprecations_php_7_3.
2018-07-21 22:34:09 +02:00
Dmitry Stogov
5e8977bd62 Merge zend_class_entry.create_object and zend_class_entry.interface_gets_implemented into the same memory lacation. The first used only by classes, the second only by magic interfaces. 2018-07-12 17:09:40 +03:00
Dmitry Stogov
7d4e18b05d Improved user iterator implementation to reduce zend_class_entry memory consumption and avoid race condition during resolving/caching of user iterator functions of internal classes in ZTS build. 2018-07-12 14:04:14 +03:00
Dmitry Stogov
85ee47eda0 Changed structure of zend_class_entry.trait_aliases and zend_class_entry.trait_precedences to avoid keeping "intermediate" trait references, that are used only during inheritance. 2018-07-11 18:56:10 +03:00
Nikita Popov
04e3523b7d Warn if continue is used on switch
Supersedes RFC https://wiki.php.net/rfc/continue_on_switch_deprecation
by generating a warning instead of deprecating and removing this
functionality.
2018-07-07 11:12:48 +02:00
Dmitry Stogov
4a475a4976 Replace legacy zval_dtor() by zval_ptr_dtor_nogc() or even more specialized destructors.
zval_dtor() doesn't make a lot of sense in PHP-7.* and it's used incorrectly in some places.
Its occurances should be replaced by zval_ptr_dtor() or zval_ptr_dtor_nogc(), or even more specialized destructors.
2018-07-04 19:22:24 +03:00
Kalle Sommer Nielsen
c49f0fd9ac Fixed bug #76501 (Funny message with fatal error) 2018-07-04 03:04:31 +02:00
Dmitry Stogov
28b03f9605 Another fix for bug #63217 2018-07-03 01:09:58 +03:00
Dmitry Stogov
57af94c8b9 Partial revert of 30156d588c 2018-07-02 20:54:44 +03:00
Rudi Theunissen
30156d588c Fixed bug #63217
Don't automatically convert literal string keys to integers on
array access, as we may be dealing with an ArrayAccess object,
rather than a plain array.
2018-07-02 16:41:59 +02:00
Dmitry Stogov
43aca3118a Avoid string comparisons for magic methods (all magic methods start with "__") 2018-07-02 17:03:02 +03:00
Dmitry Stogov
1b80de93b8 Cleanup conditions 2018-06-26 16:18:30 +03:00
Dmitry Stogov
8c22d3e729 Make FETCH_R/IS, FETCH_DIM_R/IS, FETCH_OBJ_R/IS, FETCH_STATIC_PROP_R/IS return TMP_VAR, instead of VAR. 2018-06-25 23:43:23 +03:00
Dmitry Stogov
7f67513ca3 Lazy function copying from op_cache SHM into process memory 2018-06-25 19:53:58 +03:00
Nikita Popov
d04917c7b3 Fixed bug #75218
I've introduced a new CompileError type, from which ParseError
inherits. These errors are not parse errors in the narrow sense
of the term, even though they happen to be generated during
parsing in our implementation. Additionally reusing the ParseError
class for this purpose would change existing error messages (if
the exception is not caught) from a "Fatal error:" to a "Parse
error:" prefix, and also the error kind from E_COMPILE_ERROR to
E_PARSE.
2018-06-16 12:41:03 +02:00
Dmitry Stogov
9e0f131d2b Fixed ISSET/ISEMPTY bit meaning to simplify run-time checks 2018-05-31 19:02:51 +03:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Dmitry Stogov
524f5245c5 Avoid useless checks, using zend_string_efree(), in cases where the string is known to be a temporary allocated zend_string. 2018-05-08 17:30:15 +03:00
Dmitry Stogov
83f98f7340 Don't store values of PHP_SAPI and PHP_BINARY in file cache, because it may be used by different SAPI. 2018-04-28 01:20:49 +03:00
Levi Morrison
0c80cb164f Fix bug #76198 2018-04-14 13:07:44 +02:00
Dmitry Stogov
eb39d8d686 Use cheaper functions 2018-03-15 12:46:19 +03:00
Dmitry Stogov
8afb91cdad PHP scanner optimization 2018-03-14 01:48:17 +03:00
Dmitry Stogov
d1585a9e3f Revert "Handle scanner error in first place (don't hide them from ext/tokenizer) and cheaper whitespace handlig."
This reverts commit 0d6da03f5c.
2018-03-14 01:08:03 +03:00
Dmitry Stogov
0d6da03f5c Handle scanner error in first place (don't hide them from ext/tokenizer) and cheaper whitespace handlig. 2018-03-13 18:42:09 +03:00
Dmitry Stogov
9c0dfd4f10 Get rid of useless SET_UNUSED() 2018-03-13 14:34:48 +03:00
Dmitry Stogov
c7045174f1 Moved compiler helper functions from zend_opcode.c to zend_compile.c 2018-03-13 13:49:58 +03:00
Nikita Popov
7ff186434e Explicitly sort live ranges by start opnum
Instead of moving live ranges around to maintain the start opnum
invariant, add an explicit sorting step in pass two.
2018-02-16 21:51:50 +01:00
Nikita Popov
b0af9ac733 Avoid live range references in opcodes
Don't store the live range of the freed variable for FREE_ON_RETURN
frees, instead look it up at runtime. As this is an extremely
unlikely codepath (in particular, it requires a loop variable with
a throwing destructor), saving the runtime lookup of the live range
is not worth the extra complexity this adds everywhere else.
2018-02-16 21:30:48 +01:00
Gabriel Caruso
2d48d734a2 Fix some misspellings 2018-02-06 16:59:00 +01:00
Nikita Popov
db2475cec2 Fix unused variable compiler warnings 2018-02-05 20:58:15 +01:00
Dmitry Stogov
e0a399f175 One cache slot is enough 2018-02-05 20:40:21 +03:00
Dmitry Stogov
ca035f26aa Moved "zval.u2.cache_slot" into free room of "zend_op" 2018-02-05 19:41:47 +03:00
Dmitry Stogov
3a794d39f0 Avoid repeatable ARG_SHOULD_BE_SENT_BY_REF() checks in FETCH_*FUNC_ARG and following SEND_VAR_EX. Perform the check once in a new CHECK_FUNC_ARG opcode and reuse in the following FETCH_*FUNC_ARG and SEND_FUNC_ARG (SEND_VAR_EX replacement). 2018-02-05 19:40:06 +03:00
Dmitry Stogov
ba298725d1 Changed CATCH instruction format (extended_value moved into op2, op2 into result, result into extended_value) 2018-01-31 22:39:30 +03:00
Dmitry Stogov
9c7fb529ce Changed FETCH_CONSTANT instruction format (extended_value moved into op1) 2018-01-31 18:15:25 +03:00
Dmitry Stogov
f67f455ef7 Changed FETCH_CLASS instruction format (extended_value moved into op1) 2018-01-31 18:14:43 +03:00
Dmitry Stogov
7141631cc8 Change FETCH/ISSET instruction modifiers:
- Get rid of ZEND_ISEMPTY and ZEND_ISSET_ISEMPTY_MASK. Use just single ZEND_ISSET bit to make distinct between isset() and empty()
- Use ZEND_FETCH_GLOBAL, ZEND_FETCH_LOCAL and ZEND_FETCH_GLOBAL_LOCK as bitmask
- Removed unused ZEND_FETCH_STANDARD
- Extended ZEND_FETCH_ARG_MASK
2018-01-30 22:06:05 +03:00
Dmitry Stogov
bf7176c70f Use reference-counting instead of duplication and separation, if really necessary. 2018-01-19 01:03:24 +03:00
Dmitry Stogov
5c77bac9a7 A cheaper way to reset type flags. 2018-01-17 01:58:51 +03:00
timurib
a484b9a535 Fix #75765 Exception on extend of undefined class
As the parent class is fetched prior to binding, there are no
safety concerns in this case and we can replace the fatal error
with an Error exception.
2018-01-12 18:41:39 +01:00
Dmitry Stogov
c9034c3b33 Get rid of zend_op_array.early_binding 2018-01-11 19:15:52 +03:00
Xinchen Hui
4a4602c45c Merge branch 'master' of git.php.net:/php-src
* 'master' of git.php.net:/php-src:
  Happy new year (Update copyright to 2018)
  Happy new year (Update copyright to 2018)
  Revert "Enable ODBC tests on AppVeyor"
  Enable ODBC tests on AppVeyor
  Skip on Travis-CI
  Extend skip section
  2018
  missing changelog entries + fix version and date
  missing changelog entries
  2018
  Trailing whitespaces
2018-01-04 13:45:11 +08:00
Gabriel Caruso
6400264856 Trailing whitespaces
Signed-off-by: Gabriel Caruso <carusogabriel34@gmail.com>
2018-01-03 14:38:00 +01:00
Xinchen Hui
1e22c9a187 Merge branch 'instanceof-const' of https://github.com/nikic/php-src
* 'instanceof-const' of https://github.com/nikic/php-src:
  Return false for instanceof on literal
2018-01-03 16:08:20 +08:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Dmitry Stogov
5c8f8f8fce Use ZEND_FAST_CONCAT instead of ZEND_CONCAT for CONST operands. 2017-12-29 13:54:18 +03:00
Dmitry Stogov
f010423335 Use IS_EQUAL instead of CASE when first operand is CV or CONST. Removed CASE handlers that duplicated IS_EQUAL. 2017-12-29 12:57:58 +03:00
Nikita Popov
b6131364f9 Return false for instanceof on literal 2017-12-19 22:16:45 +01:00
David Walker
6d4de4cf05 Implement list() reference assignments
Support list() reference assignments of the form:

    list(&$a, list(&$b, $c)) = $d;

RFC: https://wiki.php.net/rfc/list_reference_assignment
2017-12-09 13:39:52 +01:00
Dmitry Stogov
6a9d2b2190 Cleanup type conversion 2017-12-07 19:24:55 +03:00
Dmitry Stogov
74c84cd7f0 Use zend_string_equal*() API for zend_string equality check instead of direct memcmp() usage. 2017-12-04 17:17:02 +03:00
Dmitry Stogov
cc12acefcd Use cheaper functions 2017-12-04 13:21:35 +03:00
Dmitry Stogov
92cc7f9fab Merge branch 'PHP-7.2'
* PHP-7.2:
  Set trailing zero
2017-12-01 17:01:10 +03:00
Dmitry Stogov
01b85f0e17 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Set trailing zero
2017-12-01 17:00:51 +03:00
Dmitry Stogov
b73151845f Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Set trailing zero
2017-12-01 17:00:42 +03:00
Dmitry Stogov
24d5adbd5a Set trailing zero 2017-12-01 17:00:11 +03:00
Dmitry Stogov
f98721b4e0 Intern auto global name strings in first place 2017-11-29 17:10:51 +03:00
Nikita Popov
8795893f4f Make sure string property/class const values are interned
This was done for user-definde class constant values, however this
is also important for properties and internal classes.
2017-11-25 17:12:37 +01:00
Dmitry Stogov
33b094479b TYPE_CHECK instruction changed. Now it keeps in extended_value a type mask.
This makes check for "boolean" cheaper and allows check combination e.g. (is_string($a) || is_null($a))
2017-11-23 15:58:34 +03:00
Nikita Popov
9fbb019848 Move adjust_for_fetch_type directly after emission
And drop the distinction between compile_X and compile_X_common.
This avoids WTF moments like compile_simple_var_no_cv completely
ignoring the BP_VAR type passed to it...
2017-11-16 22:28:29 +01:00
Nikita Popov
d9da166649 Minor fetch type adjustment cleanup
No need to call adjust_fetch_type on FETCH_THIS, just to special
case it in adjust_fetch_type...
2017-11-16 22:13:07 +01:00
Dmitry Stogov
7fba7209e1 Fixed memory leak (Zend/tests/list_003.phpt) 2017-11-03 21:02:27 +03:00
Dmitry Stogov
990d8092a4 Reverted incomplete fix and too strict asserts. 2017-11-01 16:18:13 +03:00
Dmitry Stogov
02a05146fd Fixed string interning during constants substitution 2017-11-01 10:56:37 +03:00
Xinchen Hui
a8a17a72b0 RC manipulation cleanup 2017-11-01 10:25:10 +08:00
Dmitry Stogov
d481d495cc Fixed few inconsistent ZVALs in AST produced by compiler (REFCOUNTED and INTERNED strings) 2017-11-01 01:10:21 +03:00
Dmitry Stogov
5dbdc382af Intern file names and class constants in first place (they may be interned later during constant substitution) 2017-10-31 15:36:55 +03:00
Dmitry Stogov
fcc08ce19f Prevent reference-counting on persistent zvals (internal constants, default properties and constants of internal classes).
New macro ZVAL_COPY_OR_DUP() is used perform duplication, if necessary.
This should eliminate related race-coditions in ZTS build and prevent reference-counting bugs after unclean shutdown.
2017-10-30 23:13:10 +03:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00
Dmitry Stogov
9cf87aa196 Avoid HashTable allocations for empty arrays (using zend_empty_array). 2017-10-24 17:27:31 +03:00
Dmitry Stogov
edc7c8ccfa PHP must not create circular arrays when element is assigned by value. 2017-10-12 16:23:45 +03:00
Dmitry Stogov
ef5ea48741 Always use IS_CONSTANT_AST (IS_CONSTANT is removed). 2017-10-10 10:11:05 +03:00
Dmitry Stogov
39ded1d5f8 Changed zend_ast_ref structure to use only one allocation, removing dichotomy between heap/arena ASTs. 2017-10-09 16:57:51 +03:00
Dmitry Stogov
e70618aff6 Changed the way VM accesses constant operands in 64-bit builds. 2017-10-04 16:53:01 +03:00
Dmitry Stogov
44e0b79ac6 Refactored array creation API. array_init() and array_init_size() are converted into macros calling zend_new_array(). They are not functions anymore and don't return any values. 2017-09-20 02:25:56 +03:00
Dmitry Stogov
a80e462fbd Order live ranges according to "start" position 2017-08-14 12:21:07 +03:00
Dmitry Stogov
2fab62271a Revert "Fixed live_range removing (bug can be triggred by JIT)"
This reverts commit aecf996510.
2017-08-14 12:00:02 +03:00
Xinchen Hui
aecf996510 Fixed live_range removing (bug can be triggred by JIT) 2017-08-11 21:56:30 +08:00
Dmitry Stogov
1180d8c801 Separate ISSET_ISEMPTY_CV/UNSET_CV from ISSET_ISEMPTY_VAR/UNSET_VAR 2017-07-17 14:11:50 +03:00
Anatol Belski
bc5811f361 further sync for vim mode lines 2017-07-04 18:12:45 +02:00
Nikita Popov
e5741da85c Fix format arguments
Only dropped one before, both need to go...
2017-06-25 22:32:57 +02:00
Nikita Popov
9dfcb04f10 Fix typo 2017-06-25 22:28:56 +02:00
Michał Brzuchalski
8e10c9d373 Implement object type annotation
RFC: https://wiki.php.net/rfc/object-typehint
2017-06-25 21:49:41 +02:00
Dmitry Stogov
a916bed8f8 Fixed function name resolution 2017-05-30 21:48:16 +03:00
Dmitry Stogov
65edf44291 Check for possible run-time function name resolution 2017-05-30 17:37:54 +03:00