Commit Graph

11263 Commits

Author SHA1 Message Date
Nikita Popov
bbae7ddf29 Fixed bug #70681 2015-10-09 23:01:23 +02:00
Dmitry Stogov
0847681b1a Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure()) 2015-10-09 11:48:13 +03: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
93748bf9dd Fixed infinity recurion if we create closure on top of other closure. 2015-10-09 02:37:51 +03:00
Dmitry Stogov
05bd331c6a Fixed use after free 2015-10-09 01:09:22 +03:00
Dmitry Stogov
91fb3a7b27 Fixed bug #70674 (ReflectionFunction::getClosure() leaks memory when used for internal functions) 2015-10-09 00:45:02 +03:00
Nikita Popov
cc3c425af8 Fix bug #70662
This replaces add_new with update for the RW case. This should not
be problematic for performance, as this branch throws a notice.

Alternatively add_new could also be replaced with add. I went with
update, because it makes $a[0] += 1 behavior the same as
$a[0] = $a[0] + 1.
2015-10-08 11:03:39 +02:00
Márcio Almada
ddb6d7801e Fix bug #70650 2015-10-07 16:25:59 +02:00
Dmitry Stogov
b8b335c492 Restored the original (php-5) behavior of convert_to_cstring(). It was broken in php7 by mistake and caused problems in ext/pgsql/tests/bug46408.phpt. 2015-10-07 04:26:26 +03:00
Dmitry Stogov
e0b3b3c752 Revert "Fixed bug #70630 (Closure::call/bind() crash with ReflectionFunction->getClosure())"
This reverts commit 517b553625.
2015-10-06 23:59:36 +03:00
Dmitry Stogov
e193d35c1e Revert "Improve 517b55362 (scope rebinding on method Closures)"
This reverts commit 881c502520.
2015-10-06 23:48:15 +03:00
Dmitry Stogov
24e88348f3 Revert "Merge branch 'array_keys_strict_refs' of https://github.com/tony2001/php-src"
This reverts commit a6be0f3fd6.
2015-10-06 23:48:12 +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
Dmitry Stogov
3c0348056a Revert "Speed up self::method() calls (no ZEND_FETCH_CLASS)"
This reverts commit 8c33bdb976.
2015-10-06 23:48:08 +03:00
Dmitry Stogov
5a49ac77aa Revert "Speed up self::$property access by 20%"
This reverts commit 0fbd3e5fe7.
2015-10-06 23:48:04 +03:00
Rasmus Lerdorf
fb2c890c2c zend.assertions is not a boolean 2015-10-06 17:13:38 +09:00
Bob Weinand
0fbd3e5fe7 Speed up self::$property access by 20% 2015-10-05 21:52:09 +02:00
Bob Weinand
8c33bdb976 Speed up self::method() calls (no ZEND_FETCH_CLASS) 2015-10-05 21:16:52 +02: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
a6be0f3fd6 Merge branch 'array_keys_strict_refs' of https://github.com/tony2001/php-src 2015-10-05 14:50:04 +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
Xinchen Hui
2fb8bb1157 Fixed bug #70632 (Third one of segfault in gc_remove_from_buffer) 2015-10-03 20:33:24 -07: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
6c61286da4 Do not include zend_verify_return_type in executable ops (phpdbg) 2015-10-02 12:37:39 +02:00
Nikita Popov
8557e8323a Remove checks for read_property retval being NULL
read_property uses &EG(uninitialized_zval) instead.
2015-10-01 16:33:30 +02:00
Nikita Popov
c25e81ab7b Remove dead assignment in get_property_guard 2015-10-01 16:28:28 +02:00
Dmitry Stogov
64a79817ce Reordered field to improve data lacality and reduce L1D CPU cache misses in ZEND_INIT_FCALL opcode family 2015-09-30 16:22:56 +03:00
Xinchen Hui
45cb42f49f Simply use 0/1 instead as dmitry suggested 2015-09-30 10:41:27 +08:00
Xinchen Hui
df2ff75116 Make ZEND_ECHO and removed ZEND_PRINT distinguishable 2015-09-29 21:50:15 +08:00
Dmitry Stogov
ca36b7bc13 Added zend_internal_function.reserved[] fields, to allow extensions keep additional associated information.
We didn't have zend_internal_function.reserved[] in PHP5, but we always allocated space for zend_function union, and extensions were able to reuse zend_function.op_array.reserved[] even for internal function. Now this is not possible. And extensions have to use zend_function.op_array.reserved[] for user functions and zend_function.internal_function.reserved[] for internal.
2015-09-29 13:31:47 +03:00
Dmitry Stogov
560e4fa393 Removed or simplified incorrect SEPARATE_*() macros usage. 2015-09-29 11:17:43 +03:00
Dmitry Stogov
7e797f1302 Allow an experimental VM with tail call dispatch technique (disabled by default).
This VM may work only if all tail calls are optimized, otherwaise it will crach because of stack overflow.
Unfortunately, we can't guarantee tail call optimization in C.
2015-09-25 12:54:51 +03:00
Dmitry Stogov
a05fc48055 Extended zend_extension API to allow storing additional data associated with op_arrays in opcache SHM. (op_array->reserved[]) 2015-09-25 11:50:38 +03:00
Bob Weinand
abf6a0b376 Fix missing LOAD_OPLINE() for ZEND_USER_OPCODE_LEAVE 2015-09-24 21:06:07 +02:00
Bob Weinand
808f62bb4d Ensure proper exception handling and EX(opline) state in USER_OPCODE handler 2015-09-24 20:33:57 +02:00
Anatol Belski
29bf529d88 fix warning 2015-09-24 16:33:53 +02:00
Dmitry Stogov
62c96059a2 Fixed memory leak. 2015-09-23 23:16:30 +03:00
Bob Weinand
4a174ca7e6 Fixed bug #70532 (respect set_exception_handler in phpdbg) 2015-09-23 17:53:29 +02:00
Joe Watkins
1a5d6acff6 ZEND_COMPILE_GUARDS compiler option 2015-09-23 15:33:57 +02:00
Dmitry Stogov
a6509a6fdd Fixed test 2015-09-23 13:18:30 +03:00
Xinchen Hui
1e3333e4bd Fixed Bug #70557 (Memleak on return type verifying failed) 2015-09-23 14:10:23 +08:00
Xinchen Hui
504cd492e1 Fixed bug #70548 (Redundant information printed in case of uncaught engine exception) 2015-09-23 13:04:33 +08:00
Xinchen Hui
a9636ff5a2 Fixed bug #70555 (fun_get_arg() on unsetted vars return UNKNOW)
and also keep the indices of func_get_args(). since they are similar
issue of #70574, thus reuse its test script.
2015-09-23 10:00:20 +08:00
Dmitry Stogov
f9ec5be888 Properly cleanup on wrong ZEND_OVERLOADED_FUNCTION call 2015-09-22 23:51:30 +03:00
Dmitry Stogov
c49d3189b1 Cleanup: removed comments (zend_object.handle and zend_resource.handle are not going to be removed in PHP-7.0) 2015-09-22 15:56:52 +03:00
Dmitry Stogov
04bcce3c15 Cleanup (we keep and reuse size from zend_mm_huge_list) 2015-09-22 15:51:02 +03:00
Dmitry Stogov
c61604b9a9 Fixed reporting about repeatable "huge" memory leaks. 2015-09-22 15:46:41 +03:00
Xinchen Hui
0f3ab1c2d0 Fixed #70547 similar bug in func_get_args 2015-09-22 13:58:42 +08:00
Xinchen Hui
e1dcfd2cf9 Fixed bug #70547 (unsetting function variables corrupts backtrace) 2015-09-22 11:59:35 +08:00
Xinchen Hui
b0e5f9eb6c Unused var 2015-09-19 19:51:53 -07:00
Xinchen Hui
bb07905a4a Fixed bug #70528 (assert() with instanceof adds apostrophes around class name) 2015-09-19 19:49:36 -07:00
Bob Weinand
c9988a1e69 Remove superfluous branches 2015-09-20 02:59:30 +02:00
Bob Weinand
95dbe1d03e Short-circuit zend_parse_parameters_none() so that expensive zpp() call never happens in non-exceptional case 2015-09-20 02:43:22 +02:00
Bob Weinand
14af0f6dcb Set expectations in generator handling 2015-09-20 02:19:31 +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
b8f56013b5 Force compiler to prefer ZEND_CALL_NESTED_FUNCTION
It is by far the most used branch; compilers tended here to split the branches via an &2, &1 check, now it only does an &3 check and prefers ZEND_CALL_NESTED_FUNCTION branch
2015-09-19 19:49:44 +02:00
Xinchen Hui
7680194a93 Fixed bug #70481 (Memory leak in auto_global_copy_ctor() in ZTS build) 2015-09-18 17:27:39 +08:00
Xinchen Hui
517c59bfcb Suppressed warning -Wvolatile-register-var 2015-09-15 08:23:21 -07:00
Dmitry Stogov
927d68db24 Avoid reallocations 2015-09-14 23:04:27 +03:00
Bob Weinand
b0174a14c0 Fixed bug #70478 (**= does no longer work)
Reordered ZEND_(ASSIGN_)POW opcodes in zend_vm_def.h so that it won't be missed in future
2015-09-12 00:54:48 +02:00
Dmitry Stogov
51aa1b5a1d Manual CSE to avoid double read 2015-09-11 14:13:41 +03:00
Xinchen Hui
4ddeeb49a5 Remove free_string_zval 2015-09-11 10:58:24 +08:00
Dmitry Stogov
1b8bf059c4 Don't keep dangling pointer. 2015-09-10 20:03:42 +03:00
Xinchen Hui
66643f6192 Use efree_size 2015-09-10 16:22:07 +08:00
Xinchen Hui
213b49620d Simplfy zend_is_true 2015-09-10 16:13:22 +08:00
Xinchen Hui
f3e8675d38 Added folder marks 2015-09-10 15:01:28 +08:00
Xinchen Hui
7a0e68b97c Unexpected 2015-09-10 14:57:22 +08:00
Xinchen Hui
6852f9cd43 cleanup tmp_member handling 2015-09-10 14:39:25 +08:00
Dmitry Stogov
c174e4cd73 Change array sorting implementation to avoid two level callbacks system.
Simplify zval comparion API.
2015-09-10 02:51:23 +03:00
Dmitry Stogov
2ea18cd431 Better array_compare improvement 2015-09-09 15:11:03 +03:00
Dmitry Stogov
ac83eaef10 Don't inline "slow" and rarely used functions. 2015-09-09 13:42:35 +03:00
Dmitry Stogov
b1be126788 Avoid useless EG(exception) checks 2015-09-09 11:54:44 +03:00
Xinchen Hui
98bf9156d5 unused var 2015-09-09 15:11:42 +08:00
Dmitry Stogov
c7dffb5673 Don't inline "Undefined variable" warning reporting. 2015-09-09 03:18:52 +03:00
Dmitry Stogov
aa3fd8c849 Fixed typo that might cause serious bugs in MM. May be it was the reason of bug #70392 (SIGSEGV during PHP shutdown). 2015-09-08 17:22:26 +03:00
Dmitry Stogov
bfab74d574 Check EG(exception) only if it's really necessary 2015-09-08 17:20:52 +03:00
Márcio Almada
c08b3922dd adds missing tokens to list of semi-reserved words and regenerates test suite 2015-09-04 15:02:50 +02:00
Xinchen Hui
d5b78cec64 We should keep one refcount to resource 2015-09-02 22:14:48 -07:00
Xinchen Hui
6815c08e29 Fixed bug #70398 (SIGSEGV, Segmentation fault zend_ast_destroy_ex) 2015-09-02 22:07:29 -07:00
Xinchen Hui
1cfd12d618 Use ZSTR_VAL 2015-09-02 23:36:13 +08:00
Xinchen Hui
362f787b75 Merge branch 'fix-dtrace-phpdbg' of https://github.com/reeze/php-src 2015-09-02 23:28:51 +08:00
Dmitry Stogov
6848cb3f63 Use regular huge pages instead of anonymous if available. 2015-09-02 15:55:41 +03:00
Dmitry Stogov
111bd5d8c4 Introduced additional check. Its miss might be the reason of bug #70392 (SIGSEGV during PHP shutdown) 2015-09-02 13:05:12 +03:00
Stanislav Malyshev
9b1a224d4e Merge branch 'PHP-5.6'
* PHP-5.6: (21 commits)
  fix unit tests
  update NEWS
  add NEWS for fixes
  Improve fix for #70172
  Fix bug #70312 - HAVAL gives wrong hashes in specific cases
  fix test
  add test
  Fix bug #70366 - use-after-free vulnerability in unserialize() with SplDoublyLinkedList
  Fix bug #70365 - use-after-free vulnerability in unserialize() with SplObjectStorage
  Fix bug #70172 - Use After Free Vulnerability in unserialize()
  Fix bug #70388 - SOAP serialize_function_call() type confusion
  Fixed bug #70350: ZipArchive::extractTo allows for directory traversal when creating directories
  Improve fix for #70385
  Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
  Fix bug #70385 (Buffer over-read in exif_read_data with TIFF IFD tag byte value of 32 bytes)
  Fix bug #70219 (Use after free vulnerability in session deserializer)
  Fix bug ##70284 (Use after free vulnerability in unserialize() with GMP)
  Fix for bug #69782
  Add CVE IDs asigned (post release) to PHP 5.4.43
  Add CVE IDs asigned to #69085 (PHP 5.4.39)
  ...

