Commit Graph

994 Commits

Author SHA1 Message Date
Nikita Popov
c46b2ed677 Remove support for array_key_exists() with objects 2019-11-04 13:10:03 +01:00
Tyson Andre
96f361dca0 Update documentation/comment for GH-4860
Fix folding for the new helper method.

Clarify comment in UPGRADING:
The performance on associative arrays would also improve,
as long as no offsets were unset (no gaps).
Packed arrays can have gaps.

Closes GH-4873.
[ci skip]
2019-10-30 10:26:56 +01:00
Tyson Andre
e7ff590d0d Optimize array_slice for packed arrays with large offsets
If the offset is 100000, and there are no gaps in the packed/unpacked array,
then advance the pointer once by 100000,
instead of looping and skipping 100000 times.

Add a new test of array_slice handling unset offsets.

Closes GH-4860.
2019-10-28 11:30:59 +01:00
Colin O'Dell
e7335eb420 Allow array_splice() length to be null 2019-10-23 11:22:12 +02:00
Colin O'Dell
8ccd58baca Add Z_PARAM_LONG_OR_NULL macro 2019-10-22 12:09:04 +02:00
Dmitry Stogov
b02b81299c Comparison cleanup:
- introduce zend_compare() that returns -1,0,1 dirctly (without intermediate zval)
- remove compare_objects() object handler, and keep only compare() handler
2019-10-07 17:57:49 +03:00
Nikita Popov
5f80eb7842 Fix required number of arguments in stubs
* get_parent_class() argument is optional
* Mark array_filter() $callback as optional
* The $base of gmp_strval() is optional
* DateTime constructor also accepts zero arguments
* hash_update_file() stream context is optional
* xmlwriter_write_dtd_entity() $isparam argument is optional
2019-10-07 16:33:41 +02:00
Nikita Popov
647b1c7fcf Remove most uses of ZEND_PARSE_PARAMETERS_END_EX()
As ZPP now throws, it makes no sense to specify an explicit return
value.
2019-10-07 10:02:18 +02:00
George Peter Banyard
d5e9ef8f0f Promote warnings to error in array_flip()
Closes GH-4576.
2019-10-02 12:31:02 +02:00
George Peter Banyard
1ca4ab09a5 Promote warnings to errors in array_push()
This is in line with the engine change from
https://wiki.php.net/rfc/engine_warnings.
2019-10-02 10:38:23 +02:00
Gabriel Caruso
5d6e923d46
Remove mention of PHP major version in Copyright headers
Closes GH-4732.
2019-09-25 14:51:43 +02:00
George Peter Banyard
f816171240 Indicate entry is skipped in error message 2019-09-18 22:30:12 +02:00
Nikita Popov
2cafaab885 Merge branch 'PHP-7.4' 2019-09-17 13:15:01 +02:00
Nikita Popov
d266ba4f2d Check for exception after calling count_values()
To avoid a duplicate error if count_values() throws.
2019-09-17 13:13:44 +02:00
George Peter Banyard
62751b0d45
Promote warnings to errors in array_walk(_recursive)() 2019-08-29 16:02:59 +02:00
George Peter Banyard
81277a104c
Promote warnings to errors in compact() 2019-08-29 16:02:20 +02:00
George Peter Banyard
20edea5a85
Promote warnings to errors in array_merge(_recursive)() and array_replace() 2019-08-29 16:01:39 +02:00
George Peter Banyard
70e604ee46 Promote warnings to errors in extract() 2019-08-28 23:15:01 +02:00
George Peter Banyard
9fc3d5da11 Promote warnings to errors in max() 2019-08-27 23:41:22 +02:00
George Peter Banyard
b91a881b32 Promote warnings to errors in min() 2019-08-27 23:38:22 +02:00
Nikita Popov
a47f170a75 Assert that symbol table is available in compact()
I believe NULL here is no longer possible due to the dynamic call
check. A similar assumption already exists in the extract()
implementation.
2019-08-26 14:25:48 +02:00
George Peter Banyard
c1c8538f95 Promote warnings to errors in array_rand() 2019-08-26 13:31:02 +02:00
Theodore Brown
d5f42d68c8 Convert remaining array function arginfo to PHP stubs 2019-08-26 12:53:00 +02:00
George Peter Banyard
c1fcf2d616 Promote warnings to errors in array_pad() 2019-08-22 19:30:20 +02:00
George Peter Banyard
7dcbcd4ca5 Promote warnings to errors in array_column() 2019-08-22 19:27:47 +02:00
George Peter Banyard
7d4e3dc32d Promote warnings to errors in array_combine() 2019-08-21 18:12:56 +02:00
George Peter Banyard
eaf66df517 Promote warnings to errors in array_multisort() 2019-08-21 18:10:13 +02:00
George Peter Banyard
c70f92caf8 Promote warning to error in array_chunk() 2019-08-21 18:07:35 +02:00
George Peter Banyard
7c6acc2eef Promote warnings to errors in range() 2019-08-21 18:05:08 +02:00
Nikita Popov
36db71df47 Merge branch 'PHP-7.4' 2019-07-22 12:28:40 +02:00
Nikita Popov
0ba7c3eadf Deprecate array_key_exists() on objects 2019-07-22 11:39:52 +02:00
Nikita Popov
57a385db09 Merge branch 'PHP-7.4' 2019-07-05 11:21:43 +02:00
Nikita Popov
ea86a9209c Optimize integer in_array with strict=true
It doesn't make sense that using in_array with strict=false is
much faster for this case, due to lack of a specialized codepath.
2019-07-05 11:20:29 +02:00
Peter Kokot
7f994990ea Merge branch 'PHP-7.4'
* PHP-7.4:
  Remove HAVE_STRCOLL check
