Commit Graph

7946 Commits

Author SHA1 Message Date
Anatol Belski
0d5121a3c7 fixed ZEND_DEBUG usage 2014-05-05 00:50:51 +02:00
Nikita Popov
69b5ee61d0 Fixed bug #67169: []= after_array_splice incorrect
This fixes a regression I introduced in beta 1.
2014-05-02 12:49:51 +02:00
Anatol Belski
cfd20c90a5 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  refixed the test related to bug #67072
  Improved the fix for bug #67072, thanks Nikita
2014-04-18 15:17:12 +02:00
Anatol Belski
d963cf94a5 refixed the test related to bug #67072 2014-04-18 15:16:09 +02:00
Stanislav Malyshev
ce4c78dd07 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  Fixed test case for 5328d42
2014-04-17 17:36:26 -07:00
Tjerk Meesters
5e988a888a Fixed test case for 5328d42 2014-04-17 17:36:03 -07:00
Ferenc Kovacs
20036525e2 Fix bug #66660: use str_efree instead of efree to handle interned empty strings correctly 2014-04-13 10:45:46 +02:00
Bob Weinand
096e40a027 Fixed tests for recent constant array changes 2014-04-11 20:13:24 +02:00
Bob Weinand
99d1a1bb3f Shut up, my lovely compiler; I do not like your warnings 2014-04-11 19:33:56 +02:00
Bob Weinand
35b895fdf0 Removed useless void* parameter and replaced with zend_bool on zval_update_constant* functions 2014-04-11 19:18:58 +02:00
Bob Weinand
ee2a7c7d41 Fixed disallowal of array usage in constants at run-time
Added at the same time the possibility of array dereferencing
to complete the set of features (useful application of arrays in constants)
2014-04-11 18:21:46 +02:00
Bob Weinand
ad05d3898e Updated zend_vm_execute.h 2014-04-11 16:18:42 +02:00
Bob Weinand
f614fc6898 Fix bug #66015 by reverting "Removed operations on constant arrays." 2014-04-11 10:08:44 +02:00
Nikita Popov
ad2ef3d97e Add only_integer_keys option to zend_hash_reindex
This allows to either do a full reindex, or only reindex the integer
keys.
2014-04-09 12:31:21 +02:00
Nikita Popov
22d3eb3117 Add zend_hash_splice
This implements the original functionality of php_splice, but
as an in-place operation, thus avoiding copying the HT.

