Commit Graph

792 Commits

Author SHA1 Message Date
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
Dmitry Stogov
7b94b958cc Intern some known (and offten used) strings. 2016-05-12 13:47:22 +03:00
Dmitry Stogov
c19cb70dac Revert "Refactor zval cleanup into single function"
This reverts commit bac6fdb0c5.
2016-05-06 10:47:58 +03: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
Andrea Faulds
660e88c19d Fix bug #71897 2016-05-04 19:26:24 +01:00
Nikita Popov
d048837a46 Drop dead code from update_constant 2016-04-29 22:15:38 +02:00
Nikita Popov
a1c405e0c5 Fix usages of zend_update_constant_ex
If an in-place update in an external zval is performed, it needs
to incref'd beforehand, not afterwards.
2016-04-29 14:06:39 +02:00
Dmitry Stogov
747a482b9c Don't initialize EX(call)->symbol_table on each function call.
Keep it uninitialized, and check ZEND_CALL_HAS_SYMBOL_TABLE flag when necessary.
2016-04-28 15:17:24 +03:00
Dmitry Stogov
6499162ff0 - get rid of EG(scope). zend_get_executed_scope() should be used instead.
- ichanged zval_update_constant_ex(). Use IS_TYPE_IMMUTABLE flag on shared constants and AST, instead of "inline_change" parameter.
2016-04-28 04:13:34 +03:00
Dmitry Stogov
f0a2e8eb13 Removed "zend_fcall_info.function_table". It was assigned in many places, but is never used. 2016-04-27 13:46:38 +03:00
Nikita Popov
89fbce5c5f Mark zend_timeout as noreturn
Otherwise we get a compiler warning...
2016-04-21 23:35:51 +02:00
Dmitry Stogov
650c1c0a7d Safe execution timeout handling. 2016-04-20 13:52:21 +03:00
Joe Watkins
04bd7ab8d3 Merge branch 'PHP-7.0'
* PHP-7.0:
  handle dummy frame
2016-04-11 13:24:54 +01:00
Joe Watkins
c0b821d2e9 handle dummy frame 2016-04-11 13:24:37 +01:00
Xinchen Hui
67476872cd Merge branch 'PHP-7.0' 2016-04-01 22:27:42 +08:00
Xinchen Hui
5b1bb41c0b Fixed bug #71930 (_zval_dtor_func: Assertion `(arr)->gc.refcount <= 1' failed) 2016-04-01 22:27:29 +08:00
Dmitry Stogov
7abfaac901 Merge zend_execute_data->called_scope into zend_execute_data->This.
"called_scope" made sense only for static method calls, for dynamic calls it was always equal to the class of $this.
Now EG(This) may store IS_OBJECT + $this or IS_UNUSED + "called_scope" (of course, "called_scope" may be NULL).
Some code might need to be adopted to support this change.
Checks (Z_OBJ(EX(This))) might need to be converted into (Z_TYPE(EX(This)) == IS_OBJECT).
2016-04-01 16:17:49 +03:00
Dmitry Stogov
fcbe1e8edf Use CALL_INFO flag to check if we need to destroy symbol_table.
This saves one memory load on most RETURN opcodes.
2016-03-31 18:47:25 +03:00
Nikita Popov
c5212da8b5 Merge branch 'PHP-7.0' 2016-03-18 19:31:43 +01:00
Nikita Popov
fd95555107 Fix ZEND_DEBUG condition 2016-03-18 19:31:34 +01:00
Anatol Belski
b360ba651d fix initializer for empty_fcall_info 2016-03-04 10:57:38 +01:00
Dmitry Stogov
c67c166f93 Removed zend_fcall_info.symbol_table 2016-03-02 17:50:55 +03:00
Dmitry Stogov
960b3755b3 Merge branch 'PHP-7.0'
* PHP-7.0:
  PHP-7 zend_call_function() doesn't support symbol_table substitution
