Commit Graph

137 Commits

Author SHA1 Message Date
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
Sascha Schumann
9866d899e9 Namespace protect mergesort (caused conflict on Darwin). 2000-11-02 15:32:52 +00:00
Andrei Zmievski
d4cf62f86f @- Fixed array_rand() to shuffle results when the number of requested
@  elements is the same as the number of elements in the array. (Andrei)
2000-10-27 14:08:33 +00:00
Andrei Zmievski
a35bf41670 Added array_sum() function. 2000-10-25 17:40:11 +00:00
Stig Venaas
e8c7fd7f5f Fixed array_type_data_compare(). I want strings to always differ from
numbers, but not say 7 and 7.0 to differ.
2000-10-22 11:18:21 +00:00
Stig Venaas
4edb210028 Made array_unique use array_type_data_compare instead of array_data_compare 2000-10-21 18:12:30 +00:00
Stig Venaas
508d1993ed Added array_type_data_compare which is like array_data_compare but
compares type first. Also rewrote array_intersect and array_diff,
so that the order is not changed.
@- Made array_intersect and array_diff not alter order (Stig Venaas)
2000-10-21 17:48:11 +00:00
Andi Gutmans
c54047b0b0 - Change to Z_BVAL macro 2000-09-19 18:19:02 +00:00
Zeev Suraski
c45b1c2c8b - Fix warnings
- Fix URL scanner startup crash
2000-09-19 17:37:34 +00:00
Andrei Zmievski
5470222d70 Forgot to update proto. 2000-09-12 19:04:50 +00:00
Andrei Zmievski
34574352be @- Added second argument to array_reverse() that indicatese whether
@  the original array keys should be preserved. (Andrei)
2000-09-12 19:03:59 +00:00
Andrei Zmievski
d89c5b231c @- Updated array_walk() to be able to accept array($obj, 'method')
@  syntax for the walk function. (Andrei)
2000-08-22 18:39:29 +00:00
Hartmut Holzgraefe
c1ceeaf830 typo fix in array_diff error message, fixes bug #6236 2000-08-18 12:45:01 +00:00
Hartmut Holzgraefe
867160a751 minor typo fix in proto 2000-08-18 12:28:28 +00:00
Hartmut Holzgraefe
920f6fd1fc ooops - theese new parameters are optional 2000-08-04 09:24:36 +00:00
Hartmut Holzgraefe
6a93f284bc added new second parameter to osrt functions in the protos 2000-08-04 09:19:38 +00:00
David Croft
83513d9580 Changed lots of PHP 3 licence headers to PHP 4, mainly in .h files.
Added a few RCS $Id$ tags.

# Note: I have avoided changing any .h files if the corresponding .c file
# had not already been changed as I am not sure if there are any legal
# issues here. So some extensions still have PHP 3 headers.
2000-07-24 01:40:02 +00:00
Andrei Zmievski
8f96ea6b20 *** empty log message *** 2000-07-17 13:37:26 +00:00
Andrei Zmievski
c9c425d625 Updated comments. 2000-07-11 16:51:04 +00:00
Andrei Zmievski
3ac0ae9dff @- Improved array_multisort() to be able to specify sort type as well sort
@  order. Incidentally, it can be used to sort multi-dimensional arrays
@  as well. (Andrei)
2000-07-11 16:48:03 +00:00
Egon Schmid
cd3973612b Not every argument type is mixed. 2000-07-04 20:31:54 +00:00
Egon Schmid
f2457db5f3 Missed a two liner. 2000-07-04 19:41:31 +00:00
Andrei Zmievski
49365eea79 Oops, didn't mean to commit that. 2000-06-28 20:09:04 +00:00
Andrei Zmievski
29e8e565c6 @- Added an optional parameter to preg_replace() that can be used to
@  specify how many replacements to make. (Andrei)
2000-06-28 20:07:26 +00:00
Egon Schmid
5f98304f55 The second array_merge() is now array_merge_recursive(). 2000-06-25 13:21:37 +00:00
Andrei Zmievski
10b5f74855 One more place. 2000-06-18 03:45:08 +00:00
Andrei Zmievski
789aa48043 @- Modified in_array() to not touch array pointer. (Andrei) 2000-06-18 03:43:58 +00:00
Zeev Suraski
da66298659 - Fix a couple of wranings in the FTP code and in parsedate.y
- Be safer with LC_MESSAGES
- Align with the latest Zend change in call_user_function_ex()
2000-06-17 16:49:03 +00:00
Stig Venaas
2e738b519f Forgot to set_compare_func in the new array functions, had only tested
with older source.
2000-06-11 12:20:42 +00:00
Stig Venaas
f18b903d5f Changed array_subtract to array_diff 2000-06-10 19:09:56 +00:00
Stig Venaas
99f151f1bd Adding fuctions array_unique, array_intersect and array_subtract. 2000-06-10 18:58:45 +00:00
Andi Gutmans
3701bc4207 - ARG_COUNT(ht) -> ZEND_NUM_ARGS() mega patch 2000-06-05 19:47:54 +00:00
Stanislav Malyshev
a23c64ee8b \0 is part of they key, but not of the variable 2000-06-04 15:43:04 +00:00
Zeev Suraski
5673378ea6 - Allow all functions that receive user-defined function callbacks to accept
an array that contains an object and a method name, in place of a function
  name, e.g. usort($array, array($obj, "ObjSort"))
