Commit Graph

702 Commits

Author SHA1 Message Date
Ilia Alshanetsky
1d08a8d157 Fixed bug #40637 (Regression in strip_tags() in relation so quote handling) 2007-02-27 00:15:21 +00:00
Marcus Boerger
50ea26760d - Avoid sprintf, even when checked copy'n'paste or changes lead to errors 2007-02-24 02:17:47 +00:00
Ilia Alshanetsky
fc49f98e6a Make sure p is not pointing to the start of the buffer 2007-02-13 23:55:20 +00:00
Ilia Alshanetsky
103b8c33c0 Fixed bug #40432 (strip_tags() fails with greater than in attribute). 2007-02-13 02:16:22 +00:00
Antony Dovgal
7b12fd5492 MFH 2007-02-10 00:50:38 +00:00
Antony Dovgal
82f70c9493 fix leaks on error 2007-02-01 13:45:25 +00:00
Ilia Alshanetsky
60e20922eb Use safe_emalloc() rather then emalloc() 2007-01-08 14:24:59 +00:00
Sebastian Bergmann
4223aa4d5e MFH: Bump year. 2007-01-01 09:36:18 +00:00
Antony Dovgal
0abe62e027 MFH 2006-12-20 23:36:56 +00:00
Antony Dovgal
a0e2ccf490 MFH 2006-12-20 23:30:30 +00:00
Ilia Alshanetsky
090e14dfda Less hackish support for spaces at the start of tags within strip_tags() 2006-12-18 15:02:16 +00:00
Ilia Alshanetsky
7d7248390c Filter fixes:
Fixed possible double encoding problem with sanitizing filters
	Make use of space-strict strip_tags() function
