Commit Graph

617 Commits

Author SHA1 Message Date
Dmitry Stogov
47f9014458 Fixed array_nultisort() to support IS_REFERENCE 2014-03-05 17:23:40 +04:00
Dmitry Stogov
7320abbaa9 Reverted "efree(args);" removed by mistake 2014-03-05 15:49:24 +04:00
Xinchen Hui
70b7887712 Fixed refcounted handling 2014-03-05 18:17:16 +08:00
Xinchen Hui
74c2deecd8 Fixed refcounted 2014-03-05 18:11:22 +08:00
Xinchen Hui
581fa5822e Merge branch 'refactoring2' of github.com:zendtech/php into refactoring2
Conflicts:
	ext/standard/array.c
2014-03-05 18:02:35 +08:00
Xinchen Hui
bfaa9669a6 Fixed refcounted 2014-03-05 18:00:46 +08:00
Dmitry Stogov
3733737328 Handle interned strings as non-refcounted scalars 2014-03-05 13:55:56 +04:00
Xinchen Hui
0791bdb562 retval might be IS_UNDEF even the call is successed 2014-03-05 17:53:01 +08:00
Xinchen Hui
75d567ef9a Fixed NULL pointer def in ext/standard/tests/array/array_fill_keys_variation2.php 2014-03-05 17:31:10 +08:00
Xinchen Hui
2ee6bc1309 Remove "efree(args") 2014-03-05 17:07:09 +08:00
Xinchen Hui
57ae19a0b7 Checkout refcounted before doing addref 2014-03-05 17:02:50 +08:00
Dmitry Stogov
040dea8b82 Arguments taken by internal functions using zend_parse_parameters() with "+" and "*" specifications must not be deallocated anymore. 2014-03-05 11:10:52 +04:00
Dmitry Stogov
2bf3018169 Fixed array_push() 2014-02-28 15:48:39 +04:00
Xinchen Hui
71dac3d54f Don't add_ref in add_*_str functions 2014-02-25 15:47:24 +08:00
Xinchen Hui
69a93d2fd7 Fixed segfault in ext/standard/tests/strings/bug49785.phpt 2014-02-23 21:53:48 +08:00
Dmitry Stogov
d0eccdeea1 Fixed array_unshift() 2014-02-21 17:38:12 +04:00
Dmitry Stogov
2161103fc3 Use better data structures (incomplete) 2014-02-10 17:49:21 +04:00
Dmitry Stogov
f4cfaf36e2 Use better data structures (incomplete) 2014-02-10 10:04:30 +04:00
Xinchen Hui
0f53e37494 Merge branch 'PHP-5.6' 2014-01-03 11:09:07 +08:00
Xinchen Hui
c081ce628f Bump year 2014-01-03 11:08:10 +08:00
Xinchen Hui
47c9027772 Bump year 2014-01-03 11:06:16 +08:00
Xinchen Hui
c0d060f5c0 Bump year 2014-01-03 11:04:26 +08:00
Kalle Sommer Nielsen
d14670ccdb Eliminate another TSRMLS_FETCH() in i_zend_is_true()
# Affected extensions have all been updated, ext/opcache and ext/zip
# both have macros for cross version compatibility
2013-12-18 07:25:05 +01:00
Nikita Popov
dc4bf922d9 Allow $num=0 in array_fill()
Implemented request #49824.
2013-11-12 22:02:51 +01:00
Sherif Ramadan
98c9e56ef0 Merge branch 'pull-request/287'
Add ability to use array keys with array_filter().
This adds a third (optional) argument to array_filter() that will determine
what gets passed to the callback, the array key, value or both.
The third argument can be one of two constants: ARRAY_FILTER_USE_BOTH or,
ARRAY_FILTER_USE_KEY.
2013-10-30 09:36:19 -04:00
Dmitry Stogov
b0f9768e02 Merge branch 'PHP-5.5'
* PHP-5.5:
  Improved performance of array_merge() by eliminating useless copying

Conflicts:
	NEWS
