Commit Graph

8708 Commits

Author SHA1 Message Date
Dmitry Stogov
de306e7088 Implement call_user_func() and call_user_func_array() using special opcodes.
In some rare cases it leads to insignificant changes in error messages.
2014-07-11 00:32:18 +04:00
Dmitry Stogov
4e291fab81 Fixed usage after free() 2014-07-10 21:45:09 +04:00
Dmitry Stogov
d81b287ce1 Fixed delayed closure destruction and reference support 2014-07-10 18:36:11 +04:00
Dmitry Stogov
c85c795e46 Imporoved EXPECTED/UNEXPECTED macros to support not boolean expressions.
Fixed invalid EXPECTED() usage.
2014-07-09 19:32:09 +04:00
Dmitry Stogov
19729aa7fe Use data stored in current call frame instead of EG() if possible 2014-07-09 17:07:41 +04:00
Dmitry Stogov
9d6e45a0ee Changed zend_make_printable_zval() to return "use_copy" instead of additional reference argument.
Improved branch prediction.
2014-07-09 16:05:55 +04:00
Dmitry Stogov
d87140d8d8 Added missed warning (ext/spl/tests/iterator_035.phpt) 2014-07-09 13:30:47 +04:00
Dmitry Stogov
1dd07d6bf4 Partial fix that allows internal constructors to set $this to null.
The address of $this passed to drectly called internal constructor in execute_data->return_value.
Internal constructors should use ZEND_CTOR_MAKE_NULL() macro (insted of previous ZEND_NULL(EG(This))) to do the work.

This patch doesn't fix the problem for indirectly called constructors. e.g. parant::__construct().
2014-07-09 11:57:42 +04:00
Xinchen Hui
549c5a5c1b Mismatched folder marks 2014-07-08 17:53:13 +08:00
Dmitry Stogov
9b9d60a480 Specify HashTable size and optimize inserts that may not conflict 2014-07-08 13:46:03 +04:00
Dmitry Stogov
0abd626269 code cleanup 2014-07-08 13:24:23 +04:00
Dmitry Stogov
73679bf6db Another fix for uninitialized execute_data->symbol_table 2014-07-08 12:17:52 +04:00
Xinchen Hui
e5fed097cc Fixed uninitialized symbol_table 2014-07-08 14:43:20 +08:00
Dmitry Stogov
b36aaea6ed ZEND_SEND_VAR and ZEND_SEND_VAL specialization 2014-07-08 02:13:53 +04:00
Dmitry Stogov
d9585f019f Skip useless ZEND_RECV opcodes 2014-07-07 22:18:48 +04:00
Dmitry Stogov
21acbd5b75 Avoid useless check 2014-07-07 21:33:53 +04:00
Dmitry Stogov
7d0b21d3bc Function can't be "interactive" 2014-07-07 21:33:09 +04:00
Dmitry Stogov
2ed8a17045 Refactored run_time_cache usage in object handlers 2014-07-07 20:54:31 +04:00
Dmitry Stogov
bce6a36c8a Merge branch 'master' into test
* master: (48 commits)
  change locale - looks like not everybody has sl_SI
  Fix bug #66921 - Wrong argument type hint for function intltz_from_date_time_zone
  fix format
  Fix bug #67052 (NumberFormatter::parse() resets LC_NUMERIC setting)
  Make sure the generator script also creates a newline at the end of file
  Add newline at end of file to prevent compilation warning
  Fix handling of session user module custom handlers.
  Reference bug report instead of github issue in NEWS file
  add more exts for Travis
  Update NEWS
  Fix phpdbg.1 man page installation when build != src directory
  BFN for bug #67551 (php://input temp file will be located in sys_temp_dir instead of upload_tmp_dir)
  reorder
  restore API compatibility
  finish
  refactor php_stream_temp_create{,_ex} and use it for the php://input stream
  refactor _php_stream_fopen_{temporary_,tmp}file()
  fix length overflow of HTTP_RAW_POST_DATA
  Update NEWS
  Fixed bug #67215 (php-cgi work with opcache, may be segmentation fault happen)
  ...

