Commit graph

972 commits

Author SHA1 Message Date
Stanislav Malyshev
73bf238507 Fix bug #76390 - do not allow invalid strings in range() 2018-06-04 22:44:05 -07:00
Dmitry Stogov
3c122e1605 Avoid rehashing of "packed" array 2018-05-30 20:17:25 +03:00
Anatol Belski
74be58938c Merge branch 'PHP-7.2'
* PHP-7.2:
  Translate correct C++ version with suitable compiler
  Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT)
2018-05-28 17:15:22 +02:00
Anatol Belski
d5ee654b71 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Translate correct C++ version with suitable compiler
  Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT)
2018-05-28 17:13:55 +02:00
Dmitry Stogov
5eb1f92f31 Use zend_string_release_ex() instread of zend_string_release() in places, where we sure about string persistence. 2018-05-28 16:27:12 +03:00
Bob Weinand
97a8483143 Fixed bug #76383 (array_map on $GLOBALS returns IS_INDIRECT) 2018-05-28 00:48:35 +02:00
Dmitry Stogov
4ad9cf4605 Bit test optimization 2018-05-08 11:58:17 +03:00
Dmitry Stogov
c88be6aee1 Bit check micro-optimization 2018-04-28 14:13:12 +03:00
Christoph M. Becker
9993304da4 Merge branch 'PHP-7.2'
* PHP-7.2:
  Fix arginfo for array_replace(_recursive) and array_merge(_recursive)
2018-04-13 15:36:15 +02:00
Christoph M. Becker
3770c2e463 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix arginfo for array_replace(_recursive) and array_merge(_recursive)
2018-04-13 15:28:47 +02:00
Gabriel Caruso
bb79e5764b Fix arginfo for array_replace(_recursive) and array_merge(_recursive) 2018-04-13 15:27:16 +02:00
timurib
f7f48643e7 Remove redundant warning in array_push() and array_unshift()
Cf. https://github.com/php/php-src/pull/3011.
2018-03-25 17:49:04 +02:00
Dmitry Stogov
a795bd8265 Optimize zend_hash_real_init() 2018-03-23 00:13:45 +03:00
Dmitry Stogov
d1c6bda2bb Fixed expectation 2018-03-22 12:48:22 +03:00
Dmitry Stogov
d7f2dc4ec6 Improve HashTable iterators handling:
- Avoid iterators check/update on each HashTable update opration
- Keep position equal (or above) nNumUsed instead of HT_INVALID_IDX
- Fixed iterators handling in array_unshift()
2018-03-22 02:41:49 +03:00
Anatol Belski
5e106778f0 Use const pointers 2018-03-20 11:12:25 +01:00
Anatol Belski
98aeb528c3 Remove unused assignment 2018-03-07 17:12:27 +01:00
Nikita Popov
4838e9799f Merge branch 'PHP-7.2' 2018-03-05 15:33:34 +01:00
Nikita Popov
634a1ff033 Merge branch 'PHP-7.1' into PHP-7.2 2018-03-05 15:32:39 +01:00
Nikita Popov
fd5bd37ab1 Revert "Fixed bug #75961 (Strange references behavior)"
This reverts commit 94e9d0a2ae.

This code needs to be mindful about modifications to the array
happening during callback execution. It was written in a way that
only accessed the reference, which is guaranteed not to move. The
changed implementation instead accesses the array slot, leading to
use-after-free.

Run ext/standard/tests/array/bug61967.phpt under valgrind to see
the issue.
2018-03-05 15:32:21 +01:00
Xinchen Hui
55ef99e3b8 Merge branch 'PHP-7.2'
* PHP-7.2:
  Update NEWS
  Fixed bug #75961 (Strange references behavior)

Conflicts:
	ext/standard/array.c