Conflicts:
	ext/exif/exif.c
	ext/gmp/gmp.c
	ext/pcre/php_pcre.c
	ext/session/session.c
	ext/session/tests/session_decode_variation3.phpt
	ext/soap/soap.c
	ext/spl/spl_observer.c
	ext/standard/var.c
	ext/standard/var_unserializer.c
	ext/standard/var_unserializer.re
	ext/xsl/xsltprocessor.c
2015-09-02 00:37:20 -07:00
Bob Weinand
50d6fd6a03 Fixed bug #70397 (Segmentation fault when using Closure::call and yield) 2015-09-01 18:04:19 +02:00
Joe Watkins
a8a3b02fd9 fix for --enable-zend-signals and ZTS
temporary fix to make queue size bigger in zend_signal while I work on it
2015-09-01 16:51:40 +01:00
Joe Watkins
ccba374faf Merge branch 'master' of https://github.com/php/php-src 2015-09-01 11:00:45 +01:00
Joe Watkins
85a511d2c1 fix zend signal and tsrm compat 2015-09-01 09:34:54 +01:00
Dmitry Stogov
bb4b50636c Fixed one more problem related to bug #70187 (Notice: unserialize(): Unexpected end of serialized data) 2015-09-01 10:39:00 +03:00
Dmitry Stogov
66770f9c37 Added missing set of fcc->initialized flag. 2015-09-01 03:15:50 +03:00
Dmitry Stogov
89aa1b7392 Ensure proper data alignment 2015-08-31 13:56:42 +03:00
Dmitry Stogov
37f0c6b5cb Add myself into list of authors of the most refactored files. 2015-08-31 11:38:16 +03:00
Anatol Belski
d7cd2d7bd6 fix possible overflow 2015-08-29 20:14:07 +02:00
Anatol Belski
0245d6c6a3 use non deprecated symbols 2015-08-29 20:12:31 +02:00
Nikita Popov
ccec609b82 Fix bug #62441
These checks were introduced by 8646d9afce
back when name resolution was working differently.
2015-08-28 19:00:05 +02:00
Nikita Popov
7f2261d24a Fix HT_ASSERT ht->nInternalPointer checks
The & was on the wrong side...
2015-08-28 18:59:46 +02:00
Dmitry Stogov
127db5a37d HANDLE_BLOCK_INTERRUPTIONS() is not used by SAPIs anymore. It may be useful only when PHP configured with --enable-zend-signals. 2015-08-28 16:10:07 +03:00
Dmitry Stogov
87f0f77105 Simplified integer overflow checks 2015-08-28 12:47:21 +03:00
Dmitry Stogov
5d15d2b26d Removed useless signal protection 2015-08-28 12:39:18 +03:00
Dmitry Stogov
745753eacb Prevent double load on fast path (manual common subexpression elimination) 2015-08-27 23:02:15 +03:00
Anatol Belski
b795ce6de5 make overflow checks as unexpected
it's supposed to mark an error case
2015-08-26 21:12:41 +02:00
Dmitry Stogov
e549ebdb23 Mark parse error functions as cold 2015-08-26 18:29:42 +03:00
Dmitry Stogov
942747cc3e Removed unused functions 2015-08-26 18:29:23 +03:00
Anatol Belski
95073c8429 fix year in the header 2015-08-26 17:10:23 +02:00
Anatol Belski
d40a149ade fix typo 2015-08-26 16:39:46 +02:00
Anatol Belski
c867b510df include range checks with the portability header 2015-08-26 16:39:45 +02:00
Anatol Belski
e2ce37be6a added basic stuff with the zend_range_check.h 2015-08-26 16:39:44 +02:00
Dmitry Stogov
25f9e25526 Fixed bug #70187 (Notice: unserialize(): Unexpected end of serialized data) 2015-08-26 03:27:05 +03:00
Bob Weinand
c1e9bd27fe Fix zend_vm_call_opcode_handler (e.g. Generators throwing exceptions) with IP/FP registers 2015-08-26 00:25:25 +01:00
Dmitry Stogov
9d31b29705 Avoid array duplication 2015-08-25 22:40:33 +03:00
Dmitry Stogov
2482325b3d Assign CPU registers for GOTO and SWITCH executor as well 2015-08-25 02:38:06 +03:00
Dmitry Stogov
f9f568aa1e In 95% cases we initialize "empty" array (with 8 hash slots). 2015-08-24 22:07:28 +03:00
Dmitry Stogov
db5898c9e5 Optimize fast path 2015-08-24 12:47:06 +03:00
Xinchen Hui
f56534e4b9 Fixed Bug #70332 (Wrong behavior while returning reference on object)
This fix is actually made for array acessing bug fix (#70262) which is
discarded since we have another better fix, anyway now seems this is still useful
2015-08-23 20:17:51 +08:00
Xinchen Hui
55f88141c5 Re-Fixed bug #70321 (Magic getter breaks reference to array property) 2015-08-23 11:42:33 +08:00
Xinchen Hui
e26a04f9ec Revert "Fixed bug #70321 (Magic getter breaks reference to array property)"
This reverts commit 66754585f8.
2015-08-23 10:40:28 +08:00
Bob Weinand
66754585f8 Fixed bug #70321 (Magic getter breaks reference to array property)
Note that the UNEXPECTED(zv) was turned into EXPECTED(zv), as zv is mostly set in the context where it is used and usually anyway is checked first with OP*_TYPE == IS_VAR; or maybe just completely remove that (UN)EXPECTED at this place...
2015-08-22 23:54:59 +01:00
Bob Weinand
76e3e99dd6 Fix issues with phpdbg SIGINT handler
Also fix valgrind warnings in allocator when not using mmap()ed memory
2015-08-21 23:36:31 +01:00
Bob Weinand
5ece3ec71c Fix bogus traces with ReflectionGenerator::getTrace() 2015-08-20 23:24:28 +02:00
Nikita Popov
ef7d822c32 Remove path from test 2015-08-20 12:58:36 +02:00
Nikita Popov
186b0f3770 Don't allow leading \ in group use decl list
We recently added support for "use \Foo\{Bar}". This commit drops
support for the reverse "use Foo\{\Bar}". Those two got mixed up
in the initial implementation.
2015-08-20 11:47:43 +02:00
Dmitry Stogov
30dcb2d662 Fixed typo 2015-08-19 19:15:30 +03:00
Dmitry Stogov
c97427ea8e Fixed typo in proper place 2015-08-19 15:45:39 +03:00
Dmitry Stogov
3350faf7e4 Fixed typo 2015-08-19 15:15:17 +03:00
Dmitry Stogov
71af54e5f6 Mark error and exception functions as "cold" (Matt's idea) 2015-08-19 14:40:56 +03:00
Dmitry Stogov
9b1570a378 Removed deprecated comments and added expectations (overloaded properties and array elements are less frequently used than regular ones) 2015-08-19 12:21:14 +03:00
Márcio Almada
7568d5cb89 fixes a syntactical inconsistency with group use and leading \
discussion: http://news.php.net/php.internals/87774
2015-08-18 19:23:58 -03:00
Joe Watkins
784dd715e4 Fix mangled property names on anon classes 2015-08-18 16:37:38 +01:00
Xinchen Hui
3ea8c3cf1c Fixed memleak in Zend/tests/bug39297 2015-08-18 21:46:02 +08:00
Xinchen Hui
e543769fa4 Fixed bug #70288 (Apache crash related to ZEND_SEND_REF) 2015-08-18 21:45:19 +08:00
Bob Weinand
34834c58fa Fixed bug #70293 (Crash with specific assertions and zend.assertions=-1) 2015-08-18 15:01:24 +02:00
Julien Pauli
9a138b47c9 Removed unused code 2015-08-18 14:33:04 +02:00
Bob Weinand
a1c9c318ea Woops, accidentally made TS build fail... 2015-08-18 14:04:48 +02:00
Bob Weinand
501407aa49 Revert fix for nicer truncation on log_errors_max_len 2015-08-18 14:01:18 +02:00
Xinchen Hui
75198c7371 Merge branch 'master' of git.php.net:php-src 2015-08-18 19:07:26 +08:00
Bob Weinand
c83cbdf6ce Better fix for exception traces truncation with anon classes 2015-08-18 12:48:06 +02:00
Xinchen Hui
8df3461086 Improved fix for bug #70262 2015-08-18 18:07:31 +08:00
Xinchen Hui
cf9cdf97db Merge branch 'master' of git.php.net:php-src 2015-08-18 18:07:25 +08:00
Xinchen Hui
14ea398d78 It should not be skip 2015-08-18 18:04:26 +08:00
Xinchen Hui
685fee75a5 Skip the test with valgrind 2015-08-18 18:03:34 +08:00
Dmitry Stogov
d9a9b8572b Revert "Do not truncate exception traces upon anon class name"
This reverts commit b0c77fb80c.
2015-08-18 12:03:04 +03:00
Michael Wallner
17fc5cc65d fix inheritance of internal interfaces with constants 2015-08-18 08:20:12 +02:00
Bob Weinand
b0c77fb80c Do not truncate exception traces upon anon class name 2015-08-18 03:27:56 +02:00
Dmitry Stogov
ce89fd9758 Fixed bug #70262 (Accessing array crashes PHP 7.0beta3) 2015-08-17 12:58:14 +03:00
Tjerk Meesters
0bd7d7a369 Merge branch 'PHP-5.6'
* PHP-5.6:
  Updated NEWS for #70157
  Fixed #70157 parse_ini_string() segmentation fault with INI_SCANNER_TYPED
2015-08-15 16:49:30 +08:00
Tjerk Meesters
0d7159d26d Fixed #70157 parse_ini_string() segmentation fault with INI_SCANNER_TYPED 2015-08-15 15:10:34 +08:00
Nikita Popov
6366679906 Executed file can be NULL
So revert this part to what it was originally.
2015-08-14 17:16:45 +02:00
Nikita Popov
2af19fb50a Fix leak in previous commit
Turns out zend_update_property_str already does the copy implicitly.
2015-08-14 17:04:33 +02:00
Nikita Popov
13567d5dee Don't copy zend_strings during exception creation
Minor optimization...
2015-08-14 16:16:27 +02:00
Xinchen Hui
a094f4faed Remove useless insert 2015-08-14 17:09:27 +08:00
Dmitry Stogov
57a8620761 Set expectations 2015-08-14 10:59:39 +03:00
Xinchen Hui
66866fb838 Simplify the macro (HT_DATA_SIZE/HT_HASH_SIZE is not used outside Zend) 2015-08-13 23:38:39 +08:00
Xinchen Hui
cf12da4f33 Fixed similar issues(segfault on OOM) 2015-08-13 23:02:51 +08:00
Xinchen Hui
ded3a44cfd Fixed segfault while OOM in pack_to_hash 2015-08-13 22:42:18 +08: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
Xinchen Hui
adf0e49912 zend_hash_resize seems useless, use zend_hash_extend 2015-08-13 12:19:35 +08:00
Xinchen Hui
a089ce0cc6 Fixed bug #70258 and #70253 2015-08-13 12:08:57 +08:00
Xinchen Hui
0f68f12d95 Use the same error msg with resize 2015-08-12 16:46:57 +08:00
Xinchen Hui
d75228e201 We should not silently go on if the required size can not be met 2015-08-12 16:44:51 +08:00
Xinchen Hui
60b75eb9ed Revert "We should not silently go on if the required size can not be met."
This reverts commit d2bcdec980.
2015-08-12 16:44:18 +08:00
Xinchen Hui
d2bcdec980 We should not silently go on if the required size can not be met. 2015-08-12 16:40:59 +08:00
Anatol Belski
1a2c5bc180 second part fixing vc14, type/specifier order also in definitions 2015-08-12 08:52:08 +02:00
Xinchen Hui
121409865b use efree_size here 2015-08-12 11:15:09 +08:00
Dmitry Stogov
fef086d113 Revert "Simplify ZEND_EXIT and count boolean values to it as exit status"
This reverts commit 7c003948c6.
2015-08-12 02:58:21 +03:00
Dmitry Stogov
9e290a44f1 Attempt to fix Windows build (vc14) 2015-08-12 02:47:37 +03:00
Bob Weinand
7c003948c6 Simplify ZEND_EXIT and count boolean values to it as exit status 2015-08-11 22:36:47 +02:00
Bob Weinand
dbd8edbbd0 Fixed bug #70241 (Skipped assertions affect Generator returns) 2015-08-11 22:12:06 +02:00
Steven Hilder
de5d4d7b42 Add test: unmangling private properties in anon class instances 2015-08-06 16:56:05 +00:00
Steven Hilder
7ecb761818 Allow property names from anonymous classes to be unmangled 2015-08-06 15:18:14 +00:00
Dmitry Stogov
90cb3bb7de Reduce memory usage by using bitsets instead of array of bytes. 2015-08-06 15:41:50 +03:00
Dmitry Stogov
6d681876ee Get rid of memcpy() in MAKE_NOP() 2015-08-06 15:40:40 +03:00
Stanislav Malyshev
feeb2fba93 fix merge 2015-08-04 23:51:55 -07:00
Stanislav Malyshev
3e416bba90 fix merge 2015-08-04 16:46:53 -07:00
Stanislav Malyshev
54daa5317f Merge branch 'PHP-5.6'
* PHP-5.6:
  __wakeup doesn't have to be final
2015-08-04 16:14:32 -07:00
Stanislav Malyshev
97047e7665 Merge branch 'PHP-5.6'
* PHP-5.6:
  update NEWS
  fix test
  update NEWS
  Fix bug #70019 - limit extracted files to given directory
  Do not do convert_to_* on unserialize, it messes up references
  Fix #69793 - limit what we accept when unserializing exception
  Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
  Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
  ignore signatures for packages too
  Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
  Fixed bug #69892
  Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
  Improved fix for Bug #69441
  Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
  Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
  Fix bug #70081: check types for SOAP variables

Conflicts:
	Zend/zend_exceptions.c
	ext/date/php_date.c
	ext/openssl/openssl.c
	ext/phar/phar_internal.h
	ext/soap/php_http.c
	ext/spl/spl_array.c
	ext/spl/spl_dllist.c
	ext/spl/spl_observer.c
	ext/standard/tests/serialize/bug69152.phpt
	sapi/cli/tests/005.phpt
2015-08-04 16:14:24 -07:00
Stanislav Malyshev
568a35f84f Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  __wakeup doesn't have to be final
2015-08-04 16:13:53 -07:00
Stanislav Malyshev
f2f8ea9ac5 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  __wakeup doesn't have to be final
2015-08-04 16:13:43 -07:00
Stanislav Malyshev
f1acac154a __wakeup doesn't have to be final 2015-08-04 16:13:26 -07:00
Stanislav Malyshev
ed709d5aa0 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  fix test
  update NEWS
  Fix bug #70019 - limit extracted files to given directory
  Do not do convert_to_* on unserialize, it messes up references
  Fix #69793 - limit what we accept when unserializing exception
  Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
  Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
  ignore signatures for packages too
  Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
  Fixed bug #69892
  Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
  Improved fix for Bug #69441
  Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
  Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
  Fix bug #70081: check types for SOAP variables

Conflicts:
	ext/soap/php_http.c
	ext/spl/spl_observer.c
2015-08-04 15:29:13 -07:00
Stanislav Malyshev
69ed3969dd Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Fix bug #70019 - limit extracted files to given directory
  Do not do convert_to_* on unserialize, it messes up references
  Fix #69793 - limit what we accept when unserializing exception
  Fixed bug #70169 (Use After Free Vulnerability in unserialize() with SplDoublyLinkedList)
  Fixed bug #70166 - Use After Free Vulnerability in unserialize() with SPLArrayObject
  ignore signatures for packages too
  Fix bug #70168 - Use After Free Vulnerability in unserialize() with SplObjectStorage
  Fixed bug #69892
  Fix bug #70014 - use RAND_bytes instead of deprecated RAND_pseudo_bytes
  Improved fix for Bug #69441
  Fix bug #70068 (Dangling pointer in the unserialization of ArrayObject items)
  Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref)
  Fix bug #70081: check types for SOAP variables

Conflicts:
	.gitignore
	ext/date/php_date.c
	ext/spl/spl_array.c
	ext/spl/spl_observer.c
2015-08-04 14:10:57 -07:00
Stanislav Malyshev
51f9a00b47 Merge branch 'PHP-5.4' into PHP-5.4.44
* PHP-5.4:
  Fixed bug #69892
  Adjust Git-Rules
2015-08-04 14:04:24 -07:00
Dmitry Stogov
668ecaa606 Fixed bug #70098 (Real memory usage doesn't decrease) 2015-08-04 18:21:05 +03:00
Dmitry Stogov
5202ba5a3e Fixed possible access to uninitialized data (prevents valgrind issues in Zend/tests/bug70089.phpt) 2015-08-04 10:48:32 +03:00
Dmitry Stogov
58596897e9 Get rid of ZEND_FAST_CALL_UNBOUND 2015-08-04 08:35:40 +03:00
Dmitry Stogov
a16aa4c42c Move most "finally" related code-generation from pass_two() to compiler. 2015-08-04 07:42:28 +03:00
Nikita Popov
743801054d Try to fix finally issue 2015-08-04 07:42:28 +03:00
Bob Weinand
d8fe645db4 Fix valgrind errors in phpdbg
Revert "We cannot safely assume that all op array will be refcount 0 after execution"
This reverts commit b6936adb58.

This change turns out to not have been a clever idea and was causing more weirdness than it helped...
2015-08-04 00:00:10 +02:00
Bob Weinand
9e246a73ef Fixed bug #70182 (Segfault in ZEND_ASSIGN_OP handlers) 2015-08-02 19:08:39 +02:00
Hugh Davenport
2a1a8f9ea7 Fixed bug #70183 null pointer deref (segfault) in zend_eval_const_expr 2015-08-02 16:51:23 +02:00
Anatol Belski
ee2e169108 Fixed bug #69896 'asm' operand has impossible constraints
Given it's an issue with 32-bit gcc-4.8, asm is disabled for the
breaking parts.
2015-08-02 09:25:24 +02:00
Stanislav Malyshev
4d2278143a Fix #69793 - limit what we accept when unserializing exception 2015-08-01 22:02:26 -07:00
Nikita Popov
7fc04937f5 Fixed bug #69892 2015-08-01 20:47:43 -07:00
Bob Weinand
2d6f0e4584 Fix bug #70179 ($this refcount issue) 2015-08-01 20:35:56 +02:00
Anatol Belski
7be9e69eaf remove useless ifdefs
the most outer block already tell's it's ZTS code
2015-07-31 19:09:36 +02:00
Anatol Belski
b604716fb6 Fixed bug #70108 sometimes empty $_SERVER['QUERY_STRING']
auto_globals_jit is the reason every thread needs a copy. Otherwise
every thread will operate on the master values which can't end good.
2015-07-31 13:32:39 +02:00
Bob Weinand
ac87657d42 Implicit return should be always on the last line of a function 2015-07-31 02:44:42 +02:00
Anatol Belski
ffa341de59 add macro to access globals as whole 2015-07-30 09:05:08 +02:00
Xinchen Hui
3eabf2bf19 "This" is C++ keyword 2015-07-30 11:30:34 +08:00
Bob Weinand
d45d5271f7 Fix bug #70164 (__COMPILER_HALT_OFFSET__ under namespace is not defined) 2015-07-29 19:18:29 +02:00
Anatol Belski
859507c9af add one more thread storage specifier to allow external link 2015-07-29 17:26:52 +02:00
Anatol Belski
c17289e59c fix thread safety 2015-07-29 17:26:51 +02:00
Anatol Belski
43cdfd9a82 add unified globals accessor macro 2015-07-29 10:36:29 +02:00
Anton Blanchard
fd8fb17be8 Improve performance of PowerPC64 fast_long_add_function
Detecting overflow with the XER is slow, partially because we have to
clear it before use.

PHP already has a fast way of detecting overflow in its fallback
c implementation. Overflow only occurs if the signs of the two
operands are the same and the sign of the result is different.
Furthermore, leaving it in c allows gcc to schedule the instructions
better.

This is 9% faster on a POWER8 running a simple testcase:

<?php
        function testcase($count = 100000000) {
		$x = 1;
                for ($i = 0; $i < $count; $i++) {
                        $x = $x + 1;
                        $x = $x + 1;
                        $x = $x + 1;
                        $x = $x + 1;
                        $x = $x + 1;
                }
        }

        testcase();
?>
2015-07-29 09:22:38 +02:00
Xinchen Hui
7d5fb7bbf3 Fixed bug #69674 (SIGSEGV array.c:953) 2015-07-29 10:46:12 +08:00
Anton Blanchard
4d578f28df Improve performance of PowerPC64 fast_long_increment_function
Detecting overflow with the XER is slow, partially because we have to
clear it before use.

gcc does a better job of detecting overflow of an increment or decrement
than we can with inline assembly. It knows that an increment will only
overflow if it is one less than the overflow value. This means we end
up with a simple compare/branch. Furthermore, leaving it in c allows gcc
to schedule the instructions better.

This is 6% faster on a POWER8 running a simple testcase:

<?php
        function testcase($count = 100000000) {
		$x = 1;
                for ($i = 0; $i < $count; $i++) {
                        $x++;
                        $x++;
                        $x++;
                        $x++;
                        $x++;
                }
        }

        testcase();
?>
2015-07-28 18:38:23 +02:00
Anton Blanchard
305199a131 Improve performance of PowerPC64 ZEND_SIGNED_MULTIPLY_LONG
Detecting overflow with the XER is slow, partially because we have to
clear it before use. We can do better by using a trick where we compare
the high 64 bits of the result with the low 64 bits shifted right
63 bits.

This is 7% faster on a POWER8 running a simple testcase:

<?php
        function testcase($count = 100000000) {
                for ($i = 0; $i < $count; $i++) {
                        $x = 1;
                        $x = $x * 2;
                        $x = $x * 2;
                        $x = $x * 2;
                        $x = $x * 2;
                }
        }

        testcase();
?>
2015-07-28 18:38:23 +02: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
0c08ba8be4 add ZEND_THREAD specifier 2015-07-28 16:59:50 +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
Julien Pauli
a28115ccdb Fix for #70159 - Better magic constants substitution 2015-07-28 16:30:08 +02:00
Xinchen Hui
0bddc18619 Fixed bug #70156 (Segfault in zend_find_alias_name) 2015-07-28 16:39:58 +08:00
Xinchen Hui
5ac6b8bcc6 Always checks for exception before push call frame 2015-07-28 16:06:06 +08:00
Xinchen Hui
4e9674f1a3 Previously fix is not right 2015-07-28 14:54:53 +08:00
Xinchen Hui
df23dd78a5 Revert "Attempt to fix bug35437.phpt fails"
This reverts commit 16d6dfddef.
2015-07-28 14:54:20 +08:00
Xinchen Hui
ef04c5c584 Revert "re-generate zend_vm_execute.h"
This reverts commit 4b6d4a1214.
2015-07-28 14:54:12 +08:00
Xinchen Hui
4b6d4a1214 re-generate zend_vm_execute.h 2015-07-28 11:15:57 +08:00
Xinchen Hui
45ea83ba97 Merge branch 'master' of git.php.net:php-src 2015-07-28 11:07:24 +08:00
Xinchen Hui
16d6dfddef Attempt to fix bug35437.phpt fails 2015-07-28 11:06:52 +08:00
Bob Weinand
33a91f57e9 Set CG(zend_lineno) to beginning for final class errors/ops 2015-07-28 00:57:49 +02:00
Stanislav Malyshev
e488690d95 Fix bug #70121 (unserialize() could lead to unexpected methods execution / NULL pointer deref) 2015-07-26 17:10:24 -07:00
Nikita Popov
a717acd21a Fix RECV_VARIADIC literal compacting wrt cache slot 2015-07-26 21:22:31 +02:00
Bob Weinand
7ca85d8875 Fully fix typed generator returns 2015-07-24 22:04:05 +02:00
Bob Weinand
2eb845d0fa Fix bug using not set temporary with typed generator returns 2015-07-24 20:31:18 +02:00
Bob Weinand
13525328ed Cleanup shutdown, enable proper memory leak displaying
phpdbg should not memory leak...
2015-07-24 17:17:26 +02:00
Xinchen Hui
0f1e87d9c1 Fixed bug #70124 (null ptr deref / seg fault in ZEND_HANDLE_EXCEPTION) 2015-07-24 15:49:36 +08:00
Xinchen Hui
0a5bbbdc92 Merge branch 'master' of git.php.net:php-src 2015-07-23 11:18:50 +08:00
Xinchen Hui
a123876b4e Fixed bug #70117 (Unexpected return type error) 2015-07-23 11:16:10 +08:00
Bob Weinand
531fa70ba8 Opcache is assuming that op_arrays without refcount are always efree()d
We maybe should search for some other way, because just not refcounting the op_array is rather a dirty hack.
If possible, we should change opcache and just expect op_array->refcount != NULL ... but I have not found a clean way yet.
2015-07-22 23:16:50 +02:00
Bob Weinand
b6936adb58 We cannot safely assume that all op array will be refcount 0 after execution
Some extensions may want to analyze or re-run the op array later
2015-07-22 17:16:16 +02:00
Nikita Popov
cff6cbc01f Emit EXT_STMT for each statement
I'm excluding unticked statements for this (in 5.x they were included)
as this would just result in two consecutive EXT_STMTs.

Also add all class statements to unticked statements, these would
generate superfluous EXT_STMT/TICKS in the parent op_array.
2015-07-22 13:38:42 +02:00
Nikita Popov
7c661bd304 Remove FAST_CALL_FROM_CATCH
This was generated for a return from a try block with both a catch
and a finally. However at this point no exception can be active,
because it either didn't exist in the first place or was explicitly
discarded using DISCARD_EXCEPTION.
2015-07-21 21:13:34 +02:00
Bob Weinand
2141ab9be5 Fix bug #70106 (Inheritance by anonymous class) 2015-07-21 20:34:06 +02:00
Bob Weinand
81a2c43d5e Add an option to not generate INIT_FCALL ops for user functions too 2015-07-21 16:39:49 +02:00
Nikita Popov
94fb5391e7 Remove bogus exception_save() from FETCH_CLASS
There can't be no exception at the start of the op. Also would miss
the corresponding exception_restore().
2015-07-20 22:56:51 +02:00
Anatol Belski
3de0ae5477 fix two clang errors on Windows 2015-07-19 20:06:31 +02:00
Nikita Popov
0039a3e96f Fixed signed/unsigned warnings in wddx
Also added extra const annotation to zend_memnstr.
2015-07-17 17:19:23 +02:00
Xinchen Hui
2c048afd3b Donot use one_char_string 2015-07-17 16:09:11 +08:00
Xinchen Hui
91e5b30a3b Merge branch 'master' of git.php.net:php-src 2015-07-17 15:56:28 +08:00
Xinchen Hui
7d07afd6c1 Fixed bug #70089 (segfault at ZEND_FETCH_DIM_W_SPEC_VAR_CONST_HANDLER ()) 2015-07-17 15:55:34 +08:00
Nikita Popov
c568ffe517 Ignore getcwd return in zend_compile
To do this move the php_ignore_value macro to ZEND_IGNORE_VALUE.
2015-07-16 22:48:56 +02:00
nikita2206
d8a6130660 Handle empty (NULL) stmt in ast_export 2015-07-16 22:31:36 +02:00
Bob Weinand
37e03f6b32 Fix test; this should properly emit a fatal error, just as every other by-ref assignment to an overloaded object 2015-07-16 09:29:43 +02:00
Bob Weinand
0242653377 Fix test; this should properly throw an Error, just as every other by-ref assignment to an overloaded object 2015-07-16 09:25:19 +02:00
Bob Weinand
f57cb13c56 Backport fix for bug #70083 to PHP-5.6 2015-07-15 22:46:53 +02:00
Bob Weinand
0af0733352 Fixed bug #70083 (Use after free with assign by ref on overloaded objects) 2015-07-15 22:36:42 +02:00
Dmitry Stogov
a658465ef2 Export argument type checking functions 2015-08-11 19:11:21 +03:00
Xinchen Hui
4064ee3061 Fixed bug #70240 (Segfault when doing unset($var());) 2015-08-11 21:42:11 +08:00