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
James Moore
2ace2ccd00
WS fix
2001-11-02 19:31:57 +00:00
James Moore
c8896a38ae
@- Fix behaviour of strtok. Bug 13866 (jmoore)
...
# I have brought the behaviour of strtok into line with how the
# libc strtok's behave. currently given
# <string1><token><string2><token><token>string>
# three recursive calls to strtok returns <string1>. <string2>, <token><string3>
# it now returns <string1>, <string2>, <string3>. (there was some
# debate in #php.bugs if it should return <string1>, <string2>, false, <string3>
# but php's strtok now behaves the same way as the libc version.
2001-11-02 19:19:24 +00:00
Derick Rethans
744d1fc1ea
- 'Fix' for bug #13543
2001-10-04 15:25:39 +00:00
Derick Rethans
be52d66f4b
- Fix crashbug in php_chunk_split()
2001-09-27 06:55:23 +00:00
Zeev Suraski
7e42c73a50
Another leak bites the dust?
2001-09-27 00:21:21 +00:00
Derick Rethans
51e2a6b84e
- nl2br now handles different styles of line endings in one string. (Patch
...
by Boian Bonev <boian@bonev.com>)
@- nl2br now handles all styles of line-endings in one string. (Boian,
@ Derick)
2001-09-26 19:34:46 +00:00
Jeroen van Wolffelaar
6cfba2a3ea
2nd phase in back-substitution those macro's
...
I've got pretty much everything now...
2001-09-25 22:49:04 +00:00
Jeroen van Wolffelaar
c033288573
Back-substitute for Z_* macro's. If it breaks some extension (the script isn't optimal, it parses for example var->zval.value incorrect) please let me know.
2001-09-25 21:58:48 +00:00
Derick Rethans
f1ce7daccd
- Fix crash bug (patch by <chocolateboy@lunomail.com>)
2001-09-24 08:33:51 +00:00
Jeroen van Wolffelaar
f61dfce39c
Make chop the alias and rtrim the main function, in order to get automagically
...
generated alias-listings correct.
2001-09-23 18:32:46 +00:00
Hartmut Holzgraefe
03f7406711
proto fixes "double" -> "float"
2001-09-21 21:59:27 +00:00
Sascha Schumann
0a8677167d
don't use boyer_str_to_str. It is experimental
2001-09-21 16:17:14 +00:00
Thies C. Arntzen
e929389eeb
fix strtr() when called with two parameters. this has been broken for some time!
...
guys, when "optimizing" functions you _shoudl_ write a testcase for the
working function and make _sure_ that it works afterwards!
2001-09-13 10:48:41 +00:00
Derick Rethans
61d4f7fe65
- Really fix nl2br now... it's actaulyl faster now
2001-09-09 12:55:48 +00:00
Derick Rethans
176cd90bd7
- Fix for bug 11904
...
#- This is possibly not the best solution... feel free to improve
2001-09-09 11:42:36 +00:00
Sterling Hughes
25d4500a86
I should really learn how to spell
2001-09-06 08:56:24 +00:00
Sterling Hughes
b7ba9e007d
avoid lowercasing the string
2001-09-06 08:54:54 +00:00
Egon Schmid
03fbbb098c
Fixed some protos.
2001-09-04 10:44:28 +00:00
Sterling Hughes
38cacba117
Thanks sebastian
...
# I really like this whole qa team thingy
2001-09-04 10:13:55 +00:00
Sterling Hughes
536c96969b
update php_trim as well...
2001-09-04 09:35:53 +00:00
Sterling Hughes
c661449ebf
fix crash bug
2001-09-04 09:33:30 +00:00
Sterling Hughes
e55315a375
tabs -> spaces
2001-09-04 06:20:23 +00:00
Sterling Hughes
fe03f6f4c2
Begin cleanup, api wise...
2001-09-04 06:18:11 +00:00
Sterling Hughes
f6d73d73fb
stray tabs
2001-09-03 06:10:45 +00:00
Sterling Hughes
f14ada19ac
cleanup sscanf() just a tiny bit, just so it looks like the rest of the code
...
in the string.c file.
2001-09-03 04:49:36 +00:00
Gavin Sherry
bd4150ed80
Fixed buffer overflow issue.
2001-08-22 05:47:11 +00:00
Gavin Sherry
ff7a694e0f
Changed php_strip_tags() to check if <? was XML code.
2001-08-22 02:03:14 +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
Wez Furlong
831f05b0fb
Fix some build probs on *bsd
2001-08-10 18:02:59 +00:00
Sascha Schumann
23b9300fd1
more tsrm cleanup
2001-08-06 03:50:52 +00:00
Jeroen van Wolffelaar
dce78d75d6
Removed some duplicate code out of addclashes
...
# Not TSRM-safe, I am afraid...
@- addcslashes now warns when charlist is invalid. The returned string
@ remained the same (Jeroen)
2001-08-05 23:08:19 +00:00
Sebastian Bergmann
b4f31ecef5
Fix ZTS build.
2001-08-05 20:25:40 +00:00
Jeroen van Wolffelaar
4a01a15fd2
Error-handling for the second parameter of [l|r]trim
2001-08-05 19:38:49 +00:00
Thies C. Arntzen
3884b15b95
fix possible crash - we should never keep the zval** as they might point
...
somewhere into the Engine. (there's still a new bug in strtok - hunting;-)
2001-08-04 16:53:57 +00:00
Jeroen van Wolffelaar
b32f1ab299
#- Fix silly bug that caused segfault
2001-08-03 23:10:04 +00:00
Jeroen van Wolffelaar
f0bcaf3901
Un-revert patch
2001-08-03 23:09:05 +00:00
Jeroen van Wolffelaar
f6979a7d2b
Reverting last patch, segfaults.
2001-08-03 22:42:02 +00:00
Jeroen van Wolffelaar
c2150f7038
- Added new parameter to [l|r]trim, to specify _what_ to trim
...
@- Added optional second parameter to trim, chop and ltrim. You can
@ now specify which characters to trim (jeroen)
2001-08-03 22:12:46 +00:00