Commit Graph

11858 Commits

Author SHA1 Message Date
Xinchen Hui
d29bd582a8 Added NEWS Entry 2016-05-28 16:12:10 +08:00
Lauri Kenttä
58302192b7 Test for bug #72221, segfault in zend_memnstr_ex 2016-05-28 16:10:29 +08:00
Lauri Kenttä
287f9489d8 Fix bug #72221 (segfault, past-the-end access) 2016-05-28 16:10:16 +08:00
Xinchen Hui
cbe89e2c6e Merge branch 'fix-72221' of https://github.com/Metabolix/php-src
* 'fix-72221' of https://github.com/Metabolix/php-src:
  Test for bug #72221, segfault in zend_memnstr_ex
  Fix bug #72221 (segfault, past-the-end access)
2016-05-28 16:09:31 +08:00
Dmitry Stogov
2ae21abdf7 Fixed bug #72213 (Finally leaks on nested exceptions).
Squashed commit of the following:

commit 8461b0407f
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:34:42 2016 +0300

    Rmoved zend_try_catch_element.parent and walk through op_array.try_catch_array backward from the current try_cacth_offset.

commit 0c71e24964
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:04:53 2016 +0300

    Move SAVE_OPLINE() to its original place

commit 111432a4df
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed May 25 00:01:10 2016 +0300

    Separate the common part of ZEND_HANDLE_EXCEPTION and FAST_RET into zend_dispatch_try_catch_finally_helper.

commit 4f21c06c2e
Author: Nikita Popov <nikic@php.net>
Date:   Tue May 24 14:55:27 2016 +0200

    Improve finally fix

commit da5c727499
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 10:36:08 2016 +0300

    Fixed Zend/tests/try/bug70228_3.phpt and Zend/tests/try/bug70228_4.phpt

commit cfcedf2fb4
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 02:59:27 2016 +0300

    Added test

commit 4c6aa93d43
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 00:38:20 2016 +0300

    Added tests

commit 8a8f4704b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 23:27:34 2016 +0300

    Fixed bug #72213 (Finally leaks on nested exceptions)
2016-05-25 01:25:12 +03:00
Nikita Popov
91f5940329 Forbid dynamic calls to scope introspection functions
Per RFC:
https://wiki.php.net/rfc/forbid_dynamic_scope_introspection
2016-05-24 20:48:24 +02:00
Nikita Popov
674297c7e4 Allow empty property names
Conflicts:
	Zend/zend_compile.c
2016-05-24 18:34:17 +02:00
Nikita Popov
a19eb8e34a Ensure no entry predecessors for SSA construction 2016-05-24 18:29:45 +02:00
Lauri Kenttä
ad98f573f6 Test for bug #72221, segfault in zend_memnstr_ex 2016-05-24 17:40:29 +03:00
Dmitry Stogov
9b27df8df5 Fixed white-spaces 2016-05-24 12:37:20 +03:00
Dmitry Stogov
0cdbabe558 Merge branch 'nullable_types' of github.com:morrisonlevi/php-src
* 'nullable_types' of github.com:morrisonlevi/php-src:
  Fix bug #71428
  Add nullable parameter types
  Implement nullable return types.
2016-05-23 10:14:26 +03:00
Lauri Kenttä
26fa27d760 Fix bug #72221 (segfault, past-the-end access) 2016-05-21 18:46:00 +03:00
Bob Weinand
4f077aee83 Allow for [] = $array; (alias for list()) 2016-05-20 01:51:05 +02:00
Dmitry Stogov
14a71cf545 Added and fixed tests related to "finally" handling 2016-05-19 13:22:46 +03:00
Dmitry Stogov
88196e9151 Added specialized handler for ZEND_FETCH_DIM_R opcode with only numeric indexes. 2016-05-18 15:06:49 +03:00
Dmitry Stogov
cef8d93edd Fixed typo 2016-05-18 11:29:02 +03:00
Nikita Popov
14023d39c1 Move builtin_ctzl portability into zend_bitset.h
Use this function in both zend_mm_bitset_find_one and
zend_bitset_first.

Maybe zend_bitset.h is not quite the right place for it, but I did
not want to include this in a globally included header like
zend_long.h or zend_portability.h.
2016-05-17 22:23:43 +02:00
Nikita Popov
b65b15c6f4 Mark assert() as INDIRECT_VAR_ACCESS
I don't like this... we may want to detect "obviously not string"
operands by checking for the result of a comparison instruction.
2016-05-17 16:13:17 +02:00
Xinchen Hui
37b1226af1 Merge branch 'master' of git.php.net:/php-src
* 'master' of git.php.net:/php-src:
  Inlined fast paths of the freqently execute handlers for FETCH_DIM_R.