2019-06-28 00:13:25 +02:00
Peter Kokot
638c21765c Remove HAVE_STRCOLL check
The strcoll function is defined in the C89 standard and should be
on today's systems always available via the <string.h> header.

https://port70.net/~nsz/c/c89/c89-draft.html#4.11.4.3

- Remove also SKIPIF strcoll check in test
2019-06-28 00:05:55 +02:00
Nikita Popov
3645292235 Merge branch 'PHP-7.4' 2019-06-19 15:09:39 +02:00
Nikita Popov
4ae87f4bf9 Fix overflow UB in range() 2019-06-19 15:09:00 +02:00
twosee
63171d88f2 Add do...while(0) for RETURN_* and ZVAL_* APIs
Closes GH-4255.
2019-06-12 16:17:16 +02:00
Dmitry Stogov
d7aa152d3f Merge branch 'PHP-7.4'
* PHP-7.4:
  Fixed bug #77135 (Extract with EXTR_SKIP should skip $this)
2019-06-07 11:50:30 +03:00
Dmitry Stogov
8fbfd8872a Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3:
  Fixed bug #77135 (Extract with EXTR_SKIP should skip $this)
2019-06-07 11:50:19 +03:00
Dmitry Stogov
972223c342 Merge branch 'PHP-7.2' into PHP-7.3
* PHP-7.2:
  Fixed bug #77135 (Extract with EXTR_SKIP should skip $this)
2019-06-07 11:48:57 +03:00
Dmitry Stogov
83cdb89f8a Fixed bug #77135 (Extract with EXTR_SKIP should skip $this) 2019-06-07 11:36:39 +03:00
Nikita Popov
d3ed9d8192 Make sure array_splice() always returns an array
Return an array even if the return value isn't used. This allows us
to add the arginfo return type.
2019-06-05 14:56:32 +02:00
Nikita Popov
7686b0b889 Merge branch 'PHP-7.4' 2019-06-05 14:53:50 +02:00
Nikita Popov
a31f46421d Allow exceptions in __toString()
RFC: https://wiki.php.net/rfc/tostring_exceptions

And convert some object to string conversion related recoverable
fatal errors into Error exceptions.

Improve exception safety of internal code performing string
conversions.
2019-06-05 14:25:07 +02:00
Gabriel Caruso
192170a39a Add return type to some array_* functions 2019-06-05 00:13:52 -03:00
Nikita Popov
001d434449 Finish func_info updates for ext/standard 2019-06-03 11:26:25 +02:00
Nikita Popov
321fe88935 Add Z_PARAM_NUMBER and use it for some functions 2019-06-03 10:14:05 +02:00
Nikita Popov
4e391ee3a3 Convert some warnings to TypeErrors in array functions
This is manual type and argument number checking code that was not
covered by the zpp move to TypeErrors.
2019-05-31 10:52:06 +02:00
Dmitry Stogov
c64fe84f8b Merge branch 'PHP-7.4'
* PHP-7.4:
  Avoid double copying
2019-05-28 13:35:29 +03:00