This is much faster (~10x) if the splice removes a small portion
of the array and doesn't insert many elements.
2014-04-09 12:31:21 +02:00
Nikita Popov
1aa8719e32 Add zend_hash_reindex
The implementation differs from the original in array.c in that it
rehashes the hashtable in the same loop. This is approximately two
times faster (not counting the rare case of a purely associative
array).
2014-04-09 12:31:21 +02:00
Bob Weinand
0e273217cf Fix Linux specific fail in error traces
Linux apparently does not like memcpy in overlapping regions...
2014-04-07 17:14:38 +02:00
Anatol Belski
9d4001f1c8 fix C89 compat 2014-03-22 10:44:01 +01:00
Nikita Popov
f331ed1414 Revert "Add helper function for updating bucket contents"
Reverting this for now, because it would require further changes
thanks to the zend signals tsrms-but-only-sometimes awesomeness.
2014-03-21 01:32:49 +01:00
Nikita Popov
4e7e301dda Rename+move zend_hash_apply_deleter and reuse it
The interruption handling was normalized to wrap the entire deletion
operation (instead of leaving out the destructor call and/or the
deallocation) per the recommendation of somebody (don't remember who)
familiar with zend signals.

There is an always-inlined variant of the function for use in
the main deletion function, to ensure there is no performance
impact.
2014-03-21 00:14:52 +01:00
Nikita Popov
4efa58dd59 Make zend_hash_apply_deleter() void, to allow reuse
Also remove lies in the comment above the function. apply_deleter
is not safe against modification, if the modification involves
removing the next bucket.

Also modified the implementation of zend_hash_graceful_destroy()
to be fully graceful (the reverse variant already was).
2014-03-21 00:14:51 +01:00
Nikita Popov
c3a317117a Add helper function for updating bucket contents 2014-03-21 00:14:46 +01:00
Nikita Popov
994fcfcff9 Remove unnecessary check
In case of an update the key already existed, so the next free
element can not change.
2014-03-20 22:58:10 +01:00
Pierre Joye
eef2978afc Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  update NEWS
  fix #66872, invalid argument crashes gmp_testbit
  fix #66872, invalid argument crashes gmp_testbit
  add vc12 (2013)

Conflicts:
	ext/gmp/gmp.c
2014-03-10 12:18:57 +01:00
Tjerk Meesters
3d1fa4cb17 Allow T_POW in constant expressions 2014-03-07 09:14:27 +08:00
Ferenc Kovacs
bfbdc032b6 Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5:
  typo spotted by Lajos Veres
2014-02-27 11:30:23 +01:00
Ferenc Kovacs
561843c973 typo spotted by Lajos Veres 2014-02-27 11:29:08 +01:00
Nikita Popov
95c73f99d3 Don't add num_additional_args in SEND opcodes
Now that trailing positional args are disallowed,
num_additional_args will always be zero in SEND opcodes (and
FUNC_ARG fetches).
2014-02-26 16:40:25 +01:00
Nikita Popov
d3b484df82 Disallow use of positional args after unpacking
This commit disallows the use of trailing positional arguments
after argument unpacking was used. The following calls are no
longer valid:

    fn(...$array, $var);
    fn(...$array1, $var, ...$array2);

However, all of the following continue to be valid:

    fn($var, ...$array);
    fn(...$array1, ...$array2);
    fn($var, ...$array1, ...$array2);

The reason behind this change is a stack allocation issue pointed
out by Dmitry: As of PHP 5.5 the stack necessary for pushing
arguments is precomputed and preallocated, as such the individual
SEND opcodes no longer verify that there is enough stack space.
The unpacked arguments will occupy some of that preallocated
space and as such following positional arguments could write past
a stack page boundary.

An alternative resolution for this issue is to ensure that there
is enough space for the remaining arguments in the UNPACK opcode.
However making this allocation precise (rather than using a
conversative over-estimate) would require some effort. Given that
this particular aspect of the feature wasn't very popular in the
first place, it doesn't seem worth the effort.
2014-02-26 16:40:25 +01:00
Nikita Popov
2eae187949 Store arg_num in fcall entry
Instead of storing the argument number in the znode of the parameter
list, store it in fcall->arg_num. This mainly cleans up the parameter
parsing code, which previously had to duplicate all rules (this
becomes more excessive as more features are added, e.g. named params
would already require a minimum of 14 rules...)
2014-02-26 16:40:25 +01:00
Nikita Popov
cefa7f8d08 Introduce zend_function_call_entry structure
Instead of directly pushing the zend_function* onto the
function_call_stack, push this structure. This allows us to store
additional data on this stack.
2014-02-26 16:40:25 +01:00
Johannes Schlüter
5c8a0c92d1 Merge branch 'PHP-5.5' into PHP-5.6 2014-02-23 14:57:21 +01:00
Johannes Schlüter
2198bbce86 Merge branch 'PHP-5.4' into PHP-5.5 2014-02-23 14:56:32 +01:00
Johannes Schlüter
3f258e6b46 Make sure value is initialized 2014-02-23 14:55:29 +01:00
Anatol Belski
5d0d88d1f2 fixed path separator in the tests 2014-02-21 00:23:01 +01:00
Sara Golemon
14c08ea362 Add more tests for __debugInfo() and fix leak 2014-02-20 12:10:00 -08:00
Bob Weinand
fe3c8de9d5 Merge branch 'PHP-5.5' into PHP-5.6 2014-02-20 17:49:45 +01:00
Bob Weinand
ca313caa4b Merge branch 'PHP-5.4' into PHP-5.5 2014-02-20 17:48:38 +01:00
Bob Weinand
afa03a470e Use nicer output for characters < 32 and > 126 in exception strings
Using question marks might confuse more than it helps.
Users are wondering what happened to their string...
2014-02-20 17:39:58 +01:00
Anatol Belski
47204c6341 some missing pieces for __debugInfo 2014-02-20 02:07:34 +01:00
Sara Golemon
1e752ce9c5 Add __debugInfo() magic method
class Foo {
  private $val = 'Random, meaningless data';

  public function count() { return 42; }

  public function __debugInfo() {
    return ['count' => $this->count()];
  }
}

$f = new Foo;
var_dump($f);
2014-02-17 19:33:56 -08:00
Bob Weinand
363ff60475 Fixed memory leak in pow operator 2014-02-06 21:31:40 +01:00
datibbaw
aff56f3c45 add T_POW (**) operator
Fixed recognition of the operator

Added opcode, still doing multiply instead of pow()

opcode now always returns int(42)

The right answer, but always a float

Yanked code from pow() implementation.

Should not handle negative long as exponent ourselves

Added test cases from pow()

Moved precedence higher than '~'

Added GMP operator overloading

Added ZEND_ASSIGN_POW (**=) operator.

Added pow() as a language construct.

Adjusted test cases for changed precedence.

Reduced pow() to shell function around ZEND_API pow_function()

Reduced test case to only contain edge cases
Added overloading test case

Moved unary minus above T_POW

Revert "Added pow() as a language construct."

Bad bad bad idea.

This reverts commit f60b98cf7a8371233d800a6faa286ddba4432d02.

Reverted unary minus behaviour due to previous revert.
Convert arrays to int(0)
Exponent with array as a base becomes int(0)

Rebase against master

Fixed tokenizer test case
2014-02-06 14:41:21 +01:00
Anatol Belski
07f3bac6ca fix *.dsp files related to bug #50333 2014-01-28 13:09:29 +01:00
Xinchen Hui
aba775fd34 Fixed warning "No new line at end of file" 2014-01-24 10:50:41 +08:00
Nikita Popov
31a2ac470c Fix argument unpacking across stack pages
If multiple unpacks were used (or mixed with normal arguments)
parts of the arguments could land on different stack pages. If
this occurs the arguments will now be copied to a new stack page.

The code used to do this is copied verbatim from the PHP 5.4 branch
and only modified to reduce the amount of inlined code.
2014-01-18 14:41:33 +01:00
Bob Weinand
69edad213a Fixed build (making zend_is_by_ref_func_arg_fetch function static) 2014-01-12 01:59:22 +01:00
Nikita Popov
2c47dfbaeb Implement argument unpacking
RFC: https://wiki.php.net/rfc/argument_unpacking
2014-01-11 12:42:08 +01:00
Nikita Popov
c7bb283338 Minor cleanup in zend_do_pass_param() 2014-01-11 12:40:16 +01:00
Anatol Belski
4e7c9ea896 Fixed bug #66009 Failed compilation of PHP extension with C++ std library using VS 2012
Visual Studio 2012 includes sanity checks for C++11 features, see
http://msdn.microsoft.com/en-us/library/vstudio/bb531344(v=vs.110).aspx
To fix the 'inline' keyword redefinition for C++ in debug mode, the
new macros ZEND_WIN32_KEEP_INLINE is introduced, ZEND_WIN32_FORCE_INLINE is
automatically appended in release mode.
2014-01-04 01:41:27 +01:00