2016-05-17 20:28:26 +08:00
Xinchen Hui
fad91468db Revert "Fixed Bug #72213 (Finally leaks on nested exceptions)"
This reverts commit 5037ebf058.
2016-05-17 20:27:16 +08:00
Dmitry Stogov
c466df6813 Inlined fast paths of the freqently execute handlers for FETCH_DIM_R. 2016-05-17 15:08:04 +03:00
Dmitry Stogov
34a6c93b25 Specialize ZEND_ASSIGN_ADD and family according to value of opline->extended_value 2016-05-17 11:46:25 +03:00
Xinchen Hui
5037ebf058 Fixed Bug #72213 (Finally leaks on nested exceptions) 2016-05-17 15:32:43 +08:00
Dmitry Stogov
8f7b1a3248 IS_CONST operands don't have to be separated. Use reference-counting instead of duplication.
- with opcache all IS_CONST operands are not refcounted (scalars, interned strings or immutable arrays)
- without opcache IS_CONST operands are not shared between processes or threads and may use common reference counters
2016-05-17 08:45:06 +03:00
Dmitry Stogov
1fe7b3bca1 micro-optimisation 2016-05-17 02:09:29 +03:00
Dmitry Stogov
97bf4e0b12 Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function 2016-05-16 12:42:13 +03:00
Dmitry Stogov
054446a25f Extend CAL_FLAGS from 8-bit to 16-bit 2016-05-16 12:41:24 +03:00
Dmitry Stogov
414c4c6776 Revert "Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function."
This reverts commit a9b517c614.
2016-05-16 11:51:29 +03:00
Dmitry Stogov
a9b517c614 Check if generator object is created by GENERATOR_CREATE when throw exceptions from generator function. 2016-05-16 10:24:13 +03:00
Anatol Belski
41518d255e fix dir separator 2016-05-14 23:48:04 +02:00
Nikita Popov
6079ba4b0c Inference: Fix undef handling for binary ops
We need to be careful about correctly handling that undef results
in a null value. Otherwise, apart from simply generating incorrect
results, we may also end up performing non-monotonic lattice
transitions, thus causing an infinite type inference loop (see
test).
2016-05-14 17:16:32 +02:00
Sara Golemon
7594fd0cfa Check in generated lexer
This should have been included with my previous diff implementing octal overflow warning.
Ooops.
2016-05-14 04:31:39 +00:00
Sara Golemon
95af467d8d Raise compiler warning on octal overflow
Addresses https://bugs.php.net/bug.php?id=71994
2016-05-14 00:20:32 +00:00
Dmitry Stogov
be071702b3 Fixed bug #72188 (Nested try/finally blocks losing return value) 2016-05-13 14:38:43 +03:00
Dmitry Stogov
e9c3f9fcde Fixed bug #72177 (Scope issue in __destruct after ReflectionProperty::setValue()) 2016-05-13 11:55:09 +03:00
Dmitry Stogov
ccf18da450 Eliminated checks for (func->op_array.fn_flags & ZEND_ACC_GENERATOR) in fast path of DO_FCALL* handlers.
This slightly improves calls to regular function and method calls in cost of a bit slower generator initialization.
Separate call frame for generators, allocated on heap, now created by ZEND_GENERATOR_CREATE instruction.
2016-05-13 01:40:15 +03:00
Nikita Popov
b1c3c9a525 Explicitly construct phi set during def propagation
Previously the phi set was first computed during def propagation
and then computed again (per-block) during actual phi placement.
This commit changes this to store the phi set computed during
def propagation.

This makes SSA construction slightly faster (5%), but the main
purpose here is to pave the way for the next commit.

This also fixes a potential issue with the handling of irreducible
loops -- they generated additional phis, but these were not
accounted for in def propagation. (Though I'm not sure if we can
even have any irreducible loops right now.)
2016-05-12 22:08:28 +02:00
Anatol Belski
aea0d577f9 Merge branch 'PHP-7.0'
* PHP-7.0:
  fix dir separator in test
2016-05-12 20:38:02 +02:00
Anatol Belski
f751b1ceaf fix dir separator in test 2016-05-12 20:37:04 +02:00
Dmitry Stogov
4652fe18c7 Removed useless code 2016-05-12 16:46:37 +03:00
Dmitry Stogov
7b94b958cc Intern some known (and offten used) strings. 2016-05-12 13:47:22 +03:00
Sara Golemon
8523b1f8ed Merge branch 'PHP-7.0'
* PHP-7.0:
  Fix serializing ZEND_AST_SHELL_EXEC