Conflicts:
	ext/opcache/zend_accelerator_util_funcs.c
	ext/session/mod_user.c
	ext/spl/spl_array.c
	ext/spl/spl_dllist.c
	ext/standard/file.c
	ext/standard/streamsfuncs.c
	ext/standard/string.c
	main/streams/memory.c
2014-07-07 19:21:23 +04:00
Dmitry Stogov
477bd49cca Wrong expectation in tests (for some reason backtraces contained invlalid extra frame at the top) 2014-07-07 18:09:17 +04:00
Dmitry Stogov
4dd7c63d1e Wrong expectation in test (The error "Non-static method A::A_ftk() should not be called statically" is reported on caller side, so backtrace shouldn't include call to A::A_ftk()). 2014-07-07 17:27:16 +04:00
Dmitry Stogov
2f316a775d Wrong expectation in test (for some reason backtrace misses gc_collect_cycles() call) 2014-07-07 17:17:42 +04:00
Dmitry Stogov
70a112e51b Wrong expectation in test (wrong line number in backtrace) 2014-07-07 16:57:05 +04:00
Dmitry Stogov
7ce2d59ad2 Merge branch 'call-frame' into phpng
* call-frame:
  Simplify call-frame handling
  Removed EG(active_symbol_table) and use corresponding value from EG(current_execute_data)
  Use values from current_execute_data instead of globals where possible
  Removed EG(called_scope) and use corresponding value from EG(current_execute_data)
  Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something.
  Removed EG(opline_ptr) and use corresponding value from EG(current_execute_data)
  Removed EG(active_op_array) and use corresponding value from EG(current_execute_data)
  Uinified call frame handling for user and internal functions. Now EG(current_execute_data) always point to the call frame of the currently executed function.
  Fixed cleanup of incompleytely passed parameters
  Prohibited parameter redefinition
  Fixed support for extra arguments in conjunction with variadiv argument. Use compile time flags to check if we call constructor and result of ZEND_NEW is used or not.
  Fixed uninitialized variables
  Optimization
  Changed zend_execute_data layout to reduce memory overhead
  Help C compilet to do the better job optimizing target code
  Use fast comparison for (func->type == ZEND_USER_FUNCTION || func->type == ZEND_EVAL_CODE)
  Keep extra args in the same VM stack segment (after all CV and TMP vars)
  Refactoring: merge call_frame and end_execute_data into single data structure. Keep only single copy of each argument on VM stack (previously ZE kept two copies of each arguments for user functions)
  Refactoring: use call_frames instead of call_slots

Conflicts:
	Zend/zend_vm_def.h
	Zend/zend_vm_execute.h
2014-07-07 16:19:24 +04:00
Dmitry Stogov
5aa91be509 Simplify call-frame handling 2014-07-07 15:50:44 +04:00
Nikita Popov
439a95908b Fix leak when generator return value is not used 2014-07-05 15:07:25 +02:00
Nikita Popov
2d4c962c61 Fix ZTS build 2014-07-05 14:12:20 +02:00
Dmitry Stogov
6bf24f4dd0 Removed EG(active_symbol_table) and use corresponding value from EG(current_execute_data) 2014-07-04 18:03:45 +04:00
Dmitry Stogov
d2890963e4 Use values from current_execute_data instead of globals where possible 2014-07-04 17:03:44 +04:00
Dmitry Stogov
c4d99ec982 Removed EG(called_scope) and use corresponding value from EG(current_execute_data) 2014-07-03 02:34:43 +04:00
Dmitry Stogov
0a77dcd4b9 Removed EG(in_execution). If EG(currentent_execute_data) is not NULL we are executing something. 2014-07-03 01:02:25 +04:00
Dmitry Stogov
63c057e331 Removed EG(opline_ptr) and use corresponding value from EG(current_execute_data) 2014-07-02 23:29:53 +04:00
Dmitry Stogov
4b09dd69e6 Removed EG(active_op_array) and use corresponding value from EG(current_execute_data) 2014-07-02 22:03:21 +04:00
Dmitry Stogov
412ad4b254 Uinified call frame handling for user and internal functions.
Now EG(current_execute_data) always point to the call frame of the currently executed function.
2014-07-02 22:01:25 +04:00
Nikita Popov
ac552cccc1 Merge branch 'PHP-5.6' 2014-07-02 17:37:25 +02:00
Nikita Popov
1ea4b17af2 Merge branch 'PHP-5.5' into PHP-5.6 2014-07-02 17:36:27 +02:00
Nikita Popov
d9ebd0f3d6 Fix bug #67497: eval with parse error causes segfault in generator 2014-07-02 17:33:31 +02:00
Bob Weinand
6b0beb9df1 Merge branch 'PHP-5.6' 2014-07-02 17:26:44 +02:00
Bob Weinand
1163a7ce24 Mark test as XFAIL until fixed 2014-07-02 17:25:47 +02:00
Bob Weinand
c01dcd325d Merge branch 'PHP-5.6' 2014-07-02 12:44:30 +02:00
Bob Weinand
33699a4dab Messed up syntax of tests 2014-07-02 12:43:27 +02:00
Bob Weinand
0870cc8a7c Merge branch 'PHP-5.6' 2014-07-02 12:35:06 +02:00
Bob Weinand
09d1a8aaab Add tests for constant expression arrays
Adding one failing (!) test for now about circular constant references embedded in a constant AST, must be fixed before PHP 5.6 release.
2014-07-02 12:33:46 +02:00
Xinchen Hui
1d1226afa2 Suppress warning "cast from pointer to integer of different size" 2014-07-01 10:36:19 +08:00
Dmitry Stogov
acfbb7b6dc Merge branch 'master' into test
* master: (67 commits)
  remove the NEWS entry for the reverted fpm fix
  remove the NEWS entry for the reverted fpm fix
  remove the NEWS entry for the reverted fpm fix
  Revert "Fix Bug #67530 	error_log=syslog ignored"
  --enable-fpm for the travis build
  fix the last fpm NEWS entry, the other bug is related, but not the same what we fixed here
  NEWS
  NEWS
  Fix bug #67091: make install fails to install libphp5.so on FreeBSD 10.0
  adding NEWS entry for the fix for bug #65641
  Updated NEWS file for recent phpdbg fixes
  Fixed issue krakjoe/phpdbg#94 - List behavior is inconsistent
  Fix issue krakjoe/phpdbg#97 - list now appends a newline if there is none The prompt should always ensure it is on a newline
  Fixed test
  Inform about back command existence in help - Fixes krakjoe/phpdbg#100 No way to list the current stack/frames
  Fix issue krakjoe/phpdbg#98 break if does not seem to work
  Fix issue krakjoe/phpdbg#99 register function has the same behavior as run
  Fix readline/libedit (Thanks to @remicollet)
  Replace incorrect `E` command with `ev` in watch help
  Fix typo in `finish` help
  ...

Conflicts:
	Zend/zend_ast.c
	Zend/zend_highlight.c
	Zend/zend_indent.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
	ext/standard/info.c
2014-07-01 00:19:41 +04:00
Dmitry Stogov
8c9b3e664c Merge branch 'PHP-5.6'
* PHP-5.6:
  Fixed possible crash because of race conditions on modifying constants in shared memory
2014-07-01 00:17:55 +04:00
Dmitry Stogov
2330be5641 Fixed possible crash because of race conditions on modifying constants in shared memory 2014-07-01 00:13:34 +04:00
Dmitry Stogov
b7715c7e8a Refactored parameter passing mechanism.
In PHP-5.6 and below each argument passed to user function was copies on VM stack twice.
Now we always have ZEND_INIT_FCALL (or simular) opcode that pushes "call frame" on top of VM stack.
"Call frame" is actually the same zend_execute_data structure.
All the following ZEND_SEND instructions push arguments on top of the stack in a way that they directly comes into corresponding CV variables of the called frame. Extra arguments are copied at the end of stack frame (after all CV and TMP variables) on function enterance.

There are two minor incompatibilities:
1) It's not allowed to decalre functions redefining arguments e.g. "function foo($a,$a) {}".
2) func_get_arg() and func_get args() return the current value of argument and not the original value that was sent.
2014-06-30 15:43:45 +04:00
Xinchen Hui
7614fe810e C++ doesn't allow implicitly convert void * to other pointer type 2014-06-28 11:19:38 +08:00
Xinchen Hui
f609d8c1c6 C++ compiler doesn't allow cast a void * to other pointer type 2014-06-27 12:35:34 +08:00