2006-12-18 04:22:05 +00:00
Ilia Alshanetsky
563221783a Removed deadcode found by Ron Korving 2006-12-13 15:39:12 +00:00
Stanislav Malyshev
6b651f8e60 Improve tolower()-related functions on Windows and VC2005 by caching locale and using
tolower_l function.
# Gives 10-18% speedup on bench.php
# Does not change behaviour for non-windows
2006-12-04 18:37:15 +00:00
Antony Dovgal
93fc85b2af MFH: fix #39621 (str_replace() is not binary safe on strings with equal length) 2006-11-24 21:59:09 +00:00
Ilia Alshanetsky
07cdfefdee Fixed bug #39350 (crash with implode("\n", array(false))). 2006-11-06 17:21:05 +00:00
Ilia Alshanetsky
a39201675f Catch empty strings right away. 2006-10-11 14:19:55 +00:00
Antony Dovgal
9b7ba01618 MFH: avoid reading str[-1], add warning when invalid format specified
add test
2006-10-11 13:15:30 +00:00
Andrei Zmievski
e779c3aa36 Increment replace count value for case-sensitive single char searches. 2006-10-05 18:23:19 +00:00
Antony Dovgal
d8648eae57 MFH: fix #39032 (strcspn() stops on null character) 2006-10-04 11:14:32 +00:00
Ilia Alshanetsky
8581c7328f optimize zend_hash_init() with known hash table sizes. 2006-10-03 17:41:47 +00:00
Andrei Zmievski
5c96544b7d Use php_error_docref() instead. 2006-10-02 20:07:14 +00:00
Andrei Zmievski
007c6ff8d9 More offset fixes. Added E_NOTICE where appropriate. 2006-10-02 19:58:15 +00:00
Andrei Zmievski
c36d94aac2 Fix invalid memory access in strrpos(). 2006-10-02 19:42:42 +00:00
Antony Dovgal
0c482b5c64 more z/Z fixes 2006-08-31 14:21:21 +00:00
Ilia Alshanetsky
1b9e18d471 Corrected problems introduced by previous commit.
# Issue found by Stefan
2006-08-29 19:50:04 +00:00
Ilia Alshanetsky
7c618c40bc Finalize implode() patch 2006-08-29 14:32:16 +00:00
Antony Dovgal
ffc3d4a076 fix win32 build
EG(precision) can be changed in runtime, even in php_implode() (hint: __toString()), so please think twice before optimizing
2006-08-29 12:20:18 +00:00
Ilia Alshanetsky
914d362176 Adjust code to avoid TSRMLS_FETCH 2006-08-28 23:33:37 +00:00
Antony Dovgal
615f2d7295 fix ZTS build 2006-08-28 09:56:28 +00:00
Ilia Alshanetsky
78d7b0bf0e Optimize the operation of implode() on non-string parameters 2006-08-27 19:06:09 +00:00
Antony Dovgal
d5c9b41db1 fix implode() function (see http://news.php.net/php.qa/26876)
add test
2006-08-22 19:55:56 +00:00
Ilia Alshanetsky
a4d2f04307 Fixed overflow on 64bit systems in str_repeat() and wordwrap().
Disabled CURLOPT_FOLLOWLOCATION in curl when open_basedir or safe_mode are
enabled.

# Patches by Stefan E.
2006-08-10 14:40:13 +00:00
Antony Dovgal
1a4b715ef2 use memrchr/zend_memrchr instead of strrchr 2006-08-08 10:22:25 +00:00
Antony Dovgal
a28a95c11a MFH: patch for #37846 (wordwrap() wraps incorrectly)
by Dmitry Kononov <ddk at krasn dot ru>
2006-07-28 12:23:18 +00:00
Michael Wallner
c0fcaa7acb - fix bug #37945 pathinfo() cannot handle argument with special characters
like german "Umlaute"
2006-07-17 20:36:47 +00:00
Antony Dovgal
f3f44275f4 MFH 2006-07-17 06:45:08 +00:00
Marcus Boerger
f03f2c5eae - MFH Pathinfo allows to get filename (Toby S, Christian S) 2006-07-16 10:37:24 +00:00
Antony Dovgal
3cce465528 fix invalid read - no need to compare strings if haystack is "" or shorter than needle
add test
2006-07-12 12:33:48 +00:00
Hannes Magnusson
ec420c3df8 Updated protos & vim folding 2006-06-26 18:48:56 +00:00
Ilia Alshanetsky
d74f9ff550 Improved performance of the implode() function on associated arrays by
200-300%.
2006-06-11 21:55:49 +00:00
Ilia Alshanetsky
37d88ca5a0 Improved performance of str_replace() when doing 1 char to 1 char or 1 char
to many chars replacement by 30-40%.
2006-06-10 15:29:06 +00:00
Ilia Alshanetsky
91bd50d1b0 Fixed bug #37394 (substr_compare() returns an error when offset equals
string length).
2006-05-10 13:07:15 +00:00
Antony Dovgal
896a5216d7 fix possible substr_compare() crash
add new tests
2006-04-25 12:48:42 +00:00
Antony Dovgal
bace0def1e fix spelling in error messages:
greater/less thEn -> greater/less thAn
2006-04-03 09:14:33 +00:00
Antony Dovgal
ef3d879315 MFH: add brackets and clarity 2006-03-14 15:15:22 +00:00
Ilia Alshanetsky
0a076b11df Fixed offset/length parameter validation in substr_compare() function. 2006-03-14 14:55:13 +00:00
Ilia Alshanetsky
80ea07d30c Added overflow checks to wordwrap() function. 2006-03-13 14:37:10 +00:00
Marcus Boerger
5a69b29082 - Warning fixes by Steph 2006-02-26 10:57:00 +00:00
foobar
f80f58168c nuke ws pollution 2006-01-29 17:54:45 +00:00
Pierre Joye
2bfe34e06d - MFH: #36185 str_rot13(NULL) crash 2006-01-28 00:14:01 +00:00
Antony Dovgal
6fcc365c75 MFH: fix typo 2006-01-05 20:49:37 +00:00
foobar
5bd93221a8 bump year and license version 2006-01-01 12:51:34 +00:00
Antony Dovgal
1b7e3fe2a5 MFH: fix spelling and #35665 2005-12-14 00:54:29 +00:00
foobar
d0a54af4c5 MFH: Nuke php3 legacy 2005-12-05 22:54:01 +00:00
Ilia Alshanetsky
0242b892d2 Fixed bug #35427 (str_word_count() handles '-' incorrectly). 2005-11-29 16:14:19 +00:00
Ilia Alshanetsky
1a04335ec2 MFH: Fixed possible GLOBALS variable override when register_globals are ON.
MFH: Fixed possible register_globals toggle via parse_str().
MFH: Fixed negative offset handling in substr_compare() function.
2005-09-28 22:39:52 +00:00
foobar
23e671a51e - Bumber up year 2005-08-03 14:08:58 +00:00
Ilia Alshanetsky
29bf2d3a09 Fixed bug in str_word_count() when charlist if specified and "word" starts
with a character found inside the charlist.
2005-07-23 19:44:13 +00:00
Anantha Kesari H Y
384a96faf6 ext/standard/file.h NetWare LibC has fnmatch and realpath implemented.
ext/standard/syslog.c Except LOG_SYSLOG other syslog macros are supported by NetWare LibC.
ext/standard/string.c NetWare fix for dirname
-- Kamesh
2005-07-15 12:35:12 +00:00
Antony Dovgal
3baf1f7632 fix #33605 (substr_compare() crashes with negative offset & length) 2005-07-07 15:19:40 +00:00
Ilia Alshanetsky
b9575ead72 make substr_count() 30% when counting instances of 1 byte long strings. 2005-06-19 16:31:51 +00:00
Ilia Alshanetsky
67ea97dfdf Added offset & length parameters to substr_count() function. 2005-06-18 18:23:12 +00:00
Derick Rethans
ad21bb1baa - That should have been removed, not commented out. 2005-06-02 08:51:20 +00:00
Derick Rethans
90f4590d87 - Fixed memory corruption in stristr(). 2005-06-02 08:29:37 +00:00
foobar
156a908997 - Fixed bug #33200 (preg_replace(): magic_quotes_sybase=On makes 'e' modifier misbehave) 2005-05-31 12:54:56 +00:00
Antony Dovgal
4ce95ef1ea fix bug #33076 (str_ireplace() incorrectly counts result string length and may cause segfault)
add test
2005-05-20 14:23:42 +00:00
Ilia Alshanetsky
ca10457a58 Fixed bug #32530 (chunk_split() does not append endstr if chunklen is
longer then the original string).
2005-04-03 18:08:40 +00:00
Ilia Alshanetsky
f56e5c045c A more performance friendly version of Andrey's patch. 2005-03-12 17:51:19 +00:00
Andrey Hristov
f15c24d44c added an optional third parameter to str_word_count(), which is used as
a list of characters which are considerd "is_alpha()". Thus V14GR4 can
be extracted as one word if the user supplies "14" as charlist.
FR #31560
# Nuno, are you wishing to document this one too? :)
2005-03-12 14:41:20 +00:00
Andrey Hristov
1236cfa38a - type is either 1 or 2 if second parameter is set. if not set then type
is 0.
- use the lvalue for the second rvalue
2005-03-12 13:08:19 +00:00
Marcus Boerger
df56c39bda - Cosmetics 2005-03-10 23:52:43 +00:00
Marcus Boerger
4172ec995c - Do not touch return_valu's refcount or is_ref 2005-03-10 23:42:15 +00:00
Anantha Kesari H Y
033a45903c NetWare allows directory seperator as \ and / 2005-03-01 14:59:37 +00:00
Ilia Alshanetsky
1e6454a67b Fixed bug #31479 (Fixed crash in chunk_split(), when chunklen > strlen). 2005-01-18 15:47:57 +00:00
Antony Dovgal
39b25e4f3d fix yet another typo 2004-11-21 13:35:32 +00:00
Antony Dovgal
d9dd604ae7 fix typo (bug #30857) 2004-11-21 13:33:20 +00:00
Derick Rethans
59651c4e58 - Fixed bug #30630: Added a BSD based strtod function that is
locale-independent. (PHP part)
2004-11-03 23:36:51 +00:00
Ilia Alshanetsky
0818faee7f Slight optimization in str_split() when split length is the same or greater
then the string length.
2004-10-20 22:44:43 +00:00
Ilia Alshanetsky
2476198086 Fixed bug #30356 (str_ireplace() does not work on all strings). 2004-10-07 23:10:35 +00:00
Andi Gutmans
56f8195fe5 - Nuke empty_string. It is a reminanent from the time where RETURN_FALSE()
used to return "" and not bool(false). It's not worth keeping it because
  STR_FREE() and zval_dtor() always have to check for it and it slows down
  the general case. In addition, it seems that empty_string has been abused
  quite a lot, and was used not only for setting zval's but generally in
  PHP code instead of "", which wasn't the intention. Last but not least,
  nuking empty_string should improve stability as I doubt every place
  correctly checked if they are not mistakenly erealloc()'ing it or
  calling efree() on it.
  NOTE: Some code is probably broken. Each extension maintainer should
  check and see that my changes are OK. Also, I haven't had time to touch
  PECL yet. Will try and do it tomorrow.
2004-07-19 07:19:50 +00:00
Andrey Hristov
96f5c697dd Add support for negative values of limit of explode(). If limit is negative
then all components are returned except the last abs(limit) ones.
2004-07-18 11:34:28 +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
Ilia Alshanetsky
5201e62d0d Fixed bug #29034 (wordwrap() returns a boolean when passed empty string). 2004-07-06 22:16:42 +00:00
Stefan Esser
a27d5d842a IE we love you all... 2004-06-26 07:43:02 +00:00
Stefan Esser
585628ba67 Fixed: made 3rd parameter to strrpos 64bit safe. 2004-06-15 22:38:18 +00:00
Ilia Alshanetsky
d24465ba8a Fixed bug #28386 (wordwrap() wraps lines 1 character too soon). 2004-05-13 17:44:23 +00:00
Jay Smith
8f306fd749 Fixed a segfault. (It's possible for large offsets to make strrpos()
read past the end of the haystack string...)
2004-05-06 16:11:50 +00:00
Sara Golemon
c52cc1c333 BugFix 27675 and add regression test. 2004-03-26 19:23:42 +00:00
Dmitry Stogov
6e63ea45c7 BUG #27457 was fixed (using temporary hash table with string keys only) 2004-03-18 09:48:37 +00:00
Ard Biesheuvel
81f05c18f5 Wordsize fixes 2004-02-25 20:16:27 +00:00
Sara Golemon
ba8ad292d9 Make today's changes work w/ str_ireplace() as well. 2004-02-23 20:34:59 +00:00
Sara Golemon
1c82797664 Short circuit str_replaces when we already know that needle does not occur in haystack.
Note: Prior bugfix was for #27176 not #27276
2004-02-23 20:13:14 +00:00
Sara Golemon
5144a1f522 Bugfix #27276: When using str_replace to expand a string, count occurances of needle in haystack to avoid massive overallocation 2004-02-23 20:06:01 +00:00
Andi Gutmans
dbeb4158d2 - A belated happy holidays and PHP 5 2004-01-08 08:18:22 +00:00
Ilia Alshanetsky
56f046a67a Fixed ZTS build. 2003-12-10 21:23:35 +00:00
Moriyoshi Koizumi
b2cd08f33d Fix bug #26574 (basename() doesn't work properly with multibyte characters) 2003-12-10 07:15:28 +00:00
Moriyoshi Koizumi
c4c586a652 Fix typo. 2003-12-10 06:04:15 +00:00
Sara Golemon
feee37a17a Optimize strrpos/strripos for single char strings and fix offset to report correctly 2003-12-03 01:31:56 +00:00
Sara Golemon
3d6fcddfd2 Restore ability to use strrpos/strripos with an ordinal needle 2003-12-03 01:11:36 +00:00
Ilia Alshanetsky
5a4dda42e3 Optimize substr_replace (this makes it 3-8 times faster depending on the
string length).
2003-12-01 23:17:22 +00:00
Ilia Alshanetsky
cd482c502c Removed dead code. 2003-11-27 01:08:42 +00:00
Ilia Alshanetsky
ab7ee13670 Added substr_compare(). 2003-10-30 00:49:33 +00:00
Moriyoshi Koizumi
103b3c6626 Simplification. 2003-09-29 02:23:40 +00:00
Sara Golemon
ef7905a188 Bug Fix#25671 Corruption in subarrays in subject when using str_replace 2003-09-26 17:57:13 +00:00
Sascha Schumann
36ac7a5bb0 MFB Avoid zero-length keys which result in a spinning process 2003-09-20 16:10:49 +00:00
Sara Golemon
3560cd83c0 Squelch warning "Variable may be used uninitialized."
This would never occur anyway because of the logic of the function,
but gcc isn't quite smart enough to realize this.
2003-08-27 00:43:54 +00:00
Ilia Alshanetsky
ed40ae2650 emalloc -> safe_emalloc 2003-08-11 23:16:54 +00:00
Sara Golemon
3caa0d0aa9 Fix Bug#24784 single character search keys not respecting case sensitivity/replace count parameters. 2003-07-25 01:03:39 +00:00
Moriyoshi Koizumi
4b07cb98b1 Fixed bug #24556 2003-07-12 09:33:31 +00:00
Stanislav Malyshev
baa3892fe1 Fix #24281 - str_replace not updating the count if value is
not initialized
2003-06-23 14:09:14 +00:00
Sara Golemon
4c52cf5f90 When skipping blank searchvals we should advance the corresponding replace hash as well 2003-06-20 15:41:43 +00:00
Ilia Alshanetsky
b5dc8f918e fixed proto 2003-06-11 02:16:19 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Ilia Alshanetsky
aec7815e9c Fixed bug #24098 (Crash in pathinfo() due to double var initialization).
# This is a php5 specific bug, no MFB needed
2003-06-09 18:12:36 +00:00
Melvyn Sopacua
e4006659b2 MFB: LC_MESSAGES support 2003-05-27 00:42:39 +00:00
Ilia Alshanetsky
2e361db1fe Fixed bug #23788 (str|preg_replace clober the array elements).
# Should this be MFBed to 4.3 branch?
2003-05-25 21:48:57 +00:00
Sterling Hughes
24eee37fed seems there is only the stupid way to be stupid (implode copying array
elements)
at least we check for IS_STRING, which should clear this up 90% of the time
2003-05-21 17:44:08 +00:00
Sterling Hughes
90ae4e0095 be stupid, but at least be smart about being stupid. 2003-05-21 17:38:17 +00:00
Sterling Hughes
8d5c30c14b make brian happy 2003-05-21 16:52:09 +00:00
Sara Golemon
8924395720 MFB(r-1.333.2.27) Bugfix 23654. If subject is an array and it contains other arrays, we want to pass those subarrays through unchanged rather than attempt to convert them to string. 2003-05-16 23:30:08 +00:00
Moriyoshi Koizumi
8cbb6b6341 Fixed bug #23650 (strip_tags() removes hyphens) 2003-05-16 06:19:51 +00:00
Hartmut Holzgraefe
e6490c4a41 basename() now binary safe, testcases added 2003-05-05 13:46:14 +00:00
Moriyoshi Koizumi
b44ae54bc6 Real fix and a test case for bug #22008 2003-05-04 12:44:36 +00:00
Moriyoshi Koizumi
e9c903ad3f A quick fix for bug #22008
# BTW I'm working on an enhanced strip_tags implementation with re2c, which
# will feature more CSS awareness and more stateful scanning.
2003-05-04 11:45:58 +00:00
Andrey Hristov
a894bf5c87 Extending substr_replace().
Every parameter can be mixed (string/array) also the return type.
#see the test file if you need more info.
2003-05-02 10:02:40 +00:00
Wez Furlong
89503b163e Fix dirname() under win32.
The calculated length would be off-by-two under windows, which resulted in bogus dirnames.
2003-04-29 13:35:48 +00:00
Ilia Alshanetsky
7f8bd25fcc Fixed bug #23225 (money_format() didn't handle erroneous return of strfmon)
# Initial patch proposed by marcot@tabini.ca
2003-04-16 01:07:03 +00:00
Sara Golemon
9103aac254 Modify str_replace/str_ireplace to report how many needles were matched. (FR #8218) 2003-04-13 22:59:19 +00:00
Moriyoshi Koizumi
fa0ac8a273 Made dirname() binary-safe. 2003-04-12 21:53:46 +00:00
Sara Golemon
76965beb04 Add tests for strrpos/stripos, and minor fix to maintain BC for condition with empty needles/haystacks 2003-04-12 20:04:06 +00:00
Sara Golemon
0b5c1112c5 Rewrite strrpos and strripos to be binary safe and behave the way their prototype suggests (also like their counterparts strpos and stripos) i.e.: Allow string needles rather than just characters 2003-04-12 07:36:22 +00:00
Derick Rethans
6412e65bf9 - CS 2003-04-03 06:21:59 +00:00
Rasmus Lerdorf
1612ffad05 MFB: Fix the setlocale() segfault 2003-04-02 21:33:02 +00:00
Ilia Alshanetsky
aab9718253 Fixed possible integer overflow in str_repeat(). 2003-04-02 00:25:45 +00:00
Moshe Doron
31bd24860c revert last commit for now 2003-04-01 12:46:01 +00:00
Moshe Doron
dc8daad70d fix for 22904
@ now addslashes() do it also on cybase magic mode(moshe).
2003-03-31 18:56:41 +00:00
Moshe Doron
5c3a073c07 # unnecessary condition here. 2003-03-31 12:08:31 +00:00
Stig Bakken
0e6fca4f22 * email address change 2003-03-18 12:06:09 +00:00
Derick Rethans
0d603b2d9a - Fix proto 2003-03-09 00:05:48 +00:00
David Hill
5c90216d2c 64-bit correction to variables passed to zend_parse_parameters
@64-bit correction to variables passed to zend_parse_parameters (Dave)
2003-03-06 23:07:28 +00:00
Moriyoshi Koizumi
8f341f6a19 Fixed possible buffer overflow of php_strip_tags 2003-02-24 22:19:36 +00:00
Moriyoshi Koizumi
385a809694 Made strip_tags() binary safe 2003-02-24 22:01:12 +00:00
Moriyoshi Koizumi
89caaeb87c Fixed bug #21708 (ucfirst() trouble again)
# this bug is related to bug #21689
2003-02-18 18:11:34 +00:00
Moriyoshi Koizumi
9b49146dc1 Fixed a str_replace() bug similar to bug #22224 2003-02-14 18:59:50 +00:00
Moriyoshi Koizumi
b3a8349191 Fixed bug #22224 (implode changes object references in array)
Added test case for the bug
2003-02-14 18:42:36 +00:00
Ilia Alshanetsky
53f96c8b02 Added strpbrk(), which is essentially a wrapper around C's strpbrk function
that allows searching through a string for a character list.
2003-02-11 22:47:26 +00:00
foobar
b7a9ef8d80 style & ws fixes 2003-02-08 15:26:17 +00:00
Ilia Alshanetsky
67b19b08e3 Added str_split() function. This function can be used to break down a
string into an array.
2003-02-07 21:36:18 +00:00
Sara Golemon
65146ceb26 Unify str_replace and str_ireplace using INTERNAL_FUNCTION_PARAM_PASSTHRU -- reduce codebase/maintenance complexity 2003-01-30 20:09:19 +00:00
Sara Golemon
37ff98978b Feature Request # 5919 - Addition of str_ireplace()
Also removed deprecated BM str replace menthod
Also rewrote php_str_to_str to use more processor/memory efficient method (ilia)
2003-01-30 05:00:41 +00:00
Andrey Hristov
600fce5890 Resolving problem on OSF1 and probably other
64 bit platforms. Thanks for the feedback of Magnus (novell kiruna se).
2003-01-24 13:18:08 +00:00
Andrey Hristov
1d0214bee4 Adding cast. 2003-01-24 12:19:59 +00:00
Ilia Alshanetsky
8a9e09a44a ARG_COUNT(ht) -> ZEND_NUM_ARGS(). 2003-01-21 14:56:40 +00:00
Moriyoshi Koizumi
a1e6457561 Fixed bug #21744(21741)
Added test case for the bug
2003-01-19 11:32:54 +00:00
Ilia Alshanetsky
71e9f8cdd5 Removed pointless memory allocation checks. 2003-01-18 20:01:46 +00:00
Moriyoshi Koizumi
7fa0970567 Reverted because correct decision has not been made yet. 2003-01-11 23:05:19 +00:00
Moriyoshi Koizumi
b66b92e996 Reduced warnings in ZE2 build 2003-01-11 22:32:19 +00:00
Ilia Alshanetsky
8facc65202 Added stripos() & strripos() functions.
Added 3rd parameter (offset) to strrpos().
2003-01-11 17:52:38 +00:00
Ilia Alshanetsky
97dd1e8abf Fixed bug #21453 (improper handling of non-terminated <). 2003-01-06 22:13:03 +00:00
Ilia Alshanetsky
d5a8bb2d0b Fixed a memory leak in setlocale() & localeconv(). 2003-01-05 04:29:14 +00:00
Wez Furlong
f58628ca4d Move rot13 filter into a new filters.c source file.
Tidy up some other filter related code.

# win32 -> someone please add user_filters.c and filters.c to the .dsp
2003-01-01 11:04:44 +00:00
Sebastian Bergmann
b506f5c8f8 Bump year. 2002-12-31 16:08:15 +00:00
Rasmus Lerdorf
f88e29bc0d Fix for bug #21311 2002-12-31 15:18:52 +00:00
Sterling Hughes
457f22c198 if needle is empty free allocated memory 2002-12-26 20:52:42 +00:00
Sterling Hughes
ca67d27fb2 remove memleak 2002-12-26 19:56:44 +00:00
Ilia Alshanetsky
75c180f242 Fixed bug #20927 and updated the test case for the bug. 2002-12-12 13:38:19 +00:00
Ilia Alshanetsky
c668055159 Remove pointless checks for array_init() return values. 2002-12-05 22:28:02 +00:00
Ilia Alshanetsky
e195b10ede Fixed bug #20664. 2002-11-27 06:20:19 +00:00
Moriyoshi Koizumi
bef514afda style fix 2002-11-05 13:52:11 +00:00
Ilia Alshanetsky
ec3b50b8bb Revert previous dirname() patch. 2002-11-02 18:54:31 +00:00
Ilia Alshanetsky
500df32e0c Fixed bug #18710. dirname() now returns consistent output when dealing with
\ directory separators on Windows.
2002-11-01 00:53:27 +00:00
Moriyoshi Koizumi
8ff7d5ff54 Fixed bug #20169 2002-10-30 11:42:51 +00:00
Ilia Alshanetsky
9526ca998d This is needed for BSD (FreeBSD, BSDi and possibly others), problem
was indentified by Melvyn Sopacua.
2002-10-25 20:09:53 +00:00
Marcus Boerger
15b2e277a4 fix compiler warning 2002-10-24 19:15:40 +00:00
Marcus Boerger
e2a62e21c2 Fix for cases when new_length is NULL 2002-10-22 18:27:56 +00:00
Andrei Zmievski
92d61459c0 @- Fixed an infinite loop in setlocale() when only invalid locale names
@  were passed in the array. (patch by Pal Loberg, pallo@initio.no).
2002-10-18 13:07:50 +00:00
Ilia Alshanetsky
30c16baac2 Renamed word_count to str_word_count to comply with naming conventions.
Thanks Andi, for catching this oversight.
2002-10-17 22:44:44 +00:00
Ilia Alshanetsky
47b57f2569 Added word_count() function that allows counting of words inside a string.
The function also allows the user to retrieve all the words from a string.
2002-10-17 03:27:19 +00:00
Sander Roobol
524c9ef26a Fixed problems with the new nl2br() and beautified the code a little.
Closes #19858.
2002-10-11 12:42:01 +00:00
Ilia Alshanetsky
287b7f9bcb Switched from localeconv to localeconv_r, which is apparently thread-safe. 2002-10-11 03:19:38 +00:00
Andrey Hristov
cd282dad98 ws fixes 2002-10-10 18:41:24 +00:00
Ilia Alshanetsky
bc14a6f133 This patch fixes handling of floats on locales where decimal point is not a
'.'. Problem is best demonstrated by bug #17079.
2002-10-10 16:29:35 +00:00
Andrey Hristov
868ae8b6e0 ws fixes. 2002-10-09 13:50:06 +00:00
Ilia Alshanetsky
a75eb9c4dd Optimizations to various php string functions substr_count(), strrev(),
nl2br(), php_addslashes() and php_memnstr().
2002-10-09 13:37:02 +00:00
Andrey Hristov
16a82f2b47 Returning to the old behavior of str_shuffle() a bit. Now the passed string is
left unmodified and the shuffled string is returned.
2002-10-09 10:33:22 +00:00
Andrey Hristov
0ad8b4aa10 Now str_shuffle() has the randomization characteristics of shuffle().
str_shuffle() won't return anymore the randomized string and thus will be
consistent with shuffle(). Since this function is new to 4.3.0 no BC
problems.
#Thanks to Adam Trachtenberg for providing good example to check the
#permuations distribution.
2002-10-08 09:52:59 +00:00
Sander Roobol
004d3d3a30 Fix another leak in implode() 2002-10-06 18:39:03 +00:00
Sander Roobol
68cd067670 Fixed segfault and memory leak in the new implementation of implode() 2002-10-06 11:28:11 +00:00
Sterling Hughes
df837e67c7 have implode use the smart_str_*() functions, this should speed things up
quite a bit...
2002-10-04 20:44:19 +00:00
Sander Roobol
e6e2c1c70d Fixed a bug in the new implementation of str_repeat() 2002-10-04 17:10:51 +00:00
Derick Rethans
ec6713f1ca - dot :) 2002-10-04 16:55:46 +00:00
Sterling Hughes
5605dcf7b6 fix a memory leak in implode()
# kept seperate from last commit on purpose.. ;)
2002-10-04 16:54:56 +00:00
Sterling Hughes
abc9991925 @ Make the glue argument to implode() optional, if it is not specified
@ default to using "". (Sterling)
2002-10-04 16:53:14 +00:00
Andrey Hristov
52c529c5af ws fixes.
#again :)
2002-10-03 18:15:18 +00:00
Ilia Alshanetsky
2ea2b662a4 Optimized str_repeat() function, it is now 10x faster on 1 byte multipliers
and 5-6x faster on multi-byte multipliers.
2002-10-03 13:59:31 +00:00
Yasuo Ohgaki
f6dfd6b184 Forgot 1 byte for \0 2002-10-03 04:56:54 +00:00
Yasuo Ohgaki
5f1bb18c36 Save memory 2002-10-03 04:54:01 +00:00
Andrey Hristov
83a0f20381 Making strrchr() binary safe.
Test case added.
2002-10-02 18:58:09 +00:00
Andrey Hristov
2092d80230 Making strstr() binary safe. 2002-10-02 18:41:55 +00:00
Andrey Hristov
b2d93b67fc Ws fix. Forgot to add this in the previous commit. 2002-10-02 18:13:56 +00:00
Andrey Hristov
f02b1507dc ws fixes. 2002-10-02 17:56:04 +00:00
Sebastian Bergmann
fd7326395b Fix warning. 2002-09-26 19:18:35 +00:00
Andrey Hristov
f80a817f7c Added common handler for strspn() and strcspn(). Almost of the code is
identical. Modified to accept up to 4 params. Last 2 optional start & len.
They are analogic to start & len of substr(). So the behavior when start &
len are used is like
strspn(substr($s,$start,$len),$good_chars) and
strcspn(substr($s,$start,$len), $bad_chars)
2002-09-25 19:06:29 +00:00
Andrey Hristov
fc46a46b06 str_shuffle() function added. Like shuffle() for arrays - however the
algorithm for creating the permutation is quite simple. More like
the implementation of shuffle() for 4.2.1 .
2002-09-25 18:06:05 +00:00
Sebastian Bergmann
fd329d2cd1 Fix warning. 2002-09-23 14:20:02 +00:00
Ilia Alshanetsky
8fc94a082f Fixed bug #7472 as well as many other bugs with strip_tags implementation. 2002-09-21 17:34:06 +00:00
Ilia Alshanetsky
bc8eda5385 Fixed bugs #12989 and #12120 2002-09-20 11:48:47 +00:00
Hartmut Holzgraefe
f8358b44d1 setlocale() will now accept multiple locale arguments, first match wins 2002-09-18 07:55:30 +00:00
foobar
746c147670 tok tok.. 2002-09-11 14:51:09 +00:00
foobar
daf6a5ab1a ws fix 2002-09-11 14:40:52 +00:00
foobar
be52343850 fix proto 2002-09-11 14:24:27 +00:00
Dan Kalowsky
e560822fa7 silence a windows build warning 2002-09-05 21:29:39 +00:00
Ilia Alshanetsky
eb58557e1c Fixed a buffer overflow that occurs when wordwrap is unable to calculate
the correct number of times the multi-byte break needs to be inserted into
the string.
2002-09-05 14:00:28 +00:00
Derick Rethans
60dcc761ac - php_error -> php_error_docref
- corrected proto of implode() (to match the docs)
2002-09-05 11:29:31 +00:00
Hartmut Holzgraefe
101d155baa in stristr:
this check was in the wrong place, the real version was some lines
below, this one assumed the type was 'string' in any case
now it looks like strstr
2002-09-05 11:12:01 +00:00
Ilia Alshanetsky
64ef43ecd4 Slight optimization of php_strtoupper & php_strtoupper functions. 2002-08-25 19:08:07 +00:00
Wez Furlong
c7be7b55d1 Add a "closing" parameter for filters to determine if a flush is the last
flush before the stream is closed.  This allows filters to finish a chunk
and write footers etc.
2002-08-25 10:26:58 +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
Ilia Alshanetsky
ea1bb5e172 Added monetary.h to prevent compile warning.
Fixed a memory leak inside money_format function, which occures if the
parameters to the function are not valid.
Fixed a segmentation fault inside money_format in the event the value
to be formated is >1024 bytes.
Made the return value of money_format be null terminated.
2002-08-21 13:14:57 +00:00
Sebastian Bergmann
090e30a863 Fix ZTS build. 2002-08-21 06:22:19 +00:00
Wez Furlong
9d348ea800 Implement filter API for streams.
Filters can be stacked onto a stream; more details will follow in docs and
on php-dev.

Implement "string.rot13" filter

Allows the following script:

$fp = fopen("file.txt", "r");
stream_filter_prepend($fp, "string.rot13");

// File contents will be subject to a rot13 transformation before
// being output.
fpassthru($fp);
fclose($fp);
2002-08-20 20:47:47 +00:00
Hartmut Holzgraefe
e5fa36eee4 added money_format() function
this is similar to C-libs strfmon(), using the same format string
semantics but a different function prototype, so i decided to
give it a more speaking name similar to number_format()
2002-08-02 10:08:53 +00:00
Rui Hirokawa
7527bf0c58 made sapi_register_treat_data() to support multibyte input encoding translation without MBSTR_ENC_TRANS and changed php_treat_data to php_default_treat_data. 2002-08-02 06:53:48 +00:00
Rasmus Lerdorf
d56bc7934d Fix for #18638 (str_rot13 bug) 2002-07-30 10:51:33 +00:00
foobar
2f8dc7a47c - Made the trim functions use same base function. (less code :)
- Renamed php_trim2 -> php_trim (not used anyplace else, yet)
- Made php_trim abit more usable for external use. (not necessary to use
  zvals with it anymore)
2002-07-13 04:13:43 +00:00
Sander Roobol
ace4a23dfc Fixed stripslashes when magic_quotes_sybase is enabled, and add a test for
add- and stripslashes().
# this time without cvs messing up and aborting, hopefully :)
2002-06-18 11:51:06 +00:00
Hartmut Holzgraefe
00b667b61b fixed return types for ucwords/ucfirst when passed an empty string 2002-06-17 11:37:49 +00:00
Preston L. Bannister
6b2ab5f66d Adjust dirname() on Win32 to match CWD per drive semantics. 2002-05-16 16:04:45 +00:00
Rasmus Lerdorf
adf701a3ef Grr.. I keep leaving my debug in... 2002-05-16 14:42:22 +00:00
Rasmus Lerdorf
5d286e21ea Fix for #17271
@ Fix crash bug in stripslashes() when working in sybase mode (Rasmus)
2002-05-16 14:41:15 +00:00
Sascha Schumann
ea84524bc2 block_ended/opposite_target were set but never used 2002-05-04 17:38:45 +00:00
Rui Hirokawa
860e675884 fixed directory access problem when direcory name is encoded in japanese Shift_JIS encoding. 2002-04-25 14:43:40 +00:00
Wez Furlong
1f2344104f fix for #16469 2002-04-07 10:56:30 +00:00
Hartmut Holzgraefe
492c837272 fix for Bug #16314 2002-03-27 20:20:57 +00:00
Markus Fischer
f521ae3f30 - Fix bug 11244 (patch by "Tal Peer" <hazgul99@hotmail.com>).
# Sorry for the delay :-)
2002-03-26 07:57:07 +00:00
Wez Furlong
3dbde95896 Make state parameter of php_strip_tags passed by reference.
Move state tracking to stream structure.
2002-03-20 14:38:13 +00:00
jim winstead
349936c93e Fix calculation of output buffer size in wordwrap(). (Thanks to Wez.) 2002-03-18 02:00:57 +00:00
Yasuo Ohgaki
c43792602e Change php_addslashes() a little.
Since most users do not use magic_quote_sybase, be nicer to
users not using magic_quote_sybase.
2002-03-12 07:05:40 +00:00
Derick Rethans
6f9c7bcf21 - Fix warning message for join(). 2002-03-02 14:06:57 +00:00
Sean Bright
a38bfb424e Fix for bug #15130. Way too much effort for this bug, but cleaned up code
a bit, use zend_parse_parameters(), etc, etc.  We only look for extensions
in the basename, not the full path.
2002-01-22 03:35:23 +00:00
jim winstead
4fb4c6d4b3 More tweaking of wordwrap() with the cut parameter set. It was being a
little too aggressive and cutting words without breaking at spaces
first. (A couple of tests were incorrect.)
2002-01-05 23:49:58 +00:00
jim winstead
ca15b22212 New memcpy()-based wordwrap() implementation. The simple case
(single-character break, no forced break) appears to be about 60%
faster, and there's simply no comparison for non-simple cases with
non-trivial amounts of text. The old algorithm was O(n^2) (with an
unfortunately large constant factor) because of the use of strncat(),
the new one is O(n). Added some more tests, too.
@ - Made wordwrap() significantly faster. (Jim)
# test case: $t = join('',file('ChangeLog')); $w = wordwrap($t,10,"\n",1);
# new code completes in less than a second. i'm still waiting for the
# old code to finish.
2002-01-05 20:46:43 +00:00
jim winstead
f68b7c5f3e Fixed segfault in wordwrap() when wrapping to zero width and using
multi-character break or trying to force cut (bug #12768, now fails
and issues a warning because forcing a zero-width cut doesn't make
sense). Also converted to new paramater-passing API and avoid making
an extra copy of the return values.
# also added tests.
@- Fixed segfault in wordwrap() when wrapping to zero width and using
@  multi-character break or trying to force cut (bug #12768). (Jim)
2002-01-04 19:48:08 +00:00
Hartmut Holzgraefe
c9bc54abc3 fix for bug #14832: basename with 2nd parm corrupts source string 2002-01-03 20:20:35 +00:00
Sebastian Bergmann
38933514e1 Update headers. 2001-12-11 15:32:16 +00:00
Hartmut Holzgraefe
49cc65cdae renamed rot13 to str_rot13() 2001-12-06 21:39:01 +00:00
Hartmut Holzgraefe
71028d46cf ported rot13() from php3 2001-12-06 19:02:27 +00:00
Derick Rethans
29cd309944 - Fix a crash when passing e.g. NULL to basename(). (Patch by Markus
Fischer <mfischer@guru.josefine.at>)
#- Simplyfied code using zend_parse_parameters().
2001-12-01 15:45:55 +00:00
Andrei Zmievski
98a7a1ba1f Fixed bug #13901. 2001-11-10 23:44:04 +00:00