1
0
mirror of https://github.com/php/php-src.git synced 2026-04-28 18:53:33 +02:00
Commit Graph

1046 Commits

Author SHA1 Message Date
Gabriel Caruso efbf846fd2 Make array parsing parameters error messages consistency with ZPP failure 2018-08-19 21:27:57 -03:00
Xinchen Hui 2b1d79ce66 Fixed bug #76713 (Segmentation fault caused by property corruption) 2018-08-07 12:36:36 +08:00
Dmitry Stogov c42f0ba4f7 Removed useless IS_UNDEF checks 2018-07-31 12:23:46 +03:00
Peter Kokot 8d3f8ca12a Remove unused Git attributes ident
The $Id$ keywords were used in Subversion where they can be substituted
with filename, last revision number change, last changed date, and last
user who changed it.

In Git this functionality is different and can be done with Git attribute
ident. These need to be defined manually for each file in the
.gitattributes file and are afterwards replaced with 40-character
hexadecimal blob object name which is based only on the particular file
contents.

This patch simplifies handling of $Id$ keywords by removing them since
they are not used anymore.
2018-07-25 00:53:25 +02:00
Xinchen Hui 1638a6e118 Give a meaningful name 2018-07-24 12:51:36 +08:00
Xinchen Hui 4aada3993c Micro-optmization 2018-07-24 12:16:35 +08:00
Xinchen Hui 3ca9aaf24e Merge branch 'PHP-7.2'
* PHP-7.2:
  Update NEWs
  Fixed bug #68553 (array_column: null values in $index_key become incrementing keys in result)

Conflicts:
	ext/standard/array.c
2018-07-24 11:37:09 +08:00
Xinchen Hui 2a181b5ea0 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #68553 (array_column: null values in $index_key become incrementing keys in result)
2018-07-24 11:35:22 +08:00
Xinchen Hui 38d97557da Fixed bug #68553 (array_column: null values in $index_key become incrementing keys in result) 2018-07-24 11:34:57 +08:00
Dmitry Stogov d4e60a1ffd Avoid code duplication 2018-07-23 16:53:44 +03:00
Christoph M. Becker 9f957fd303 Improve implementation of array_key_first() and array_key_last()
Firstly, we must not separate the $stack argument for performance
reasons.  Secondly, we prefer `Z_ARRVAL_P` over `HASH_OF` to clarify
our intention.

Thanks to Nikita, for catching these issues!
2018-07-17 11:53:06 +02:00
Enno Woortmann 50516a6e1f Add implementation and tests for new methods - array_key_first(array $a) Returns the key of the first element or null - array_key_last(array $a) Returns the key of the last element or null 2018-07-17 11:31:00 +02:00
Dmitry Stogov 67b4c3379a Uze ZVAL_COPY_DEREF() instead of ZVAL_DEREF() and ZVAL_COPY() 2018-07-09 12:46:46 +03:00
Dmitry Stogov af341213f7 se zval_ptr_dtor_str() instead of zend_string_release_ex(Z_STR(*), 0) 2018-07-04 12:08:07 +03:00
Nikita Popov e080fb6d92 Do not continue extract()ing after an exception has been thrown
Make behavior consistent with a loop of normal assignments.

This is not a big issue now, because $this is the only case that
may generate an error. However typed references introduce additional
error conditions, which would be silenced by this kind of behavior.
2018-07-03 22:45:35 +02:00
Xinchen Hui 8b2f40724b Merge branch 'PHP-7.2'
* PHP-7.2:
  Update NEWS
  Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys)
2018-06-21 17:26:57 +08:00
Xinchen Hui 939e1095f2 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys)
2018-06-21 17:26:27 +08:00
Xinchen Hui 6531719da5 Fixed bug #76505 (array_merge_recursive() is duplicating sub-array keys) 2018-06-21 17:26:05 +08:00
Gabriel Caruso fc775f6915 Report unknown variables passed to compact() 2018-06-19 12:50:15 +02:00
Nikita Popov 777187cbaf Don't use UNREFs during array operations
Perform DEREFs instead. We were already doing this in some, but not
all places.

While UNREFs are supposed to be transparent, in practice they have
rare observable side effects. Calling array_merge() on an array
should never change how that array behaves.
2018-06-09 13:20:13 +02:00
Xinchen Hui 0a0f6c495f Merge branch 'PHP-7.2'
* PHP-7.2:
  Fixed bug #76410 (SIGV in zend_mm_alloc_small)
  Fix bug #76390 - do not allow invalid strings in range()

Conflicts:
	ext/standard/array.c
2018-06-05 17:16:45 +08:00
Xinchen Hui 951e29f66e Fixed bug #76410 (SIGV in zend_mm_alloc_small) 2018-06-05 17:15:57 +08:00
Stanislav Malyshev c12fc77bdf Fix bug #76390 - do not allow invalid strings in range() 2018-06-04 22:54:03 -07:00
Stanislav Malyshev 5fbb0988d1 Merge branch 'PHP-7.1' into PHP-7.2
* PHP-7.1:
  Fix bug #76390 - do not allow invalid strings in range()
2018-06-04 22:51:38 -07:00
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