(I checked the code in array.c and basic_functions.c, other code which uses
call_user_function() may still force the function_name argument to be of type
IS_STRING, which prevents this feature from working - and is no longer necessary)
2000-06-03 04:16:46 +00:00
Andrei Zmievski
4c818aec33 @- Added third argument to in_array(). If it's true, then in_array()
@  will use strict comparison instead of the default one. (Andrei)

Fixes bug #4753
2000-06-01 13:52:08 +00:00
Andrei Zmievski
01a4220954 @- Added array_merge_recursive() that will recursively merge values
@  under the same keys. (Andrei)
2000-05-30 17:03:56 +00:00
Andrei Zmievski
4197a68602 @ Fixed min()/max() segfault. (Andrei) 2000-05-24 19:07:17 +00:00
Zeev Suraski
e043439ff6 Update the license with the new clause 6 2000-05-18 15:34:45 +00:00
Andrei Zmievski
aa09d60d7d (PHP array_multisort) Fix the array_size test. 2000-05-18 12:29:45 +00:00
Andrei Zmievski
a859e83392 Update for sort functions - user can now specify sort type. 2000-05-18 00:47:57 +00:00
Andrei Zmievski
fdbea075fa @- Added array_rand() function. (Andrei) 2000-05-09 19:27:00 +00:00
Andrei Zmievski
105be1513d Fix an empty arrays condition and optimize a bit.
@ Fixed a crash in array_multisort() that happened when empty arrays
@ were passed to it. (Andrei)
2000-04-28 14:01:08 +00:00
Andrei Zmievski
9ffd5b5595 @- array_walk() now automatically resets the array. (Andrei) 2000-04-13 18:57:37 +00:00
Andrei Zmievski
c7100c4a1a Added natural comparison/sorting routines using code from Martin Pool.
@- Added natural comparison/sorting routines strnatcmp(), strnatcasecmp(),
@  natsort(), and natcasesort(). These are useful for comparing and sorting
@  strings that contain numbers. Based on the code from Martin Pool
@  <mbp@humbug.org.au>. See http://www.linuxcare.com.au/projects/natsort/
@  for more info on natural sorting. (Andrei)
2000-04-12 19:39:02 +00:00
Egon Schmid
3e2a1034cb Return type was missing. 2000-04-04 08:52:57 +00:00
Sterling Hughes
68d4298e71 #yikes stripes, didn't see that one
#its time to go to bed
Re-fixed return value of min and max
2000-03-29 12:43:13 +00:00
Sterling Hughes
cc2c9d8f0f 1. Holy protos Batman.
2.  Converted some functions from using "return" to RETURN_FALSE
2000-03-29 11:19:01 +00:00
Andrei Zmievski
7b02e9fc35 @- Fixed extract() for EXTR_PREFIX_SAME and EXTR_SKIP cases. (Andrei) 2000-03-24 14:56:19 +00:00
Stig Bakken
99e0b36321 @Cleaned up extension namespace (Stig)
Cleaned up extension namespace, and changed ext/standard into one single
extension.
2000-03-06 20:37:11 +00:00
Stig Bakken
d23e5d837a @- Implemented default_charset and default_mimetype config directives (Stig)
Implemented default_charset and default_mimetype configuration directives.
Started implementing ticks in PHP.
2000-02-25 21:27:03 +00:00
Egon Schmid
284491887f There are more '|' and should be mixed. 2000-02-24 15:06:33 +00:00
Andrei Zmievski
c401bbe22e Fix proto. 2000-02-24 14:07:35 +00:00
Egon Schmid
fe615efb5c More protos. 2000-02-24 08:39:02 +00:00
Zeev Suraski
86fa2aade2 the pipe is breaking all the time 2000-02-19 23:41:32 +00:00
Andrei Zmievski
a60e91b313 (request_shutdown) Prevent infinite loop on shutdown if there is an error
in shutdown function.
(php_array_walk) Print a warning if the walk function doesn't exist.