2016-03-02 16:57:08 +03:00
Dmitry Stogov
908b662f7f PHP-7 zend_call_function() doesn't support symbol_table substitution 2016-03-02 16:56:39 +03:00
Nikita Popov
9d137f37fc Merge branch 'PHP-7.0' 2016-02-24 14:09:14 +01:00
Nikita Popov
d1057cc139 Fixed bug #71470
Don't report hashtable iterator leaks on unclean shutdown, those
are expected.
2016-02-24 14:09:03 +01:00
Dmitry Stogov
86f54fcdf7 Use special type IS_ERROR instread of EG(error_zval). (we still need EG(error_zval) for SPL support). 2016-01-28 18:00:06 +03:00
Xinchen Hui
97a9470d97 bump year which is missed in rev 49493a2 2016-01-02 17:56:11 +08:00
Xinchen Hui
1d79011fb9 Merge branch 'PHP-7.0' of git.php.net:/php-src into PHP-7.0 2015-12-18 21:40:48 -08:00
Xinchen Hui
eb4ce3f1a8 Fixed bug #71163 (Segmentation Fault: cleanup_unfinished_calls) 2015-12-18 21:40:20 -08:00
Nikita Popov
a917840f38 Fixed iter leak on by-ref foreach over const/tmp array
FE_FREE does not unregister the iter for plain arrays. So always
wrap into a REF wrapper, even if not strictly necessary, in
RESET_RW. Alternatively we could use a flag to distinguish plain
positions and interators.

Also added a check for leaked iterators in shutdown_executor.
2015-12-17 23:21:48 +01:00
Xinchen Hui
b101a6bbd4 Use format string 2015-12-12 18:45:11 -08:00
Taoguang Chen
617698dfe0 Fixed bug #70914 zend_throw_or_error() format string vulnerability 2015-11-14 23:44:59 +01:00
Dmitry Stogov
c6af0aa33f Fixed reference cuntmting for closures (previously we didn't increment reference counter for "internal" closures) 2015-10-09 02:39:07 +03:00
Dmitry Stogov
524d00e005 Revert "Allow random $this on non-internal Closures again"
This reverts commit 35d0405c47.
2015-10-06 23:48:10 +03:00
Bob Weinand
35d0405c47 Allow random $this on non-internal Closures again
As it turns out, there is actually no reason to prevent this, it even was a bigger BC break than expected...

Also fixes a memory leak (the Closure leaks) when calling internal functions via Closure by moving it out of leave helper onto caller side for TOP_CODE:

$z = new SplStack; $z->push(20);
$x = (new ReflectionMethod("SplStack", "pop"))->getClosure($z);
var_dump($x());
2015-10-05 17:49:32 +02:00
Dmitry Stogov
37f0c6b5cb Add myself into list of authors of the most refactored files. 2015-08-31 11:38:16 +03:00
Dmitry Stogov
715d5d2855 Get rid of implicit type casting in GC_*() macros in Zend/zend_types.h.
This prevented compilation warnings and disclosed few incorrect usages in Zend/zend_vm_def.h and ext/dom/xpath.c.
Now explicit type casting may be required on call site.
This may break some C extension code, but it shoulfn't be a problem to add explicit casting.
2015-08-13 13:56:29 +03:00
Anatol Belski
5c98b9972f improve ZEND_TLS declaration even more and move it to the better place 2015-07-28 16:59:53 +02:00
Anatol Belski
e6cbca77f5 use better name 2015-07-28 16:59:52 +02:00
Anatol Belski
d051bff8b6 simplify declaration 2015-07-28 16:59:51 +02:00
Anatol Belski
2ec51faece adjust storage class
It's more convenient do explicitly disable the external linking. Also
it's an improvement from the build access time perspective.
2015-07-28 16:59:49 +02:00
Aaron Piotrowski
5df893ce3c Use NULL where possible for exception class
Matches usage of zend_throw_exception()/zend_throw_exception_ex().
2015-07-07 12:10:55 -05:00
Xinchen Hui
7af4e6d02d Fixed bug #70006 (cli - function with default arg = STDOUT crash output). 2015-07-07 19:21:02 +08:00
Kalle Sommer Nielsen
ce2cd89258 Replace references to PHP_WIN32 and TSRM_WIN32 with ZEND_WIN32 in Zend/, this also fixes 1 instance of where fflush(stderr) was misplaced (zend_extensions.c) 2015-07-04 18:55:22 +02:00
Aaron Piotrowski
02623ddb82 Switch macro with __VA_ARGS__ to function 2015-07-03 17:53:41 -05:00
Aaron Piotrowski
22c38b2ef5 Remove need to pass error level 2015-07-03 17:53:41 -05:00
Aaron Piotrowski
5a99c07ecc Enable throwing custom exceptions from errors 2015-07-03 17:53:40 -05:00
Dmitry Stogov
7aa7627172 Use ZSTR_ API to access zend_string elements (this is just renaming without semantick changes). 2015-06-30 13:59:27 +03:00
Dmitry Stogov
ab4ccffc4c Avoid unnecessary reference counter incrementation on $this when call methods 2015-05-07 16:28:23 +03:00