2018-02-17 16:39:31 +08:00
Xinchen Hui
26dda8999c Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #75961 (Strange references behavior)
2018-02-17 16:33:39 +08:00
Xinchen Hui
94e9d0a2ae Fixed bug #75961 (Strange references behavior) 2018-02-17 16:33:15 +08:00
Dmitry Stogov
6634d5e313 Use HT_FLAGS() macro 2018-01-22 14:58:16 +03:00
Dmitry Stogov
ebf900a9eb Introduce mcros to access HashTable iterators counter 2018-01-22 14:14:35 +03:00
Dmitry Stogov
9cbb521094 Access HashTable.u.flags through HT_FLAGS() macro. 2018-01-22 13:36:15 +03:00
Dmitry Stogov
465a8cfbad Use reference-counting instead of duplication 2018-01-19 13:56:31 +03:00
Dmitry Stogov
40b8483165 Use SEPARATE_ARRAY 2018-01-17 03:08:22 +03:00
Nikita Popov
5c983ae852 Merge branch 'PHP-7.2' 2018-01-12 18:34:34 +01:00
Nikita Popov
8c73fc8027 Fixed bug #75653 2018-01-12 18:30:22 +01:00
Xinchen Hui
a307689ba7 Remove unnecessary initialization:w 2018-01-02 14:03:34 +08:00
Xinchen Hui
a6519d0514 year++ 2018-01-02 12:57:58 +08:00
Xinchen Hui
7a7ec01a49 year++ 2018-01-02 12:55:14 +08:00
Xinchen Hui
ccd4716ec7 year++ 2018-01-02 12:53:31 +08:00
Dmitry Stogov
efcbea4345 Cheaper reference construction 2017-12-26 13:30:25 +03:00
Dmitry Stogov
2bbcc04c20 Added special cases for array_diff(), when first argument is an empty array or an array with single element. 2017-12-12 01:51:37 +03:00
Dmitry Stogov
c5ba76d9de Use cheaper API 2017-12-12 00:30:51 +03:00
Dmitry Stogov
778dfbc138 Use cheaper functions 2017-12-11 23:00:07 +03:00
Tom Van Looy
e4e26f2428 Remove RAND_RANGE() macro
The behavior of RANGE_RANGE() is 7.1 changed completely, from
rescaling an already generated number to generating a number
itself. Because of this str_shuffle() ended up generating two
random numbers on every iteration.

To avoid further misuse the function is dropped entirely. Extensions
for PHP >= 7.1 should directly call php_mt_rand_range().
2017-12-09 17:24:17 +01:00
Dmitry Stogov
185478d07e Use cheaper SEPARATE macros 2017-12-07 22:35:17 +03:00
Dmitry Stogov
cc12acefcd Use cheaper functions 2017-12-04 13:21:35 +03:00
Dmitry Stogov
ccc12b82da Avoid unnecessary reference-counting on strings. 2017-11-16 17:09:32 +03:00
Xinchen Hui
a8a17a72b0 RC manipulation cleanup 2017-11-01 10:25:10 +08:00
Sara Golemon
bbf57b114f
Revert array_slice passthrough optimization
This reverts commit fabb5b7a74.
This reverts commit e751e6ceba.
2017-10-30 11:08:28 -04:00
Dmitry Stogov
fad75a54d4 Merge branch 'master' into rc_debug
* master: (26 commits)
  Better fix for bug #75451 (Assertion fails while foreach on empty xpath query)
  Catch with the latest AppVeyor unzip errors
  Fixed type inference
  Fix bug #75453 Incorrect reflection on ibase_connect and ibase_pconnect
  Fix compiler warnings
  We don't use a specific model for a MAKERNOTE so remove these checks that doesn't do anything anyway
  Remove these old comments, as for the TODO, there is already a FR for this
  Re-enable AppVeyor cache
  make sure run-tests reports exit status upon prerequisite error
  Remove implicit constants from test case
  Fix invalid read in zend_use_undefined_constant()
  Fix invalid read in mb_ord()
  Remove --with-libmbfl configure option
  Fixed bug #75451 (Assertion fails while foreach on empty xpath query)
  Add tests for UConverter::getStandards()
  convert spaces to tabs in ext/ftp/tests/server.inc
  Add tests for ftp_rename
  Fix bug #75434 Wrong reflection for mysqli_fetch_all function
  Don't optimize input arrays with suffix holes
  Fix bug #75307 Wrong reflection for openssl_open function
  ...
2017-10-30 12:11:35 +03:00
Sara Golemon
352b406650 Merge branch 'PHP-7.2'
* PHP-7.2:
  Don't optimize input arrays with suffix holes
2017-10-27 13:07:50 -04:00
Sara Golemon
cc96166f74
Don't optimize input arrays with suffix holes 2017-10-27 13:07:33 -04:00
Sara Golemon
fabb5b7a74
array_slice() passthrough for preserve_keys=true as well 2017-10-27 10:14:03 -04:00
Sara Golemon
e751e6ceba
Do not create a new array when slicing all of input array. 2017-10-27 10:09:05 -04:00
Dmitry Stogov
49ea143bbd Encapsulate reference-counting primitives.
Prohibit direct update of GC_REFCOUNT(), GC_SET_REFCOUNT(), GC_ADDREF() and GC_DELREF() shoukf be instead.
Added mactros to validate reference-counting (disabled for now).
These macros are going to be used to eliminate race-condintions during reference-counting on data shared between threads.
2017-10-27 01:28:58 +03:00