1
0
mirror of https://github.com/php/php-src.git synced 2026-04-22 23:48:14 +02:00
Commit Graph

800 Commits

Author SHA1 Message Date
Dmitry Stogov 1f7bf2bfd6 Optimized extract(). Avoided double hash lookups and repeatable checks through loop splitting. 2017-01-20 10:39:27 +03:00
Sammy Kaye Powers 9e29f841ce Update copyright headers to 2017 2017-01-02 09:30:12 -06:00
Sara Golemon 1b0edb3c6c Use new param API in standard/array 2016-12-30 10:35:45 -08:00
Anatol Belski b204b3abd1 further normalizations, uint vs uint32_t
fix merge mistake

yet one more replacement run
2016-11-26 17:29:01 +01:00
Craig Duncan aaf7341b1c Add warnings when counting invalid parameters 2016-11-17 09:33:04 +00:00
Nikita Popov 23772d5b70 Merge branch 'PHP-7.1' 2016-10-20 13:26:51 +02:00
Nikita Popov 736633310c Merge branch 'PHP-7.0' into PHP-7.1 2016-10-20 13:26:34 +02:00
Adam Saponara 55d17662cb Fix bug #71241: array_replace_recursive mutates ref params
`array_replace_recursive` can sometimes mutate its params if
references are nested within. This differs from the PHP 5 behavior.
2016-10-20 13:22:04 +02:00
Dmitry Stogov 65ea250022 Merge branch 'PHP-7.1'
* PHP-7.1:
  Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu)
2016-10-19 23:12:17 +03:00
Dmitry Stogov 9ded1b4edb Introduced HT_IS_PACKED() and HT_IS_WITHOUT_HOLES() macros. (Benjamin Coutu) 2016-10-19 23:10:42 +03:00
Andrea Faulds 695176458f Merge branch 'PHP-7.1' 2016-09-11 22:46:48 +01:00
Andrea Faulds fc5497cb92 Merge branch 'PHP-7.0' into PHP-7.1 2016-09-11 22:46:20 +01:00
Andrea Faulds d690014bf3 Remove zpp fallback code (always use Fast ZPP)
Squashed commit of the following:

commit 3e27fbb3d2
Author: Andrea Faulds <ajf@ajf.me>
Date:   Sun Sep 11 19:14:37 2016 +0100

    Keep dummy FAST_ZPP macro for compatibility

commit 8a7cfd00de
Author: Andrea Faulds <ajf@ajf.me>
Date:   Mon Sep 5 22:36:03 2016 +0100

    Remove FAST_ZPP macro and plain zpp fallback code
2016-09-11 22:44:46 +01:00
Nikita Popov e0e5063173 Drop some pieces of commented-out code 2016-09-04 12:56:06 +02:00
Anatol Belski 1d64b4c71e avoid needless function call 2016-09-01 23:45:31 +02:00
Márcio Almada 00c2c3a476 fix unintentional bc break with compact('this') behavior 2016-09-01 13:01:38 +02:00
Kalle Sommer Nielsen 447e57a1e1 Fixed 7.1 build, decls first please! 2016-08-17 20:26:32 +02:00
Kalle Sommer Nielsen 1e4cae28b2 Seems like I did a bad merge earlier, this should make PHP-7.0 sync with 7.1/master properly now 2016-08-17 16:34:22 +02:00
Kalle Sommer Nielsen 27ceb6ffb5 Merge branch 'PHP-7.0' into PHP-7.1
* PHP-7.0:
  Fix build as done in master in commit 040331c364
  Fixed C89 build
2016-08-17 14:15:09 +02:00
Kalle Sommer Nielsen 9b783107e5 Fix build as done in master in commit 040331c364
The reason why we cannot use round() here, is that it does not come with the standard C library on Windows, I don't think this affects other systems.

At the same time, also expose _php_math_round()
2016-08-17 14:10:24 +02:00
Nikita Popov cf017ce17f Fix array_column() packed hash initialization
FILL assumes enough space is alredy allocated -- do that. Note that
the used size is an upper bound, albeit a likely one.
2016-08-08 18:47:52 +02:00
Xinchen Hui 6d1f473247 It's packed array 2016-08-03 12:37:14 +08:00
Xinchen Hui be00b4ed13 Optmized array_rand 2016-08-03 12:06:04 +08:00
Xinchen Hui 501d24f81b Optimized array_pad 2016-08-03 11:24:31 +08:00
Xinchen Hui 81a7d52814 Folder marks 2016-08-02 20:08:15 +08:00
Xinchen Hui 70f79fd8b6 Optimized array_merge and cleanup 2016-08-02 20:02:23 +08:00
Xinchen Hui e730c8fc90 Optimized array_merge 2016-08-02 17:39:53 +08:00
Xinchen Hui fea2042a47 Optimized array_column (thanks to Benjamin Coutu) 2016-08-02 12:40:46 +08:00
Xinchen Hui a15902fa71 fixed IS_REFERENCE handling 2016-08-02 11:05:51 +08:00
Xinchen Hui 4d9195927a Optimized array_reverse 2016-08-01 20:11:08 +08:00
Nikita Popov 11e050920d Fix memory unsafety in array_walk()
Fixes bugs #61967, #62607, #69068, #70713.

The primary changes are:
a) Use the ht_iterator mechanism to ensure safety not only if the
   iterated array itself changes, but also if it is replaced (and
   potentially destroyed) entirely. We use the same semantics for
   behavior under modification as foreach-by-reference. In
   particular, we advance to the next element before processing it.
   If the iterated entity is exchanged we iterate the new one from
   the start. If it is not an array/object we warn and abort.