2013-10-28 13:47:37 +04:00
Dmitry Stogov
5c0890ba8a Improved performance of array_merge() by eliminating useless copying 2013-10-28 13:31:44 +04:00
Tjerk Meesters
75ba75e205 Using only two constants to signal use type intent. 2013-09-28 00:06:04 +08:00
datibbaw
0492145e58 added bitmask variation 2013-09-28 00:06:04 +08:00
datibbaw
a88c7be88b added use_keys argument to array_filter() 2013-09-28 00:06:03 +08:00
Nikita Popov
47ee470992 Make use of direct returns in some places 2013-08-31 13:16:50 +02:00
Christopher Jones
39612afc72 Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings.

Conflicts:
	ext/dba/libinifile/inifile.c
2013-08-14 20:43:25 -07:00
Christopher Jones
9ad97cd489 Reduce (some) compile noise of 'unused variable' and 'may be used uninitialized' warnings. 2013-08-14 20:36:50 -07:00
Veres Lajos
4749457a49 HASH_KEY_NON_EXISTANT fix 2013-07-21 20:09:53 -07:00
Xinchen Hui
c7b58e4967 Merge branch 'PHP-5.4' into PHP-5.5 2013-07-21 21:07:27 +08:00
Xinchen Hui
3380de9774 Fixed bug #65304 (Use of max int in array_sum) 2013-07-21 21:07:19 +08:00
Veres Lajos
e9a95d78ef typo fixes 2013-07-15 00:23:03 -07:00
Veres Lajos
72085b0e5f typo fixes 2013-07-15 00:18:57 -07:00
Anatol Belski
168a5bb6df Merge branch 'PHP-5.4' into PHP-5.5
* PHP-5.4:
  fix uninitialized memory usage
2013-07-14 20:46:19 +02:00
Anatol Belski
add0833681 fix uninitialized memory usage 2013-07-14 20:44:29 +02:00
David Soria Parra
139e9824ad Fix array_colum segfault
Separate zval to avoid gc from freeing
2013-05-15 14:42:39 +02:00
Sara Golemon
734e165d4e array_column() - Use entire subject array when NULL passed for second param.
This starts to look like array_values(), except that you can reindex the arrays
using the third parameter.
2013-04-22 16:19:21 -07:00
Sara Golemon
1a03bd5dee Allow array_column() to take -1 as a valid value in third param
Also do some cleanup and simplification to make this code more
readable in the long term.
2013-04-22 15:54:21 -07:00
Sara Golemon
7b34324f84 Fix handling of double keys in array_column
Also fix resource test to not localize __FILE__ to cwd.
2013-04-21 22:35:04 -07:00
Xinchen Hui
d8a5f41a60 Fixed bug parameter is casted to string of array_column 2013-04-01 19:11:45 +08:00
David Soria Parra
0173c4bab0 Merge branch 'pull-request/257' into PHP-5.5
* pull-request/257:
  array_column: Fix compile-time warnings
  array_column: Removed array_pluck() alias
  array_column: Set array_pluck as an alias for array_column
  array_column: Implement ability to specify an index column
  Cleaning up a memory leak.
  array_column: Adding test for IS_OBJECT and converting object to string
  array_column: Using add_next_index_zval() at nikic's recommendation.
  array_column: Improved tests
  array_column: Cleaning up, as recommended in pull request #56 comments
  Fixing typo in test for array_column()
  Simplify the code and use zend_hash_next_index_insert()
  Adding test for columns not present in all rows for array_column().
  Adding tests for the negative results of array_column()
  Implement new array function array_column()