Split shutdown function call into a separate function that's called with
zend_hash_apply() instead of as destructor to keep hash consistent.

This fixes bug #3419.
2000-02-11 21:14:42 +00:00
Zeev Suraski
80bdd19e03 Fine tune Andi's patch 2000-02-11 15:59:30 +00:00
Andi Gutmans
29280bb9ec - Get rid of some more evil MSVC5's and switch standard/ to use PHP_WIN32 2000-02-10 21:53:56 +00:00
Zeev Suraski
c12aa454ff Compile fixes 2000-02-05 15:44:20 +00:00
Zeev Suraski
3a816341f9 Cleanup patches 2000-02-05 15:16:12 +00:00
Andi Gutmans
bdefd5da15 - Change IS_UNSET -> IS_NULL 2000-01-04 13:22:58 +00:00
Sascha Schumann
43ae2bffbb Happy Y2K patch! Happy new year (or the new millennium, depending on whether
you start counting at 0 or 1).
2000-01-01 01:32:05 +00:00
Zeev Suraski
ccb4b18348 Happy new year (especially to Thies :)
- Zend branch patches merged in - get the PHP tree uptodate
- Clean
1999-12-31 14:06:31 +00:00
Zeev Suraski
235386b245 Change ALLOC_ZVAL() semantics 1999-12-26 21:21:33 +00:00
Andi Gutmans
3f6e00e48d - Use ALLOC_ZVAL() in PHP. Finding the places to put FREE_ZVAL(z) is much
more tricky and I'm not sure how many places this is. zval allocations
  were only made directly in 11 places.
1999-12-24 15:43:39 +00:00
Andrei Zmievski
80bab9d939 We're using ZVAL's now. 1999-12-21 17:14:31 +00:00
Zeev Suraski
489de5dce2 Support the latest update to call_user_function_ex() 1999-12-19 18:58:27 +00:00
Zeev Suraski
a1ad2872ee - The tree compiles again 1999-12-18 22:40:35 +00:00
Andrei Zmievski
457a13dac5 Finished array_multisort() function. Basically it sorts multiple arrays
similar to ORDER BY SQL clause.
@ Added array_multisort() function. (Andrei)
# Docs are coming soon
1999-12-13 19:42:26 +00:00
Sascha Schumann
9278d9d911 Remove unnecessary ARRAYLS_FETCH() calls 1999-12-12 10:50:30 +00:00
Andrei Zmievski
dbaf6c5c65 Added array globals in preparation for multisort() changes. 1999-12-11 22:42:01 +00:00
Sascha Schumann
3b515617a4 Make array.c thread-safe 1999-12-01 17:21:52 +00:00
Thies C. Arntzen
5cc10ecec2 @- Fixed float-compare in min(),max(),a[r]sort(),[r]sort(). (Thies)
convert_to_long() after compare_function() destroys float-compares!
1999-11-21 17:13:39 +00:00
Egon Schmid
0929985414 Maybe later on today. Must buy some beer first. 1999-11-21 14:06:30 +00:00
Thies C. Arntzen
2451ff5368 @- Implemented array_flip() function. Returns input-array with key, value
@  flipped. (Thies)
(PHP array_flip) new function. no clash detection, only works for IS_STRING and IS_LONG datatypes in src-array.
1999-11-21 12:37:53 +00:00
Thies C. Arntzen
ee1380e6b0 -renamed some macros
-return_value_used now used in a few more functions
1999-11-21 12:13:44 +00:00
Andi Gutmans
3bffcbef5b - Add array.c to the Win32 project 1999-11-19 15:06:57 +00:00
Andrei Zmievski
61142e4341 Just some rearranging. 1999-11-16 20:14:55 +00:00
Andi Gutmans
9e14736315 - Change used_return_value to return_value_used 1999-11-16 19:12:29 +00:00
Andi Gutmans
7239aad9c4 - Initial support for Thies' idea of passing functions a flag telling them
they don't need to return a value. Adjusted reset() to work with this.
  It is a bit problematic because if internal functions don't look at the
  flag and still return a value orginally this leaked. So I free the value
  in any case, which kind of makes the speed gain a bit smaller
1999-11-16 18:47:47 +00:00
Thies C. Arntzen
2b08dfec28 (PHP k[r]sort) now use compare_function from libzend to be consistent with the language-core. 1999-11-14 19:59:52 +00:00
Andrei Zmievski
438addf331 Split array functions into separate module. 1999-11-13 20:31:54 +00:00