Commit Graph

430 Commits

Author SHA1 Message Date
Marcus Boerger
b0c2af58f7 - Add some comment 2004-11-01 21:06:42 +00:00
Marcus Boerger
2ce7bcd742 - Allow direct access to spl class entries (SPL cannot be build shared) 2004-11-01 20:57:23 +00:00
Marcus Boerger
db47e478c5 - Use new way for global variables
- Cache class lookup
2004-11-01 12:09:46 +00:00
Marcus Boerger
8e3a8b1e8e - Add interface Countable (PECL #30113) 2004-11-01 10:45:54 +00:00
Andi Gutmans
11bcaedfc8 - Rename delete_global_variable() to zend_delete_global_variable() 2004-10-04 20:17:06 +00:00
Andi Gutmans
db507dd153 - Commit the variable fetch optimization.
- Extensions which delete global variables need to use new special function
- delete_global_variable() (I'm about to rename it) to remove them.
- Will post to internals@ or via commit messages if there's anything else.
2004-10-04 19:54:35 +00:00
Derick Rethans
7795da58e6 - Added new boolean (fourth) parameter to array_slice() that turns on the
preservation of keys in the returned array.
2004-09-15 11:50:27 +00:00
Derick Rethans
4bae5cb4d0 - MFB: Added the sorting flag SORT_LOCALE_STRING to the sort() functions which
makes them sort based on the current locale. (Derick)
2004-09-11 14:22:35 +00:00
Ilia Alshanetsky
fe73e4d851 Fixed bug #29808 (array_count_values() breaks with numeric strings). 2004-08-26 00:26:19 +00:00
Andi Gutmans
0286913937 - Use FREE_HASHTABLE() 2004-08-12 06:17:42 +00:00
Moriyoshi Koizumi
51fc7b8ea5 - Bugfix #29493 (extract(array, EXTR_REFS) misbehaves with elements referred
twice or more times). (Patch inspired by Michael Manley. Thanks.)
2004-08-10 06:00:30 +00:00
Ilia Alshanetsky
739696d2d7 Fixed but #29437 (Possible crash inside array_walk_recursive()). 2004-07-29 00:35:07 +00:00
Andrey Hristov
e64af9a898 proto fix
(thanks to dave%php.net for spotting)
2004-07-26 06:32:54 +00:00
Andrey Hristov
d77a3f92e6 make behavior a bit field 2004-07-24 09:25:52 +00:00
Andrey Hristov
5e5d2640fb add array_:
intersect_key()
intersect_ukey()
diff_key()
diff_ukey()
The first two by a patch of Cristiano Duarte. The second two were
implemented in almost the same way except one small difference.
2004-07-21 21:17:56 +00:00
Andrey Hristov
0eef82a733 fixing bug #28974 : overflow in array_slice()
The same kind of overflow appeared in array_splice(), substr() and
substr_replace()
2004-07-11 21:15:04 +00:00
Andrey Hristov
268d3d7ba3 fixing bug #28739
array_*diff() and array_*intersect() not clearing the fci cache before work.
FCI call cache was introduced in HEAD. All functions that perform sorting
of arrays clear the fci cache before work. array_*diff() and\ array_*intersect()
were somehow missed to be updated.
2004-07-11 19:20:05 +00:00
Andrey Hristov
7af08c0c34 fixing bug 29038:
EXTR_PREFIX_SAME is prevented from creating a new variable when the key
is a empty string. EXTR_PREFIX_ALL is also prevented from doing that,
but works for numbers.
2004-07-11 18:18:05 +00:00
Ilia Alshanetsky
4ebcb2ecfe Fixed bug #29008 (array_combine() does not handle non-numeric/string keys). 2004-07-11 15:23:57 +00:00
Ilia Alshanetsky
79c28f7618 Fixed bug #29049 (array sorting via user function/method does not validate
it).
2004-07-08 17:07:22 +00:00
Wez Furlong
263723ec9b Update for count_elements handler for overloaded objects. 2004-05-04 15:03:48 +00:00
Ilia Alshanetsky
c85843aec1 MFB: Revert patch for bug #27782. 2004-04-01 22:07:42 +00:00
Ilia Alshanetsky
ec4655f864 Fixed bug #27782 (Wrong behaviour of next(), prev() and each()). 2004-03-30 19:08:43 +00:00
Andrey Hristov
eaab3ef8cd this should not belong to HEAD 2004-01-28 20:25:30 +00:00
Andrey Hristov
9957fc6305 Added third parameter (optional) to array_keys for strictness. It behaves
like the "strict" parameter of in_array().
#Closing feature request #24258
2004-01-24 00:25:58 +00:00
Andrey Hristov
9e5df0c666 HEAD is now bundled only with ZE2 2004-01-17 17:33:11 +00:00
Andi Gutmans
dbeb4158d2 - A belated happy holidays and PHP 5 2004-01-08 08:18:22 +00:00
Andrey Hristov
638b940307 New array functions for doing intersection of arrays that are complementary
to array_*diff* family of functions. Namely array_uintersect(), array_uintersect_assoc(),
array_intersect_uassoc() and array_uintersect_uassoc(). Test case is also included.
#docs and news entry later.
2003-10-09 08:10:39 +00:00
Ilia Alshanetsky
31a3c87159 Fixed clobbering of the source array, when merging complex
multi-dimensional arrays. Bug reported by Lukas Smith.
2003-10-05 19:37:02 +00:00
Moriyoshi Koizumi
75bb36ed09 Fixed bug #25708 (extract($GLOBALS, EXTR_REFS) mangles $GLOBALS) 2003-10-02 22:20:48 +00:00
Andrey Hristov
40088d0bbc smash a segmentation fault 2003-09-30 15:00:36 +00:00
Andrey Hristov
02827c46be Memory leak fixed (no need of MFH since this is code specific to PHP5) 2003-09-30 12:43:58 +00:00
Hartmut Holzgraefe
075e66cc08 signed/unsigned compiler warning fixes 2003-09-26 08:09:56 +00:00
Ilia Alshanetsky
6966350013 Fixed typo. 2003-09-26 00:40:32 +00:00
Andrey Hristov
3579f212df 4 new functions :
array_udiff()
array_udiff_assoc()
array_diff_uassoc()
array_udiff_uassoc()
They work like array_diff() or array_diff_assoc() but callback function(s)
can be used to perform the comparisons. For example array_udiff_uassoc()
expects 2 callbacks are last 2 parameters one is used to compare the values
of the entries in the arrays the second to compare the keys.
Class methods are also valid callbacks. Even when the data that should be
used in the comparison is private or protected then a static method of a
class should be used (this behaviour can be seen in the regression test -
007.phpt).
2003-09-23 17:37:29 +00:00
Andrey Hristov
63d7df3e2f improve the fix for #25494. If more then one bad parameter is passed
an warning for all will be emitted.
2003-09-22 23:19:17 +00:00
Jay Smith
6c6fd76bac Fixed bug #25494 (array_merge allowing "false" as argument (silent when
non-array is passed))
# 4.3 throws E_NOTICEs, 5 errors out on non-array args as per Ilia's
# suggestion.
2003-09-11 17:40:18 +00:00
foobar
8733d2dacb revert that, it did not fix anything 2003-08-13 01:37:31 +00:00
foobar
0ee19d47d9 Fix external builds (configure run outside srcdir) 2003-08-13 01:24:27 +00:00
Ilia Alshanetsky
ed40ae2650 emalloc -> safe_emalloc 2003-08-11 23:16:54 +00:00
Ilia Alshanetsky
e5b7d5ccb4 Fixed bug #24897 (inconsistent behavior of shuffle() & array_multisort()) 2003-08-09 20:49:00 +00:00
Ilia Alshanetsky
e49964fe99 Do not assume array contains numeric values. 2003-08-09 16:43:28 +00:00
Ilia Alshanetsky
a2873880f6 Fixed bug #24980 (array_reduce() uses first element as default running
total).
Fixed memory leak that can be replicated using the function example on
http://www.php.net/array_reduce
2003-08-08 23:50:36 +00:00
Zeev Suraski
90b29aa076 Replace fast_call_user_function() with zend_call_function() 2003-08-05 10:29:03 +00:00
Zeev Suraski
2547b6f6f6 Fix bug #24652 - Sterling, do you begin to think that maybe it wasn't such
a good idea?
2003-08-04 08:38:24 +00:00
Ilia Alshanetsky
ee3e4f79df Removed unused variable. 2003-07-25 03:03:26 +00:00
Zeev Suraski
0a49c033d0 - Use the new infrastructure of zend_symtable_*() (fixes bug #24565)
- Fix bogus use of get_current_key()
2003-07-22 16:08:50 +00:00
Ilia Alshanetsky
6057160dbf Fixed bug #24198 (Invalid recursion detection in array_merge_recurcive()) 2003-06-16 17:35:16 +00:00
Andrey Hristov
2d4449caf9 silly bug 2003-06-12 15:11:11 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Sterling Hughes
295a1c665c fix array_key_exists() from HANDLE_NUMERIC() changes
# need to go through this file and find any stuff that relies on this
# change
2003-06-05 13:58:14 +00:00
Sterling Hughes
3c6fd35007 initialize these to NULL 2003-05-20 18:18:56 +00:00
Sterling Hughes
9ac50a13d7 convert array functions to use fast_call_user_function(), gives a nice
performance win.
2003-05-20 16:46:53 +00:00
Moriyoshi Koizumi
4e9e9c6e21 Fixed bug #22463 and bug #23581 2003-05-11 06:36:37 +00:00
Sara Golemon
07c679064a Bug Fix (22433). When the bottom of a range() is chr(0) or the top is chr(255), the for loop carries over and never exits. 2003-05-02 00:58:02 +00:00
Moriyoshi Koizumi
0c5548e636 Fixed implicit cast issue with is*() and to*() functions 2003-04-16 21:40:48 +00:00
Sara Golemon
465bb61357 Kludgy fix for floating point drift causing problems like range(1.0,1.5,0.1) == array(1.0,1.1,1.2,1.3,1.4); 2003-04-03 18:33:05 +00:00
Rasmus Lerdorf
4b343a0562 MFB 2003-04-01 21:47:21 +00:00
Ilia Alshanetsky
3db5278dcc CS 2003-03-27 18:57:53 +00:00
Andrey Hristov
8c2dbd5f0f additional speedup for array_shift(). No need to rehash if the removed element's
key is not scalar and elements with scalar keys are already well numbered
(sequentially from 0) for some reason. This is the case if the leading
elements have no scalar indexes.
2003-02-22 13:55:11 +00:00
Andrey Hristov
94040a28ce rehash only in case something is changed.
#lowers the execution time in half on my machine on array with 1000 elements
#with nonscalar keys. Maybe it can be optimized further.
2003-02-22 10:54:26 +00:00
foobar
20f9b6d02c - Fixed bug #22088 (array_shift() leaves next index to be +1 too much) 2003-02-06 15:27:53 +00:00
Ilia Alshanetsky
f12a6b7663 Added array_walk_recursive() function that can apply array_walk recursively
to an array.
2003-02-05 17:56:08 +00:00
foobar
07a9729071 - Fixed bug: #21998 (array_pop() did not reset the current array position)
# This behaves now same as in PHP 4.2.3
2003-02-03 16:57:02 +00:00
Ilia Alshanetsky
38ad0e9104 zend_error -> php_error_docref. 2003-01-24 16:29:40 +00:00
Ilia Alshanetsky
8a9e09a44a ARG_COUNT(ht) -> ZEND_NUM_ARGS(). 2003-01-21 14:56:40 +00:00
Andrey Hristov
1cdc956637 added array_combine().
Creates an array by using the elements of the first parameter as keys and
the elements of the second as correspoding keys. Error is thrown in case
the arrays has different number of elements. Number of elements 0 is not
valid for both parameters.
2003-01-13 18:12:23 +00:00
Moriyoshi Koizumi
f962ba6abb Fixed small leaks in array_map() in case the first parameter is NULL like
array_map(NULL, array(...));
2003-01-03 05:05:12 +00:00
Sebastian Bergmann
b506f5c8f8 Bump year. 2002-12-31 16:08:15 +00:00
Ilia Alshanetsky
fbcee73c8c Make range operate on the copies of the parameters rather then modify the
actual parameters.
2002-12-25 20:02:03 +00:00
Ilia Alshanetsky
3a4bf3f904 When low & high are the same return an array containing the low value.
Added support for float values and handling of numeric values being passed
as strings.
Added a test case for range().
2002-12-20 17:16:31 +00:00
Moriyoshi Koizumi
4974f268a6 @- Let array_search() accept objects as a needle under ZendEngine2. (Moriyoshi) 2002-12-09 15:54:38 +00:00
Ilia Alshanetsky
ed7c3bfe0e Fixed bug #20865, array_key_exists() could not locate NULL keys. 2002-12-06 17:35:52 +00:00
Ilia Alshanetsky
c668055159 Remove pointless checks for array_init() return values. 2002-12-05 22:28:02 +00:00
Moriyoshi Koizumi
7bf4090efb Fixed segfaults of array_walk() when keys are passed to cb by reference.
Fixed bug #12776.
2002-12-04 16:41:28 +00:00
Moriyoshi Koizumi
242ddba326 Fixed leaks in array_walk() 2002-12-03 15:02:06 +00:00
Moriyoshi Koizumi
98dace883e Improved the error reporting portion of array_walk() as suggested by Markus 2002-11-26 22:12:40 +00:00
Moriyoshi Koizumi
3fd513f32a Prevent too many error reports from being displayed 2002-11-26 21:51:37 +00:00
Moriyoshi Koizumi
61b3d5ccb5 Fixed incorrect error messages of array_walk() in case the callback is
specified in an array form
2002-11-26 21:21:32 +00:00
Moriyoshi Koizumi
44c98c7e3f Fixed some odd behaviours of range() 2002-11-23 11:27:56 +00:00
Moriyoshi Koizumi
fb20eae7fc Fixed bug #20381 2002-11-15 02:16:41 +00:00
Jon Parise
92df58dab6 @- Added an optional "step" parameter to range(). (Jon) 2002-11-14 05:46:10 +00:00
John Coggeshall
253cecd43a Added GLOB_ONLYDIR and GLOB_BRACE for compatiable systems for the glob()
function.

Modified the layout and some minor logic in the experimental webHarness()
test class

Added Whitespace accidently to array.c :)
2002-11-13 13:31:33 +00:00
Ilia Alshanetsky
6d57337cda Fixed a memory leak in array_fill().
The refcount hack is now done for ZE1 only and is slightly faster then the
original.
After this patch array_fill() can consistently create arrays with >65k elements.
2002-11-05 16:19:19 +00:00
Sterling Hughes
f61889e72d revert patch 2002-10-10 19:24:45 +00:00
Sterling Hughes
2c4aa71d32 clean these functions up using zend_parse_parameters and nuke the use of
HASH_OF() which is inappropriate in these cases...
2002-10-09 18:29:45 +00:00
Sterling Hughes
521a9bdadc small cleanups... 2002-10-09 17:15:56 +00:00
Andrey Hristov
9ee1ce156f ws fixes.
#hope not to be flamed :)  what a wonderful day.
2002-09-21 16:10:33 +00:00
Andrey Hristov
a920f00479 New function added - array_intersect_assoc() similar to array_intersect()
but the keys are also used in the comparison. So the result is a subset of
the result of array_intersect().
Test will be committed too.
2002-09-21 14:50:04 +00:00
Andrey Hristov
23d3cd79c1 Fixing my zts fix.
#Sorry Edin
2002-09-12 08:20:37 +00:00
Andrey Hristov
ad92434638 Removed magic numbers about the behavior of php_array_diff - proposed by
Andi and Jon Parise.
#It is strange that I commited ZTS code but after that Edin fixed ZTS build
#when I updated - it wasn't ZTS. hmmm. anyway fixing ZTS build.
2002-09-12 08:04:42 +00:00
Edin Kadribasic
705e72f363 Fix ZTS build. 2002-09-11 23:09:11 +00:00
Derick Rethans
aaf920f9d5 - Little whitespace changes 2002-09-11 18:40:56 +00:00
Andrey Hristov
afdfe38ef3 New function added : array_diff_assoc() . Like array_diff() but does
additional checks on key values. Test script will be added too.
#My first patch . it feels strange :)
2002-09-11 18:13:48 +00:00
Edin Kadribasic
333b01b041 Fixed ZTS build. 2002-09-10 22:36:43 +00:00
Andrei Zmievski
dd7cf22443 @- Fixed array_merge_recursive() to avoid problems with merging cyclical
@  arrays (bug #16064). (Andrei)
2002-09-10 18:34:16 +00:00
Andrei Zmievski
2c6154d7aa @- Added ability to extract() variables as references via OR'able EXTR_REFS
@  flag. (Andrei)
2002-09-09 20:05:20 +00:00
Marcus Boerger
149ad05b4f php_error_docref
#New conversion available at: http://docref.txt.marcus-boerger.de
2002-08-24 01:19:28 +00:00
Marcus Boerger
95e933fc99 Fixes array test 004.phpt. Nice copy paste error. 2002-08-21 11:23:44 +00:00
Dan Kalowsky
dee21adc3d Fix for bug #18401, makes shuffle() properly generate all possibilities.
Patch provided by Adam Trachtenberg <adam@trachtenberg.com>
2002-08-15 19:09:05 +00:00
Brad LaFountain
c90764d753 one last fix for array_shift 2002-08-03 00:40:46 +00:00
Brad LaFountain
9b0553c390 array_pop wasnt setting next index 2002-08-01 17:34:31 +00:00
foobar
922b7596a2 That was not correct.. 2002-08-01 16:44:47 +00:00
foobar
6df2b90c05 Reset index when doing array_pop() 2002-08-01 16:39:52 +00:00
foobar
06b3dd122f Nuke compile warning. 2002-08-01 12:07:15 +00:00
foobar
9d62cd7d45 - Removed the DOS line endings
- Changed the '//' comment (this is C, not C++) to /* */
# Brad, use some editor which works..
2002-08-01 12:06:46 +00:00
Brad LaFountain
4f5bd6b7d4 made array_shift re-index like it did before previous fix 2002-08-01 04:38:11 +00:00
foobar
9fe39b9604 Reverted the patch..it breaks the original behaviour of at least array_shift. 2002-07-31 13:49:50 +00:00
Brad LaFountain
70fb744365 fixed bugs 16063 and 16068
increased preformance of array_pop and array_shift
2002-07-30 22:54:12 +00:00
Derick Rethans
392a452c80 Silence warning 2002-07-08 07:33:22 +00:00
Derick Rethans
cc920570fd Unify error messages 2002-07-08 07:32:59 +00:00
Derick Rethans
7faa669915 - Fix for bug #14580: Made key() binary safe 2002-07-08 07:02:55 +00:00
Derick Rethans
1bf9b3d736 - Fix for bug #17654 2002-06-29 15:39:41 +00:00
Stig Venaas
7853832234 Made array_unique() always keep the first occurrences of duplicates,
making the behavior easier to understand, and maybe more useful.
2002-06-18 19:37:59 +00:00
Jan Lehnardt
df226a54d9 - WS-fixes 2002-06-18 13:16:33 +00:00
Jan Lehnardt
a8de8ec90c - whitespace fix 2002-06-10 16:34:25 +00:00
Harald Radi
8e19555608 fix the build 2002-06-10 12:21:58 +00:00
Andrei Zmievski
7f4c12b006 Fix bug #7045: shuffle() now provides consistent distribution of values
in the array.
2002-06-10 02:28:32 +00:00
Edin Kadribasic
e7ab5766d6 Fixed array_rand() on ZTS platforms.
@- Fixed array_rand() on thread-safe platforms such as Windows. (Edin)
2002-06-03 17:49:48 +00:00
Andrei Zmievski
1668570e4d Changing email address. 2002-05-13 17:28:38 +00:00
Andrei Zmievski
5ff970ba7d Fix Bug #14795. 2002-04-24 15:23:43 +00:00
Andrei Zmievski
4fc01022e6 Fix unwanted type conversion in array_merge_recursive (Bug #14990). 2002-04-24 15:01:53 +00:00
Sebastian Bergmann
6adb33006b Fix TSRMLS_CC. 2002-03-12 07:20:00 +00:00
Yasuo Ohgaki
e953dba0d7 Make use of TSRMLS_C/D 2002-03-12 06:56:57 +00:00
Zeev Suraski
bb685a402f Fix php_splice() to work with large values 2002-03-01 12:00:05 +00:00
Andi Gutmans
284eaf34cc - Add TSRMLS_FETCH()'s needed for the new object overloading in ZE2. 2002-02-05 20:43:49 +00:00
Andrei Zmievski
441c583a2c Converted extract() to use smart_str for variable name manipulation. This
sped it up a bit.
2002-02-01 20:17:32 +00:00
Rasmus Lerdorf
0d139d3c27 (extraxt) add EXTR_IF_EXISTS and EXTR_PREFIX_IF_EXISTS flags
@- Added EXTR_IF_EXISTS and EXTR_PREFIX_IF_EXISTS flags to extract()
@   EXTR_IF_EXISTS only extracts a variable if it already exists
@   EXTR_PREFIX_IF_EXISTS only extracts the variable if it exists and
@   then it prepends the prefix to it.  ie. if $PATH exists then
@   extract($_ENV,EXTR_PREFIX_IF_EXISTS,'e') would result in $e_PATH
@  This lets you do $a = $b = $c = true; extract($_REQUEST,EXTR_IF_EXISTS);
@  and you only get the global request variables you have defined imported
@  into your symbol table.  (Rasmus)
2002-01-25 09:01:02 +00:00
Andrei Zmievski
ddc039d0f5 Fix the recursive counting, it was broken for associative or non-sequential
arrays. Also update NEWS file.
2002-01-10 21:31:06 +00:00
Derick Rethans
aee570302f - Fix bug introduced in earlier patch 2002-01-09 16:03:36 +00:00
Derick Rethans
cef0a461f9 - Added extra parameter to count() that recursively counts elements in an
array and added is_array_multidimensional(). (patch by Vlad Bosinceanu
  <glipy@fx.ro>)
2001-12-29 20:59:59 +00:00
Andi Gutmans
211d712c59 @ Fix bug in krsort() where an extra character was being compared (Andi)
- Fix bug in krsort() where an extra character was being compared (Andi)
2001-12-29 20:47:25 +00:00
Zak Greant
2c9f5d8a91 Modified array_walk, arsort, asort, krsort, ksort, rsort, shuffle, sort,
uasort, uksort and usort.

Corrected prototype comments for all.

Converted to use zend_parse_parameters, except for the u.?sort functions.

Changed return values for failure from implicit NULL to explicit FALSE in
asort(), krsort(), and ksort().

Changed pval to zval in the u.?sort functions.

Added test to help ensure that fixes to code do not change function
behavior. Tests are quite large (~237k) but compress down to ~16k.
Please let me know if this is a problem!
2001-12-22 11:49:56 +00:00
Sebastian Bergmann
38933514e1 Update headers. 2001-12-11 15:32:16 +00:00
Derick Rethans
78e4644fa1 - Renaming key_exists to array_key_exists
@- Renamed key_exists tp array_key_exists. (Derick)
#- Not sure if this belongs in NEWS, but it was already in a released
#  version. And yes, I know I'm breaking BC here, but as it was not documented
#  yet, that doesn't matter.
2001-11-11 18:28:43 +00:00
Andrei Zmievski
2890b57e46 @- Added array_chunk() function that splits an array into chunks of specified
@  size. (Andrei)
2001-10-27 05:11:15 +00:00
Rasmus Lerdorf
72fc6bc4b1 As suggested on php-dev, array_fill() is probably a better name for this
function.
2001-10-23 18:46:35 +00:00
Rasmus Lerdorf
d98c96fc6c Use references instead of making a copy each time in array_init(). About
twice as fast for a high number of elements.  2.80 seconds for the copy
of 1,000,000 elements and 1.39s for the reference version.  Need to chunk
it every 62k or so because refcount is a short.
2001-10-22 20:49:27 +00:00
Rasmus Lerdorf
4d60dbb9ef Oops, leftover crud 2001-10-21 07:45:32 +00:00
Rasmus Lerdorf
798ec79319 Motivated by bug #13607 I wrote up a simple array_init() function that
lets you quickly create an array and initialize each element to a certain
value.
@ Add array_init() function (Rasmus)
2001-10-21 07:42:35 +00:00
Jeroen van Wolffelaar
78b881f389 Fix naming inside php_search_array, comp_func is not a compare function. 2001-10-07 13:49:08 +00:00
Jeroen van Wolffelaar
62feefddc7 Fix array_search and in_array. Now binary safe, and faster (returns when
found, and doesn't duplicate the key each time, but only when necessary)

Patch also by Edin Kadribasic
2001-10-05 21:58:41 +00:00
Jeroen van Wolffelaar
89ea50a588 Fix bug 13567 and don't depend on a boolean int-value to be either 1 or 0 2001-10-05 20:14:33 +00:00
Edin Kadribasic
e78b61542d Added array_change_key_case() function that returns array with
with all string keys lowercased or uppercased
@- Added array_change_key_case() function that returns array with
@  with all string keys lowercased or uppercased (EdinK)
2001-10-05 18:38:53 +00:00
Sterling Hughes
bcb426a207 Merge in qsort changes 2001-09-17 21:02:53 +00:00
Sterling Hughes
97fea0931c Make rand thread safe when ZTS is defined. 2001-09-16 20:49:57 +00:00
Derick Rethans
78747bd2df - Don't wrap lines... this is annoying while coding. 2001-09-09 13:29:31 +00:00
Sterling Hughes
ff2bc83c08 remove ARG_COUNT(ht)
# Is there any reason that the set_compare_func call is passed SORT_STRING
# instead of SORT_REGULAR??
2001-09-09 11:03:31 +00:00
foobar
42b5521af5 revert bad commit. 2001-09-05 19:47:55 +00:00
Daniel Beulshausen
9b8886410d fix zts+win32 build 2001-09-04 02:19:30 +00:00
Andi Gutmans
1ecd31b66c - Fix thread safe mode.
- Please don't use Java style function braces.
2001-09-03 20:21:00 +00:00
Jeroen van Wolffelaar
0cb6a31906 Fix array_rand and array_suffle to use php_rand correctly 2001-09-03 01:54:04 +00:00
Jeroen van Wolffelaar
b0300e26df Fix prototype 2001-09-03 01:46:03 +00:00
Jeroen van Wolffelaar
f7306ce010 Merge RAND_REDESIGN into MAIN 2001-09-03 01:06:23 +00:00
Andrei Zmievski
392e1edee8 @- Made in_array() and search_array() allow the needle to be an array in
@  itself. (Andrei)
2001-08-31 04:52:10 +00:00
Rasmus Lerdorf
563ffb8984 Kill a warning 2001-08-28 21:50:37 +00:00
Andrei Zmievski
cae9763d0a @- Fixed a crash bug in array_map() if the input arrays had string or
@  non-sequential keys. Also modified it so that if a single array is passed,
@  its keys are preserved in the resulting array. (Andrei)
2001-08-24 02:58:23 +00:00
Zeev Suraski
e140b35b04 API update 2001-08-21 12:57:53 +00:00
Zeev Suraski
c0404f4631 Whitespace 2001-08-11 17:03:37 +00:00
Andrei Zmievski
32440e3051 Fix a couple of leaks. 2001-08-07 16:41:33 +00:00
Sascha Schumann
23b9300fd1 more tsrm cleanup 2001-08-06 03:50:52 +00:00
Andrei Zmievski
bffbe675f9 @- Fixed a crash bug in array_map() when NULL callback was passed in. (Andrei) 2001-08-04 16:54:20 +00:00
Jeroen van Wolffelaar
49c16290f3 - Fix array_sum to switch to float on overflow. Fixes bug#12505 2001-08-03 19:18:51 +00:00
Zeev Suraski
c43806f415 Zend compatibility patch 2001-07-30 08:24:42 +00:00
Zeev Suraski
7b1c400631 More TSRMLS_FETCH annihilation (Zend compatibility patch) 2001-07-30 04:58:07 +00:00
Zeev Suraski
d87cc976e1 Redesigned thread safety mechanism - nua nua 2001-07-28 11:36:37 +00:00
Zeev Suraski
fe6f8712a4 - Get rid of ELS_*(), and use TSRMLS_*() instead.
- Move to the new ts_allocate_id() API
This patch is *bound* to break some files, as I must have had typos somewhere.
If you use any uncommon extension, please try to build it...
2001-07-27 10:16:41 +00:00
Rasmus Lerdorf
45d71e2951 Make range() function smarter
@ - Improve range() function to support range('a','z') and range(9,0)
@   types of ranges.  (Rasmus)
2001-07-09 20:36:47 +00:00
Andi Gutmans
c977f29862 - Use ALLOC_HASHTABLE() instead of emalloc(sizeof(HashTable)) 2001-06-19 16:03:35 +00:00
Rasmus Lerdorf
81e2cf03ac Fix folding and clean up some extensions 2001-06-06 13:06:12 +00:00
Rasmus Lerdorf
25c3a3a39d vim-6 does folding - clean up a bunch of missing folding tags plus
some misguided RINIT and RSHUTDOWN calls in a few fringe extensions
2001-06-05 13:12:10 +00:00
John Donagher
639b957f74 Add missing end-folding delimiter 2001-05-23 01:50:11 +00:00
Andrei Zmievski
f071e8c566 Always free the callback_name when using zend_is_callable(). 2001-05-10 16:30:12 +00:00
David Croft
34f03f2c5c @ - Added key_exists() to check if a given key or index exists in an
@ array or object (David Croft)
Added key_exists() to check if a given key or index exists in an array or object
2001-04-30 04:06:09 +00:00
Andrei Zmievski
221a5a60b6 Use correct string length. 2001-04-02 13:20:16 +00:00
Andrei Zmievski
d9aa966a44 @- Added array_map() function that applies a callback to the elements
@  of given arrays and returns the result. It can also be used with a
@  null callback to transpose arrays. (Andrei)
2001-03-19 21:20:02 +00:00
Andrei Zmievski
770c66125d @- Added array_filter(), which allows filtering of array elements via
@  the specified callback. (Andrei)
2001-03-16 20:46:33 +00:00
Andrei Zmievski
f7f2cf9de5 All user callbacks should be to EG(function_table). 2001-03-16 19:51:08 +00:00
Frank M. Kromann
6195f14633 Fixing build on Win32 by adding missing BLS_FETCH(); 2001-03-16 19:48:40 +00:00
Andrei Zmievski
561cc74389 @- Fixed all relevant array functions to avoid moving the internal array
@ pointer during operations. (Andrei)
2001-03-16 19:29:23 +00:00
Stanislav Malyshev
0fa068e1fa Prevent memory leak 2001-03-12 10:14:00 +00:00
Stanislav Malyshev
be83ba17da Use hash position with array_flip 2001-03-12 08:07:00 +00:00
Andrei Zmievski
40dd7eef96 This will have to do until the docs come along. 2001-03-12 03:10:15 +00:00
Andrei Zmievski
d73ef12429 @- Added array_reduce(), which allows iterative reduction of an array
@  to a single value via a callback function. (Andrei)
- Added array_reduce(), which allows iterative reduction of an array
  to a single value via a callback function.
- Fixed usage of zend_is_callable() in PCRE.
2001-03-12 03:06:53 +00:00
Andi Gutmans
eb6ba01d1c - Fix copyright notices with 2001 2001-02-26 06:11:02 +00:00
James Moore
118c015529 Adding php_rand() and php_srand(seed) as a wrapper around random, lrand48 and rand. 2001-02-22 00:24:19 +00:00
Andrei Zmievski
8d7972b69b Fix memory leak. 2001-02-21 17:22:26 +00:00
Jason Greene
ffa08fc26e Changed default behavior of array_search to match in_array
(strict was default on, and is now default off)
2001-02-20 16:44:57 +00:00
Andrei Zmievski
1424e36315 Rename to array_search(). 2001-02-20 14:23:03 +00:00
Jason Greene
1888a98a4b Moved the core of in_array into the function php_search_array, which is called by
in_array and search_array (new)

@ Added search_array which works similar to in_array but returns
@ the key instead of a boolean. (jason@php.net)
2001-02-20 05:36:40 +00:00
Jim Jagielski
e541a27eed For those lucky systems with both random() and *rand48(), the random()
family is the prefered choice. So if both exist, we now choose that.
2001-02-06 16:27:08 +00:00
Andrei Zmievski
21aeba29d0 @- Fixed extract() to properly prefix numeric keys when EXTR_PREFIX_ALL is
@  used. (Andrei)
@- Added EXTR_PREFIX_INVALID flag to extract() to automatically prefix
@  string keys that do not constitute valid variable names. (Andrei)
2001-01-22 17:27:02 +00:00
Andrei Zmievski
145f60a485 @- Changed extract() to check that prefixed name is a valid one. (Andrei)
Changed extract() to check that prefixed name is a valid one.
Optimized extract() a bit too.

# It'd be nice if someone made regression tests for extract().
2001-01-08 21:57:14 +00:00
Andrei Zmievski
74175e429d @- Changed extract() to return the number of variables extracted. (Andrei) 2001-01-08 20:57:59 +00:00
Stig Venaas
c5b11042b0 Hopefully solves some bad behavior in array_unique(), array_intersect()
and array_diff(). Now using SORT_STRING instead of SORT_REGULAR
@- Fixed misbehavior of array_unique(), array_intersect() and array_diff();
@  could in certain cases give wrong result or segfault (Stig Venaas)
2000-12-28 23:50:42 +00:00
Andrei Zmievski
a1614b8411 (PHP preg_replace) Fix to allow proper escaping of captured subpattern
references in the replacement string.
(PHP array_sum) Check that argument is an array.
2000-12-22 16:31:42 +00:00
Zeev Suraski
aa6d2ac5d0 Heads up people!
Updated the get_current_key() API - the relevant authors, please take
a look at the updated code and make sure it's ok...
2000-12-22 12:57:09 +00:00
Andrei Zmievski
753e46657f Make php_array_merge() an API function. 2000-12-11 05:36:24 +00:00
Sascha Schumann
949b0893dc The result of conv_z_macros and some manual conversion of
"return_value.*=.*IS_STRING" constructs to RETVAL_STRINGL.
2000-11-27 13:31:21 +00:00
Stig Venaas
a5c75761c2 Fixed memory leak in array_diff and array_intersect, was introduced with
last change.
2000-11-03 07:20:35 +00:00