2016-05-12 02:51:14 +00:00
Sara Golemon
a73b03edea Fix serializing ZEND_AST_SHELL_EXEC
Currently, `foo` is reserialized as `'foo'` due to misuse of zend_ast_export().
ZEND_AST_SHELL_EXEC can only contain ZEND_AST_ZVAL(string) or ZEND_AST_ENCAPS_LIST,
so just handle the ZEND_AST_ZVAL(string) case directly.
2016-05-12 02:47:56 +00:00
Dmitry Stogov
8a7a913a7a Use main VM stack for generators. Only single call frame for generator itself is allocated on heap, call frames for nested functions are allocated on main VM stack. In case "yield" used in context of another function call, call stack has to be frozen and then restored. 2016-05-12 00:44:18 +03:00
Dmitry Stogov
515a61069a Added test 2016-05-11 12:55:33 +03:00
Anatol Belski
208c28f152 Merge branch 'PHP-7.0'
* PHP-7.0:
  fix handle leak
2016-05-10 20:03:27 +02:00
Anatol Belski
0718aa5833 Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
  fix handle leak
2016-05-10 20:02:17 +02:00
Anatol Belski
6b63d80a7a fix handle leak 2016-05-10 19:59:48 +02:00
Nikita Popov
e6d4a9e2d2 Don't HT_ASSERT rc=1 in zend_hash_apply functions
These are not necessarily used to modify the hash. Move the assert
into the APPLY_REMOVE branch only.
2016-05-10 12:14:08 +02:00
Xinchen Hui
9e404927a6 Merge branch 'PHP-7.0' 2016-05-07 22:05:05 -07:00
Xinchen Hui
b62f7e338d Remove unnecessary strlen check 2016-05-07 22:04:31 -07:00
Xinchen Hui
69adf2370e Fixed test 2016-05-07 22:04:20 -07:00
Xinchen Hui
455eabcd2c Merge branch 'PHP-7.0' 2016-05-07 00:08:35 -07:00
Xinchen Hui
29079f263e Strlen cleanup (additions for previous one fix)
Probably compilers will do similar optimization
2016-05-07 00:08:15 -07:00
Xinchen Hui
2c992032ce Merge branch 'PHP-7.0' 2016-05-06 23:54:48 -07:00
Xinchen Hui
f7439afeda Merge branch 'PHP-5.6' into PHP-7.0
Conflicts:
	Zend/zend_strtod.c
2016-05-06 23:52:48 -07:00
Xinchen Hui
1c7f608071 Fixed bug #72172 (zend_hex_strtod should not use strlen) 2016-05-06 23:52:06 -07:00
Dmitry Stogov
cca2c8ecc4 Reimplemented Bob's commit bac6fdb0c5 without insignificant renaming and white-space changes 2016-05-06 10:47:58 +03:00
Dmitry Stogov
37c8711f49 Fixed typo 2016-05-06 10:47:58 +03:00
Dmitry Stogov
c19cb70dac Revert "Refactor zval cleanup into single function"
This reverts commit bac6fdb0c5.
2016-05-06 10:47:58 +03:00
Xinchen Hui
4cd9cf8257 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed test
  Revert "Fix bug #72162 (again)"
2016-05-06 10:53:25 +08:00
Xinchen Hui
080f6b10ec Fixed test 2016-05-06 10:51:38 +08:00
Xinchen Hui
441d1b8ef0 Revert "Fix bug #72162 (again)"
The problem is because we release p->value too early

and later you try to convert an object to string, which is a fatal error

then leave p->value double free, change to expect long is a BC break

This reverts commit 8e5b381004.
2016-05-06 10:45:44 +08:00
Bob Weinand
bac6fdb0c5 Refactor zval cleanup into single function
Also use zval_ptr_dtor_nogc() everywhere in Zend in favor of zval_dtor()
2016-05-05 23:31:57 +02:00
Levi Morrison
56c3d75780 Fix bug #71428
This also affects bug #72119
2016-05-05 11:53:32 -06:00
Levi Morrison
9662259cb9 Add nullable parameter types
This works off of Dmitry's commit for nullable return types
2016-05-05 11:53:32 -06:00
Dmitry Stogov
49fe737e58 Implement nullable return types. 2016-05-05 09:34:16 -06:00
Nikita Popov
59f35c0ca9 Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_builtin_functions.c
2016-05-05 17:31:25 +02:00
Nikita Popov
8e5b381004 Fix bug #72162 (again)
Not sure what the previous fix was supposed to do. The issue was
that error_reporting() simply assumes that the value must either
be an integer or a string.

