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
Bob Weinand
881c502520
Improve 517b55362
(scope rebinding on method Closures)
...
Now it is completely impossible to rebind a scoped method Closure (only the kind you get from ReflectionMethod::getClosure()) to a foreign scope
Adding a lot of tests to ensure this...
Also, properly return NULL in case the Closure could not be created instead of some crippled unbound Closure
2015-10-05 00:56:55 +02:00
Bob Weinand
517b553625
Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())
...
This additionally removes support for binding to an unknown (not in parent hierarchy) scope.
Removing support for cross-scope is necessary for certain compile-time assumptions (like class constants) to prevent unexpected results
2015-10-04 01:38:59 +02:00
Bob Weinand
e878dff5d8
Revert accidentally committed closures.c and execute.c
2015-09-19 23:22:07 +02:00
Bob Weinand
08e253cdbc
Optimize zend_mm_small_size_to_bin()
...
It removes a cmov operation and has a much faster branch for small allocations (especially when handling strings) (<= 64 bytes)
2015-09-19 23:07:43 +02:00
Bob Weinand
50d6fd6a03
Fixed bug #70397 (Segmentation fault when using Closure::call and yield)
2015-09-01 18:04:19 +02:00
Dmitry Stogov
71af54e5f6
Mark error and exception functions as "cold" (Matt's idea)
2015-08-19 14:40:56 +03: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
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
Rasmus Lerdorf
41774bceff
Fix more minor mistakes in the proto comments
2015-06-23 15:47:33 -04:00
Bob Weinand
3c288b12b4
Fix bad run_time_cache with Closure::call()
...
This also fixes a memory "leak" (memory is allocated on unbounded arena without limits) on each new Closure instantiation.
Closures with same scope now all share the same run_time_cache (as long as it is arena allocated)
2015-06-21 16:39:44 +02:00
Dmitry Stogov
3180b8e100
Fixed bug #69802 (Reflection on Closure::__invoke borks type hint class name) (onr more problem)
2015-06-16 13:29:17 +03:00
Dmitry Stogov
ed84bff445
Complete fix for problems related to bug #69802
2015-06-16 11:24:35 +03:00
Nikita Popov
39753fa222
Merge branch 'PHP-5.6'
...
Preserving HAS_RETURN_TYPE for __invoke() here as well.
Conflicts:
Zend/zend_alloc.c
2015-05-29 11:11:02 +02:00
Nikita Popov
e7d0ca39e5
Preserve VARIADIC flag for Closure::__invoke()
...
The 13 arguments are for the benefit of PHP 7, where the first
twelve use the bitmask.
2015-05-29 11:07:23 +02:00
Stanislav Malyshev
ef8bb69a14
Ban rebinding closures to different internal classes
2015-05-12 10:54:59 +02:00
Nikita Popov
bc2ff4a299
Don't implicitly make closures in static methods static
...
It makes no sense that you can't write a closure using $this in a
static method, even though you can write one outside a class.
Now only closures that have been marked as static will be considered
to be static.
Fixes bug #65598 .
2015-05-06 17:29:05 +02:00
Nikita Popov
d9c2959c27
Fix LSB handling for closures
...
Closures will now use the called_scope from their instantiation
site. If they are rebound either the class of $this is used or if
no $this is provided the bound scope is used.
With this change the scope for static closures can be changed back
to use EG(scope) rather than EX(called_scope), thus fixing
bug #69568 .
2015-05-05 21:14:03 +02:00
Dmitry Stogov
fc80305e48
Cleanup comments and add related tests.
2015-04-23 17:52:05 +03:00
Nikita Popov
018bcc6388
Use temporary debug_info for closures
2015-04-16 15:33:47 +02:00
Dmitry Stogov
1d75953a86
We don't need this protection anymore (now reference counting on closures is accurate).
2015-04-01 13:38:05 +03:00
Dmitry Stogov
acfc31c0f8
Use zend_error_noreturn() for fatal errors
2015-04-01 13:32:23 +03:00
Dmitry Stogov
ed9c8a23ba
More accurate reference counting on closures
2015-03-10 23:04:41 +03:00
Dmitry Stogov
a30d328671
Errors converted to exceptions are not "recoverable" anymore.
2015-03-10 10:31:55 +03:00
Dmitry Stogov
1c94ff0595
Implement engine exceptions
...
RFC: https://wiki.php.net/rfc/engine_exceptions_for_php7
Pending changes regarding naming of BaseException and whether it
should be an interface.
2015-03-09 14:01:32 +01:00
Xinchen Hui
f25419f8e3
Only do this in debug build
2015-02-21 22:44:51 +08:00
Xinchen Hui
865a719a3f
Fixed mem issue with internal return type hinting assert
2015-02-21 22:17:17 +08:00
Dmitry Stogov
5f76eed14e
don't count op_arrays stored in opcache SHM
2015-02-20 14:59:30 +03:00
Dmitry Stogov
e10e151e9b
Merged zend_array and HashTable into the single data structure.
...
Now each HashTable is also zend_array, so it's refcounted and may be a subject for Copy on Write
zend_array_dup() was changed to allocate and return HashTable, instead of taking preallocated HashTable as argument.
2015-02-13 22:20:39 +03:00
Stanislav Malyshev
b64cafdb9e
Merge branch 'PHP-5.5' into PHP-5.6
...
* PHP-5.5:
Added test and possible fix for https://bugs.php.net/bug.php?id=67068
2015-01-31 23:17:24 -08:00
Danack
dbc0a80b23
Added test and possible fix for https://bugs.php.net/bug.php?id=67068
2015-01-31 23:13:55 -08:00
Stanislav Malyshev
e8e0481755
Merge branch 'pull-request/994'
...
* pull-request/994:
Added test and possible fix for https://bugs.php.net/bug.php?id=67068
2015-01-31 23:12:00 -08:00
Dmitry Stogov
638d0cb753
Merge branch 'typed_returns' of github.com:morrisonlevi/php-src into test
...
* 'typed_returns' of github.com:morrisonlevi/php-src:
Implement return types
2015-01-28 06:56:19 +03:00
Levi Morrison
c8576c5a46
Implement return types
...
RFC is documented here: https://wiki.php.net/rfc/return_types
2015-01-27 11:49:56 -07:00
Xinchen Hui
fc33f52d8c
bump year
2015-01-15 23:27:30 +08:00
Xinchen Hui
0579e8278d
bump year
2015-01-15 23:26:37 +08:00
Xinchen Hui
73c1be2653
Bump year
2015-01-15 23:26:03 +08:00
Danack
1397790560
Added test and possible fix for https://bugs.php.net/bug.php?id=67068
2015-01-13 01:24:19 +00:00
Stanislav Malyshev
b7a7b1a624
trailing whitespace removal
2015-01-10 15:07:38 -08:00
Dmitry Stogov
c42ac09518
Added new API function 'zend_string* zend_string_tolower(zend_string*)'.
...
It simplifies code and avoids unnecessary allocation and copying if string is already in lower case.
2014-12-24 15:04:51 +03:00
Dmitry Stogov
2646f7bcb9
Don't count variadic argument in zend_func.common.num_args. This allows faster CALL/RETURN code.
2014-12-22 16:44:39 +03:00
Anatol Belski
bdeb220f48
first shot remove TSRMLS_* things
2014-12-13 23:06:14 +01:00
Dmitry Stogov
3893c1fc3d
Fixed compilation warnings
2014-12-12 21:57:34 +03:00
Guilherme Blanco
094d409b3d
Removed ZEND_ACC_FINAL_CLASS which is unnecessary. This also fixed some currently defined classes as final which were just not being considered as such before.
2014-12-12 17:29:54 +01:00
Dmitry Stogov
5dd427eac2
Use zend_string* for op_array->arg_info[]->name and op_array->arg_info[]->class_name. For internal functions we still use char*.
2014-12-03 16:56:09 +03:00
Nikita Popov
ee5b30fa19
Remove support for classes without class entries
...
get_class_entry must be non-NULL and return non-NULL.
2014-10-09 13:58:14 +02:00
Dmitry Stogov
bd9a234645
Replaced EG(This) and EX(object) with EX(This).
...
Internal functions now recieves zend_execute_data as the first argument.
2014-10-03 19:32:46 +04:00