2013-03-20 13:02:33 +01:00
Ben Ramsey
f5bf1ba88f array_column: Fix compile-time warnings 2013-03-19 20:44:19 -05:00
Nikita Popov
28634bf603 Forgot to remove some now unused variables 2013-03-12 17:39:20 +01:00
Nikita Popov
fcc6611de9 Add support for non-scalar Iterator keys in foreach
RFC: https://wiki.php.net/rfc/foreach-non-scalar-keys
2013-03-12 17:27:31 +01:00
Ben Ramsey
5bc2854b37 array_column: Implement ability to specify an index column 2013-01-11 16:58:31 -06:00
Ben Ramsey
94d5b2519a Cleaning up a memory leak. 2013-01-11 14:16:20 -06:00
Ben Ramsey
20ab30339d array_column: Adding test for IS_OBJECT and converting object to string 2013-01-11 14:16:19 -06:00
Ben Ramsey
66a02eb25e array_column: Using add_next_index_zval() at nikic's recommendation. 2013-01-11 14:16:19 -06:00
Ben Ramsey
e921d28ae3 array_column: Cleaning up, as recommended in pull request #56 comments 2013-01-11 14:16:19 -06:00
Ben Ramsey
6a27b890e6 Simplify the code and use zend_hash_next_index_insert() 2013-01-11 14:16:19 -06:00
Ben Ramsey
9035a1ed24 Implement new array function array_column()
array_column() returns the values of the specified column from a
multi-dimensional array.
2013-01-11 14:16:19 -06:00
Xinchen Hui
a666285bc2 Happy New Year 2013-01-01 16:37:09 +08:00
Xinchen Hui
0a7395e009 Happy New Year 2013-01-01 16:28:54 +08:00
Xinchen Hui
a2045ff332 Happy New Year~ 2013-01-01 16:02:16 +08:00
Xinchen Hui
4cceeb25b7 Merge branch 'PHP-5.3' into PHP-5.4
* PHP-5.3:
  Fixed bug #61730 (Segfault from array_walk modifying an array passed by reference)