Fixed by using zpp properly.
2016-05-05 17:28:52 +02:00
Dmitry Stogov
26adba38bc Micro-optimization 2016-05-05 16:19:59 +03:00
Xinchen Hui
badf1edffd Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72162 (use-after-free - error_reporting)
2016-05-05 11:02:34 +08:00
Xinchen Hui
9191862121 Fixed bug #72162 (use-after-free - error_reporting) 2016-05-05 11:02:21 +08:00
Andrea Faulds
660e88c19d Fix bug #71897 2016-05-04 19:26:24 +01:00
Nikita Popov
bfef17ab65 Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_compile.c
2016-05-04 18:43:55 +02:00
Nikita Popov
9af0c96af4 Fix bug #72159 2016-05-04 18:43:11 +02:00
Joe Watkins
8bec3dae94 Merge branch 'master' of https://github.com/php/php-src 2016-05-04 17:05:05 +01:00
Joe Watkins
3048092f5b Merge branch 'PHP-7.0'
* PHP-7.0:
  correct wording
2016-05-04 17:04:49 +01:00
Joe Watkins
a17e4187e7 correct wording 2016-05-04 17:04:38 +01:00
Dmitry Stogov
b91197c8a3 Inlined fast path 2016-05-04 17:33:35 +03:00
Joe Watkins
dc78e02ad2 Merge branch 'PHP-7.0'
* PHP-7.0:
  add compiler option to disable builtins (special case function calls)
2016-05-04 10:54:29 +01:00
Joe Watkins
9bbee305e3 add compiler option to disable builtins (special case function calls) 2016-05-04 10:53:59 +01:00
Joe Watkins
c38310f25a change fcall and statement handlers to accept frame 2016-05-04 09:28:13 +01:00
Nikita Popov
d06431bf1b Merge branch 'PHP-7.0' 2016-05-03 18:15:29 +02:00
Nikita Popov
fbae590bf0 Fix leaks in QM_ASSIGN, JMP_SET and COALESCE
The QM_ASSIGN code was rewritten to use the standard pattern for
handling CVs and VARs.
2016-05-03 18:12:56 +02:00
Xinchen Hui
d08df44425 Merge branch 'PHP-7.0'
* PHP-7.0:
  Mark fcc as initialized for object calls
2016-05-03 11:13:41 +08:00
Bob Weinand
b4c5009220 Mark fcc as initialized for object calls
This results in 1% speedup (cycle count) on some real world applications
2016-05-03 02:07:06 +02:00
Nikita Popov
0ce7189265 Merge branch 'PHP-7.0'
Conflicts:
	Zend/zend_constants.c
2016-05-02 20:04:24 +02:00
Nikita Popov
ec7c3c22b6 Fix leak in zend_get_constant_ex 2016-05-02 19:59:43 +02:00
Joe Watkins
5e10735d07 improve test coverage of multicatch 2016-05-02 18:48:50 +01:00
Bob Weinand
7c174b6197 Fix use after free on AST expressions in constant declarations 2016-05-02 18:22:15 +02:00
Nikita Popov
014fd895a1 Merge branch 'PHP-7.0' 2016-05-02 11:58:31 +02:00
Nikita Popov
d5a38280be Drop dup declare with inconsistent linkage
This is already declared in zend_stream.h as ZEND_API.
2016-05-02 11:56:28 +02:00
Nikita Popov
9b99a1c9fb Fix compile warning in ast.c 2016-05-02 11:55:49 +02:00
Pierrick Charron
0aed2cc2a4 Allow catching multiple exception types in a single catch statement
This commit add the possibility to catch multiple exception types in
a single catch statement to avoid code duplication.

try {
	   // Some code...
} catch (ExceptionType1 | ExceptionType2 $e) {
	   // Code to handle the exception
} catch (\Exception $e) {
	   // ...
}
2016-05-01 18:47:08 -04:00
Anatol Belski
770a6d1342 Merge branch 'PHP-7.0'
* PHP-7.0:
  fix test if unlink fails occasionally
  fix dir separator in test
2016-05-01 19:27:13 +02:00
Anatol Belski
81e62e66d6 fix dir separator in test 2016-05-01 19:05:02 +02:00
Nikita Popov
6a9a0f2090 Merge branch 'PHP-7.0' 2016-05-01 13:05:28 +02:00
Nikita Popov
d0069ca6c1 Fix ('\bar')() in namespace 2016-05-01 13:05:14 +02:00
Bob Weinand
f59de7ea36 Export zend_pass_function to allow comparisons against it 2016-04-30 20:46:52 +02:00
Nikita Popov
0615c59a4f Mark all $php_errormsg as refs to inhibit optimization 2016-04-30 12:34:01 +02:00