b) Always create a reference to the current value. Previously the
   code kept the value as a non-reference and updated it to the
   reference value produced by the user callback. However this is
   unsafe, as the array may have been reallocated in the meantime,
   so the previous value pointer is no longer value.
c) Around a recursive walk, incref the reference containing the
   array. This ensures that the location where the currently
   iterated value is stored cannot be freed.

One problem I was not able to solve is that we cannot decrement
the apply count if the array is exchanged during a recursive walk.
2016-07-30 00:15:32 +02:00
Nikita Popov 261c436d8c Merge branch 'PHP-7.0' into PHP-7.1 2016-07-29 19:08:15 +02:00
Nikita Popov 8a442a33c3 Fix ref handling in array_merge/replace_recursive()
As usual, if the reference has rc=1 it really isn't a reference.
2016-07-29 19:07:04 +02:00
Xinchen Hui c35dab005c Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72622 (array_walk + array_replace_recursive create references from nothing)
2016-07-20 16:12:49 +08:00
Xinchen Hui 3c3b8c8365 Fixed bug #72622 (array_walk + array_replace_recursive create references from nothing) 2016-07-20 16:12:37 +08:00
Nikita Popov d91e2e47d4 Increase array_rand() rehashing treshold
From 3/8 to 3/4. I was thinking in terms of nTableSize, where a
requirement > 1/2 is not tenable. However, we're actually working
with nNumUsed, in which case more than 1/4 tombstones should be
quite unusual.
2016-07-18 23:42:07 +02:00
Nikita Popov f5452b2b46 Optimize the n=1 case of array_rand() 2016-07-18 23:14:39 +02:00
Leigh bb1f8228ed Use zend_bitset 2016-07-07 11:16:01 +01:00
Leigh 06607993f6 Improve array_rand distribution 2016-07-06 12:35:13 +01:00
Leigh 6d6ef7aacc Alias rand to mt_rand 2016-07-05 15:09:49 +01:00
Xinchen Hui 697e3bb48b Merge branch 'master' of git.php.net:/php-src
* 'master' of git.php.net:/php-src:
  typo
  Turn safe timeout handling into general interrupt handling ability.
  Fixed compilation warnings
  yet another test rewrite
  Add additional LDAP SASL constants
  Add tests for LDAP_OPT_* constants
  Add LDAP TLS Protocol Min constants
  Add tests for the LDAP CRL check option
  Add missing LDAP constants
2016-06-23 20:59:28 +08:00
Xinchen Hui eb65db0808 Use zend_sort in array_multisort (tests change is expected) 2016-06-23 20:58:45 +08:00
Dmitry Stogov adc95c5114 Fixed compilation warnings 2016-06-23 12:47:06 +03:00
Dmitry Stogov 1616038698 Added ZEND_ATTRIBUTE_FORMAT to some middind functions.
"%p" replaced by ZEND_LONG_FMT to avoid compilation warnings.
Fixed most incorrect use cases of format specifiers.
2016-06-21 16:00:37 +03:00
Dmitry Stogov 4042f543c4 HANDLE_BLOCK/UNBLOCK_INTERRUPTIONS() protection on inter-process data is completely useless now.
Historicaly, these macros were introduced as a protection from execution timeout handling, but we don't need them anymore after "safe execution timeout" implementation.
These macros are still useful to protect from termination during inner process data modification, because of OS signals (e.g. SIGTERM during OPcache SHM update).
2016-06-20 15:50:41 +03:00
Dmitry Stogov a9512af810 Implemented RFC: Fix inconsistent behavior of $this variable
Squashed commit of the following:

commit bdd3b6895c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Thu Jun 16 00:19:42 2016 +0300

    Fixed GOTO VM

commit 2f1d7c8b89
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 21:01:57 2016 +0300

    Removed unused variable

commit cf749c42b0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 19:06:16 2016 +0300

    Protection from $this reassign through mb_parse_str()

commit 59a9a6c83c
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:14:50 2016 +0300

    Added type inference rule for FETCH_THIS opcode

commit 73f8d14a85
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Wed Jun 15 18:11:18 2016 +0300

    Restored PHP-7 behavior of isset($this->foo).
    It throws exception if not in object context.
    Removed useless opcode handlers.

commit fa0881381e
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 31 12:25:47 2016 +0300

    Changed "Notice: Undefined variable: this" into "Exception: Using $this when not in object context".

commit e32cc528c0
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Tue May 24 02:02:43 2016 +0300

    Throw exception on attempt to re-assign $this through extract() and parse_str().

commit 41f1531b52
Author: Dmitry Stogov <dmitry@zend.com>
Date:   Mon May 23 22:18:36 2016 +0300

    Fixed inconsistent $this behavior
2016-06-16 02:30:23 +03:00
Xinchen Hui 42f23effa9 Value should not be a reference here 2016-06-13 13:40:53 +08:00
Dmitry Stogov b602495e5c Optimization 2016-06-09 16:01:55 +03:00
Dmitry Stogov df7dccea83 Merge branch 'PHP-7.0'
* PHP-7.0:
  Fixed bug #72369 (array_merge() produces references in PHP7)
2016-06-09 15:09:09 +03:00
Dmitry Stogov bfcf32237e Fixed bug #72369 (array_merge() produces references in PHP7) 2016-06-09 15:07:44 +03:00