2012-05-06 20:28:18 +08:00
Xinchen Hui
7ccd594392 Fixed bug #61730 (Segfault from array_walk modifying an array passed by reference) 2012-05-06 20:01:10 +08:00
Nikita Popov
37d7df72a6 Fix bug #52719: array_walk_recursive crashes if third param of the function is by reference 2012-03-02 18:05:38 +00:00
Nikita Popov
e7810c1f1e Fix bug #52719: array_walk_recursive crashes if third param of the function is by reference 2012-03-02 18:05:38 +00:00
Xinchen Hui
fda8d2fe68 MFH: Fixed bug #61058 (array_fill leaks if start index is PHP_INT_MAX) 2012-03-02 03:40:40 +00:00
Xinchen Hui
33125e2312 Improved fix for #61058, and add test script 2012-02-12 05:32:24 +00:00
Xinchen Hui
c578917e30 Fixed bug #61058 (array_fill leaks if start index is PHP_INT_MAX) 2012-02-12 04:59:08 +00:00
Felipe Pena
e4ca0ed09f - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
4e19825281 - Year++ 2012-01-01 13:15:04 +00:00
Dmitry Stogov
4a25a7740d Fixed ZE specific compile warnings (Bug #55629) 2011-09-13 13:29:35 +00:00
Arpad Ray
b52256c5be add support for SORT_NATURAL and SORT_FLAG_CASE in array sort functions 2011-08-29 20:23:34 +00:00
Adam Harvey
840308cfd0 Implement FR #54459 (Range function accuracy) by changing the way range()
calculates values when used with floating point bounds/step.
2011-04-06 10:23:06 +00:00
Adam Harvey
187eb235fe Implement FR #54459 (Range function accuracy) by changing the way range()
calculates values when used with floating point bounds/step.
2011-04-06 10:23:06 +00:00
Pierrick Charron
1368364469 Fix common typos in the source code (Reported in Bug #54065)
# External libraries were excluded
# Thanks eitan at eitanadler dot com for the first patch :)
2011-04-03 21:46:52 +00:00
Pierrick Charron
e8486cc374 Fix common typos in the source code (Reported in Bug #54065)
# External libraries were excluded
# Thanks eitan at eitanadler dot com for the first patch :)
2011-04-03 21:46:52 +00:00
Felipe Pena
927bf09c29 - Year++ 2011-01-01 02:19:59 +00:00
Felipe Pena
0203cc3d44 - Year++ 2011-01-01 02:17:06 +00:00
Ilia Alshanetsky
9696faa790 Fixed bug 48484 (array_product() always returns 0 for an empty array). 2010-12-12 19:27:04 +00:00
Ilia Alshanetsky
82287511ad Fixed bug 48484 (array_product() always returns 0 for an empty array). 2010-12-12 19:27:04 +00:00
Felipe Pena
897f0b4c27 - Fixed extract() to do not overwrite $GLOBALS and $this when using EXTR_OVERWRITE.
patch by: jorto at redhat dot com
2010-11-19 22:06:44 +00:00
Felipe Pena
93a4e0d1fa - Fixed extract() to do not overwrite $GLOBALS and $this when using EXTR_OVERWRITE.
patch by: jorto at redhat dot com
2010-11-19 22:06:44 +00:00
Felipe Pena
f4d15d8226 - Fixed bug #47643 (array_diff() takes over 3000 times longer than php 5.2.4) 2010-11-01 17:16:47 +00:00
Felipe Pena
5d584d4737 - Fixed bug #47643 (array_diff() takes over 3000 times longer than php 5.2.4) 2010-11-01 17:16:47 +00:00
Kalle Sommer Nielsen
cb50011016 Fixed compiler warnings in the standard library 2010-09-23 03:45:36 +00:00
Adam Harvey
f33837ff97 Implemented request #34857 (Change array_combine behaviour when called with
empty arrays). Patch by Joel Perras <joel.perras@gmail.com>.
2010-08-27 03:54:10 +00:00
Dmitry Stogov
d24c14cb59 Fixed bug #51552 (debug_backtrace() causes segmentation fault and/or memory issues) 2010-06-11 08:53:31 +00:00
Dmitry Stogov
d42dbb3bed Fixed bug #51552 (debug_backtrace() causes segmentation fault and/or memory issues) 2010-06-11 08:53:31 +00:00
Rasmus Lerdorf
2ef8ef9029 typo 2010-05-15 15:37:57 +00:00
Rasmus Lerdorf
9db78b574b typo 2010-05-15 15:37:18 +00:00
Dmitry Stogov
dd5c478be6 Added concept of interned strings. All strings constants known at compile time are allocated in a single copy and never changed. 2010-04-20 11:05:54 +00:00
Sebastian Bergmann
9ba1e81665 sed -i "s#1997-2009#1997-2010#g" **/*.c **/*.h **/*.php 2010-01-03 09:23:27 +00:00
Antony Dovgal
0b8839cd4a fix the fix for #47409
use correct comparison and add missing scope checks to trunk
2009-12-24 13:07:33 +00:00
Ilia Alshanetsky
12f82ee144 Fixed bug #47409 (extract() problem with array containing word "this"). 2009-12-23 16:33:58 +00:00
Felipe Pena
a94558c855 - Added MAKE_COPY_ZVAL(ppzv, pzv) macro 2009-12-08 01:57:37 +00:00
Stanislav Malyshev
8b64f74baa proper fix for bug #50006
add modify protection to all user array sorts
2009-11-29 08:35:01 +00:00
Dmitry Stogov
85560842c2 Fixed crash in usort() and uasort() in case user comparison function modifyes th
e array.
2009-08-14 06:20:21 +00:00
Felipe Pena
fb235dc07f - MFH: Fixed bug #48854 (array_merge_recursive modifies arrays after first one) 2009-07-08 18:23:08 +00:00
Moriyoshi Koizumi
fcede921b6 * MFH: Roll it back. 2009-05-15 17:03:03 +00:00
Christopher Jones
ad07803d23 MFH: New array_multisort() test and code comment fix (Simon Westcott) 2009-05-15 16:46:22 +00:00
Etienne Kneuss
7c41c86a02 MFB: Fix #48224 (Remove incorrect shuffle) 2009-05-10 16:45:21 +00:00
Andrei Zmievski
c2445f4122 Revert bogus fix for #47370. 2009-02-13 22:34:15 +00:00
Moriyoshi Koizumi
018ba64ada * MFH: Fix bug #47370 (BC breakage of array_unique()) 2009-02-12 18:57:55 +00:00
Dmitry Stogov
4d8f18ce97 Fixed bug #47329 (Crash in garbage collector) 2009-02-09 10:47:09 +00:00
Sebastian Bergmann
08659c2dcd MFH: Bump copyright year, 3 of 3. 2008-12-31 11:15:49 +00:00
Arnaud Le Blanc
2dd8d6ff94 MFH: Fixed bug #46873 (extract($foo) crashes if $foo['foo'] exists) 2008-12-27 03:06:57 +00:00
Andrei Zmievski
dddbfccb9f MFH 2008-12-12 19:20:49 +00:00
Arnaud Le Blanc
6a6289a90d MFH: Fixed bugs #44181 & #44182 (extract() and references)
(robin_fernandes at uk dot ibm dot com)
2008-11-26 00:59:41 +00:00
Stanislav Malyshev
45572a498a restore BC for arrays
[DOC] natsort, natcasesort, usort, uasort, uksort, array_flip, array_unique
still won't work with objects
2008-11-24 18:12:17 +00:00
Arnaud Le Blanc
d69dfa4b9f MFH: initialize optional vars 2008-10-21 22:08:38 +00:00
Nuno Lopes
8a77e55566 clean some dead code (with static analysis help) 2008-09-23 15:18:26 +00:00
Felipe Pena
42feeddd40 MFH:
- Removed the undocumented object support in the leftover array functions [DOC]
  (natcasesort, natsort, array_walk, array_walk_recursive, array_unique, array_key_exists)
- Changed HASH_OF() to Z_ARRVAL_P()
- Fixed bug #45937 (array_walk and array_walk_recursive can alter private/protected object variable)
2008-08-29 03:05:43 +00:00
Lars Strojny
080157870f MFH: Allow mixed $initial (patch by Christian Seiler) 2008-08-20 20:35:40 +00:00
Felipe Pena
252d7d76a8 - MFH: New parameter parsing API 2008-08-17 22:14:14 +00:00
Felipe Pena
f2fc267e3a - MFH: New parameter parsing API (for min() and max()) 2008-08-10 17:50:44 +00:00
Felipe Pena
e304515ddb - MFH: Added parameter TSRMLS_DC in zend_is_callable() 2008-08-02 04:46:07 +00:00
Johannes Schlüter
b9f7b21ec1 MFH (DOC] Add array_replace/array_replace_recursive (Mett Wilmas) 2008-07-31 20:18:17 +00:00
Felipe Pena
a1ce847cd5 - MFH: Improved parameter handling 2008-07-24 03:07:22 +00:00
Felipe Pena
a2cc7ec96a - MFH: Fixed bug #45605 (array_uintersect_assoc gives incorrect error message) 2008-07-23 16:28:46 +00:00
Etienne Kneuss
8ceb0b6fd3 MFH: Fix resolution rule of count vs. handler 2008-07-09 21:29:52 +00:00
Matt Wilmas
572adc05e4 MFH: Initialize with length instead of 0 2008-06-02 11:20:59 +00:00
Antony Dovgal
779769563c fix uninitialized variable 2008-06-02 10:27:55 +00:00
Matt Wilmas
c1126cc5b6 MFH: Only check args once in php_array_diff_key/intersect_key, not on each iteration. This also makes sure ALL args are checked (pre-5.2.5 behavior)
- Also, use new hash_quick_del function where possible
2008-05-30 10:55:14 +00:00
Matt Wilmas
7da75d81e7 MFH: Add array_init_size() and use it where array size is known at initialization 2008-05-27 10:29:33 +00:00
Felipe Pena
d90f689d73 - Making compatible with 64bit plataform 2008-05-18 15:42:09 +00:00
Antony Dovgal
7633511047 fix compile warnings 2008-05-04 11:26:50 +00:00
Dmitry Stogov
2ecf4bb0a7 Lazy EG(active_symbol_table) initialization 2008-04-29 08:15:20 +00:00
Felipe Pena
eea093b47c MFB: Fixed bug #42177 (Warning "array_merge_recursive(): recursion detected" comes again...) 2008-03-12 19:18:42 +00:00
Felipe Pena
f7078d469c Fixed Bug #44212 (array_diff_assoc not reporting missing arguments) 2008-02-22 13:28:40 +00:00
Antony Dovgal
0970b9f5e9 MFH: recursion protection in count() 2008-02-15 09:33:09 +00:00
Felipe Pena
aefe056911 MFB: Fixed Bug #42838 (Wrong results in array_diff_uassoc) 2008-02-14 14:08:22 +00:00
Dmitry Stogov
4de1e20fbb Fixed memory leak 2008-02-14 08:46:25 +00:00
Felipe Pena
ea3a6ed11f array_slice() - Fixed behavior when NULL is given in third parameter (BC) 2008-02-12 01:31:12 +00:00
Antony Dovgal
038696fed1 MFH 2008-02-11 13:34:41 +00:00
Ilia Alshanetsky
6e9ef8e316 Fixed bug #44046 (crash inside array_slice() function with an invalid
by-ref offset).
2008-02-05 15:58:27 +00:00
Dmitry Stogov
382f1dddfa Fixed bug #43505 (Assign by reference bug) 2008-01-29 10:45:07 +00:00
Antony Dovgal
183ed5b686 MFH: fix #43596 (array_slice(): $length arg ignored when it is 0) 2008-01-29 00:39:46 +00:00
Rob Richards
90f168deae MFH: fix zts build 2008-01-25 15:52:48 +00:00
Antony Dovgal
2907ae9d73 MFH: endless loop (and stack overflow) protection in compact() 2008-01-25 13:42:36 +00:00
Antony Dovgal
67c8d8d95e MFH: fix #43559 (array_merge_recursive() doesn't behave as expected with duplicate NULL values)
patch by Felipe
2008-01-23 12:09:52 +00:00
Brian Shire
82874e094b MFH: Fix bug #42850 array_walk_recursive() leaves references, refix bug #34982 2008-01-14 22:09:52 +00:00
Sebastian Bergmann
d1dded8751 MFH: Bump copyright year, 2 of 2. 2007-12-31 07:17:19 +00:00
Jani Taskinen
9a4de086cb MFH: - Fixed bug #43541 2007-12-11 09:47:21 +00:00
Ilia Alshanetsky
98bfa2ac74 Fixed bug #43495 (array_merge_recursive() crashes with recursive arrays) 2007-12-05 19:55:31 +00:00
Ilia Alshanetsky
7192e8af15 MFB: Fixed bug #43482 (array_pad() does not warn on very small pad
numbers).
2007-12-03 14:13:27 +00:00
Ilia Alshanetsky
7cf9dcc81c Fixed bug #43386 (array_globals not reset to 0 properly on init) 2007-11-25 15:56:07 +00:00
Jani Taskinen
7f0ad5c1e9 MFH: - Fixed bug #43196 (array_intersect_assoc() crashes with non-array input) 2007-11-06 13:26:59 +00:00
Ilia Alshanetsky
35ab31e7ad Fixed bug #43197 (array_intersect_assoc() does not emit warning messages for
error inputs)
2007-11-05 23:53:23 +00:00
Jani Taskinen
b489251177 - MFH from HEAD:
. Folding tags
  . Parameter parsing
  . SPL debug info
  . array function improvements (not all yet)
  . Improvements to function calling with call_user_* functions
  . Improvements to debugging info in var_dump/print_r
# I propably forgot already something but this all was pretty close tied
# to each other so it wasn't possible to do it in parts.
2007-11-02 19:40:39 +00:00
Jani Taskinen
2d8dc07e3e MFH: fix typo 2007-10-31 13:39:26 +00:00
Scott MacVicar
3fa7ec8508 Fixed bug #43020 (Warning message is missing with shuffle() and more than one argument) 2007-10-18 14:33:14 +00:00
Yiduo (David) Wang
4b4d634cb9 MFH: Added macros for managing zval refcounts and is_ref statuses 2007-10-07 05:22:07 +00:00