Commit Graph

528 Commits

Author SHA1 Message Date
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
Sascha Schumann
f6ed403fde Don't copy the strtok parameter 2001-08-03 09:50:38 +00:00
Sascha Schumann
7471943c06 Replace our strtok implementation with a binary-safe one which code
does not cause headaches when reading it.  Also happens to be a bit quicker.
2001-08-03 08:49:19 +00:00
Zeev Suraski
c43806f415 Zend compatibility patch 2001-07-30 08:24:42 +00:00
Zeev Suraski
797a079a95 More TSRMLS_FETCH work, and a bit of cleanup 2001-07-30 06:18:13 +00:00
Zeev Suraski
1c25b8dd53 Avoid TSRMLS_FETCH()'s, and clean up a bit of stale extern's and layout on the way 2001-07-30 01:56:43 +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
Sascha Schumann
4ebcdd9929 Add optional support for using boyer-moore to str_replace. 2001-07-20 01:22:29 +00:00
Sascha Schumann
aee2ff3ec9 __USE_GNU should not be defined by an application. 2001-07-09 17:44:07 +00:00
Wez Furlong
4948cb1691 More ifdefs, just in case. 2001-07-05 10:53:15 +00:00
Wez Furlong
ca9c4b3753 Added loads of #ifdefs; should fix Bug #11889. 2001-07-05 10:49:58 +00:00
Jason Greene
e48bc17c58 Fix build on linux
Heads up Wez
2001-07-05 07:12:28 +00:00
Wez Furlong
f1364ebf3e (PHP nl_langinfo) Added function when provided by OS
(PHP htmlentities, htmlspecialchars) Uses nl_langinfo to determine charset
@- Added nl_langinfo() (when OS provides it) that returns locale
   information. (Wez Furlong)
# There are a lot of constants used by nl_langinfo; should we do something
# along the lines of what we do for syslog?
2001-07-04 10:10:30 +00:00
Hartmut Holzgraefe
045acafc52 @added optional suffix removal parameter to basename() (Hartmut)
added optional suffix removal parameter to basename()
this makes it more simmilar to the basename command
2001-06-23 00:51:03 +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
Sean Bright
a98c9ba66f Fix proto decription. 2001-04-29 13:30:56 +00:00
Sean Bright
596e8208be Really fix bug #10362.
# My previous fix caused a segfault when there were parens in an unallowed
# tag :(  Thanks Andi.
2001-04-29 13:16:05 +00:00
Sean Bright
9e34117cd9 Fix for bug #10362 2001-04-28 23:07:51 +00:00
Thies C. Arntzen
9a42a31ba4 @- Fixed crash in pathinfo() 2001-04-13 18:22:13 +00:00
Andi Gutmans
7fbdc83318 - Fix whitespace 2001-02-26 15:49:38 +00:00
James Moore
08d3e700fa Fix for bug #9449 to stop infinate loop in wordwrap. 2001-02-26 13:04:00 +00:00
Andi Gutmans
eb6ba01d1c - Fix copyright notices with 2001 2001-02-26 06:11:02 +00:00
Stanislav Malyshev
77d14126b1 Safer bin2hex 2001-02-22 10:36:40 +00:00
Thies C. Arntzen
d6aab98541 fixed buffer-overwrite 2001-02-18 18:31:31 +00:00
Thies C. Arntzen
5ca813a564 0..255 2001-02-15 14:01:18 +00:00
Rasmus Lerdorf
6745b16c82 Fix strip_tags to not strip a lone > character
@ Fix strip_tags to not strip a lone > character (Rasmus)
2001-02-02 13:47:02 +00:00
Andrei Zmievski
63f73bfe13 @- Improved str_replace() to accept an array for any parameter - similar
@  to preg_replace(). (Andrei)
2001-01-22 21:39:55 +00:00
Derick Rethans
9a3cb4559f - Fix for bug #8367 (wordwrap not cutting correctly) 2001-01-18 21:46:24 +00:00
Sean Bright
a588d65591 Added string comparison function strcoll(). It uses the current locale to
do the comparisons.
@- Added localeconv() and strcoll() functions for localization. (Sean)
2001-01-17 01:10:50 +00:00
Sean Bright
40f3524247 Added localeconv() function. Operates similarly to localeconv() defined in
locale.h.  Should work well under non-ZTS as well as ZTS.
2001-01-14 16:36:30 +00:00
Rui Hirokawa
0afcb03de3 added iconv extension. 2001-01-09 15:11:23 +00:00
Sascha Schumann
7fbc93d57f WS fix 2001-01-08 23:18:07 +00:00
Sascha Schumann
6a6317a403 Fix ZTS build (broken by iconv-related changes). 2001-01-08 23:13:57 +00:00
Rui Hirokawa
6368933118 added iconv_set_encoding() to change the encoding setting. 2001-01-08 02:39:52 +00:00
Rui Hirokawa
517b81ad43 added a output handler function ob_iconv_handler which tranforms output encoding using iconv(). 2001-01-08 01:40:33 +00:00
Jon Parise
4e384e0073 Make nl2br() output <br /> instead of <br> to be XHTML compliant.
Bug: 8390
2000-12-28 01:02:44 +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
foobar
c29e24c7e2 @- Changed setlocale() to use LC_* constants. (Jani) 2000-12-21 13:46:50 +00:00
Sascha Schumann
2d011afbfd Don't do anything, if the input string has a length of 0.
PR: #7686
2000-12-17 02:09:07 +00:00
Stig Bakken
6e1e78d1c6 @Added iconv() function (using libc or libiconv) (Stig) 2000-12-15 01:01:14 +00:00
Sascha Schumann
c0daf14cb3 Don't define LC_MESSAGES, if LC_MESSAGES is not defined.
PR: #8259
2000-12-14 15:58:14 +00:00
Stanislav Malyshev
16987ca15f Fix crash when first argument to strtr is empty 2000-12-13 10:22:36 +00:00
Zeev Suraski
6239ddfe6d Fix Win32 build 2000-12-11 16:27:48 +00:00
foobar
8bb668b226 Added constants for locale categories. 2000-12-10 15:55:34 +00:00
Frank M. Kromann
f9e226fe4a Fixing bug 8061. Position counter starts a 0 but was compared with length.
oops. the fix should be made twice.
2000-12-01 01:55:31 +00:00
Frank M. Kromann
518ab3c62f Fixing bug 8061. Position counter starts a 0 but was compared with length. 2000-12-01 01:26:42 +00:00
Sascha Schumann
939b72c771 removing '{' was certainly not intended 2000-11-22 04:16:25 +00:00
Sascha Schumann
886fbabb0b Don't access opt, if opt was not set. 2000-11-22 04:15:27 +00:00
Andrei Zmievski
65f37060db Fix bug #7667. 2000-11-06 19:41:30 +00:00
Sascha Schumann
3ee228371d Let strtr() use smart_str to reduce complexity 2000-10-12 01:26:26 +00:00
Sascha Schumann
174253123e Rewrite php_str_to_str using the smart_str API.
This removes much complexity from the function.

Speed is improved by pre-allocating memory instead of reallocating
the buffer each time the pattern is found.
2000-10-12 00:50:28 +00:00
Andi Gutmans
a1abfb7643 - Fix dirname() 2000-10-03 16:47:25 +00:00
Andi Gutmans
d37b140601 - Fix VC++ warning 2000-10-03 14:43:04 +00:00
Sascha Schumann
1cc3e6b5e6 Move php_memnstr to the header file, so that the function body is available
in all compilation units (note the static linkage).
2000-09-27 15:18:00 +00:00
Stanislav Malyshev
27fb7df0d2 Add empty string checks to add?slashes 2000-09-17 09:15:48 +00:00
Daniel Beckham
b852f3941f reversed chomp alias addition as per Andi Gutmans' request 2000-09-12 19:00:21 +00:00
Daniel Beckham
5925071957 added chomp() alias for chop() for us Perl purists. 2000-09-12 15:54:10 +00:00
Stanislav Malyshev
44e04f7688 Make parse_str always register globals with 1 argument and never -
with 2 arguments
2000-09-12 10:56:25 +00:00
Stanislav Malyshev
e0a5a4813e A quick attempt to make parse_str($str,$arr) not register globals. 2000-09-12 10:54:45 +00:00
Derick Rethans
71066c12dc - Fix for bug #6673
- Added a "cut" option to wordwrap (as per feature request #6429)
@ Added an optional parameter to wordwrap that cuts a string if the length
  of a word is longer than the maximum allowed with (Derick)
2000-09-11 20:06:24 +00:00
Andrei Zmievski
6ac728e179 (PHP parse_str) ParameterPassedByReference() check is not necessary. 2000-09-11 14:54:12 +00:00
Stanislav Malyshev
1ccac6ed55 Add additional parameter to parse_str for saving result (thanks to
John Bafford <dshadow@zort.net>)
@ Added second parameter for parse_str to save result (John Bafford)
2000-09-11 14:50:26 +00:00
Andrei Zmievski
5abacc5413 (PHP pathinfo) Fixed more typos. 2000-09-11 13:54:59 +00:00
Andrei Zmievski
5ed3e24f47 (PHP pathinfo) Fixed leaks, saved some memory allocations, added
more error checking.
2000-09-11 13:52:22 +00:00
Sterling Hughes
0b9a78cb1e @- Added the pathinfo() function. (Sterling) 2000-09-10 05:59:16 +00:00
Colin Viebrock
6f59f8b078 str_repeat() should be able to handle multipliers of 0 gracefully, IMHO ...
Hope no one disagrees. :)
2000-09-05 18:25:58 +00:00
Sterling Hughes
890ae1e244 #Its fixed this time, no really. 2000-08-18 13:43:22 +00:00
Sterling Hughes
1b8ee02fd6 Fix #6234 2000-08-18 13:22:09 +00:00
Stanislav Malyshev
56ecc78983 Fix chunk_split (#6208) 2000-08-17 08:47:42 +00:00
Egon Schmid
868e3b1db8 Changed some protos. 2000-08-06 14:36:10 +00:00
Rasmus Lerdorf
75bb019760 Fix bug in strip_tags function as per bug #5857
@ Fix bug in strip_tags function as per bug #5857 (Rasmus)
2000-07-30 05:04:06 +00:00
Egon Schmid
e4b7e9e916 Protos fixed. 2000-07-26 11:43:01 +00:00
David Croft
8dd1fdb1a0 wordwrap function from Chris Russel <russel@yorku.ca>
differences from his patch:
 - wordwrap width and wrap-string now optional parameters
   (default to 75 and "\n" respectively)
 - wordwrap_byte is now just an automatic special case of wordwrap
 - Zend API compliant

@- Added new function "wordwrap" to wordwrap long strings from Chris
@  Russel <russel@yorku.ca> (David Croft)
2000-07-22 01:12:24 +00:00
Andrei Zmievski
fbced1b9cc (php_addslashes) Fixed stop condition - it should only take into account
the length of the string, not the characters.
2000-07-21 15:29:59 +00:00
Hartmut Holzgraefe
5390b6a291 fix for bug #5707 2000-07-20 23:08:26 +00:00
Zeev Suraski
327e33972b Shutup a gcc warning 2000-07-18 20:40:23 +00:00
Stanislav Malyshev
7b9d2e33bf Fix crash in stripcslashes("") (#5628) 2000-07-17 10:22:30 +00:00
Egon Schmid
1231a3e473 Fixed other protos. 2000-07-09 19:33:19 +00:00
Egon Schmid
ee513d6ed5 Eliminated a typo. 2000-07-08 22:55:40 +00:00
Andrei Zmievski
885e40db05 @- Updated str_pad() to be able to pad on left/right/both sides. (Andrei) 2000-07-08 20:38:23 +00:00
Thies C. Arntzen
5b1f7bc8ac (implode), (strtr) no longer touch the internal array-pointer. 2000-06-18 10:37:01 +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
Andi Gutmans
1e5a405c5c - Make Windows compile
- Windows doesn't support LC_MESSAGES
2000-06-17 14:48:03 +00:00
Hartmut Holzgraefe
34cc1de229 setlocale didn't recognize LC_MESSAGES (BUG ID#3957) 2000-06-17 06:25:47 +00:00
Andrei Zmievski
ab99eb59fb (PHP str_pad) Terminate string with a null. 2000-06-12 16:06:27 +00:00
Andrei Zmievski
ef1d6987fd @- Fixed stripcslashes() to remove to strip \ in unknown escapes instead of
@  leaving it. (Andrei)
2000-06-09 13:58:10 +00:00
Rasmus Lerdorf
ff843bacf4 Make trim strip \0 to match php 3
@ Make trim strip \0 to match php 3 (Rasmus)
2000-06-07 00:59:14 +00:00
Andrei Zmievski
b928bdceb8 @- Added str_pad() for padding a string with an arbitrary string on left or
@  right. (Andrei)

Added str_pad() for padding a string with an arbitrary string on left or right.

# With all those macros, the code is starting to eerily resemble Perl's guts.
2000-06-06 20:42:33 +00:00
Clayton Collie
0b7fd17c2b Added sscanf() function. 2000-06-06 18:58:15 +00:00
Andi Gutmans
3701bc4207 - ARG_COUNT(ht) -> ZEND_NUM_ARGS() mega patch 2000-06-05 19:47:54 +00:00
Jouni Ahto
467c4314b8 (ucwords) Remove unnecessary code.
# Didn't keep my promise to stop...
2000-06-01 14:56:28 +00:00
Jouni Ahto
c106ab8ba0 (ucwords) Yet another fix for #4748.
# Last one from me today, I must have a beer now.
2000-06-01 14:40:41 +00:00
Andrei Zmievski
48db9618b8 Some tweaks. 2000-06-01 14:18:45 +00:00
Jouni Ahto
30c5b53ad1 (ucwords) Fixed fix for fix for fix for #4748.
# Today's most fixed bug.
2000-06-01 13:38:23 +00:00
Hartmut Holzgraefe
a35237795f uh, off by one?!! this time it's regression-tested, fast and compact 2000-06-01 11:47:48 +00:00
Jouni Ahto
3c51a88d0c (ucwords) Another try to fix #4748. 2000-06-01 10:07:44 +00:00
Hartmut Holzgraefe
f27956eb19 ucwords will now test against isspace() instead of just ==" "
(see BUG #4748)
2000-06-01 09:56:54 +00:00
Rasmus Lerdorf
7182e722ca Need a PHPAPI version of basename for some stuff I am working on.
Also fixed a bug along the way in the basename function.  If it
was fed something like "filename.ext/////" it would return the string
with all the slashes whereas if you fed it "/path/filename.ext////" it
would get it right.
@ Fixed basename() bug where "file.ext///" would not return the same
@ as "/path/file.ext///" (Rasmus)
2000-05-23 20:16:14 +00:00
Andrei Zmievski
03851ced5f Clean up the patch by Hartmut. 2000-05-23 12:38:12 +00:00
Hartmut Holzgraefe
78cec9f33e again (due to feature request in bug id #3251)
added optional 3rd parameter 'limit' to explode() as in split()
2000-05-23 05:04:28 +00:00
Hartmut Holzgraefe
eb7979ab5b patch to explode (bug id #3251) suspended till 4.0.1 2000-05-20 05:07:53 +00:00
Hartmut Holzgraefe
af77bc0583 added optional 3rd parameter 'limit' to explode() as in split()
(due to feature request in bug id #3251)
2000-05-19 22:00:38 +00:00
Zeev Suraski
e043439ff6 Update the license with the new clause 6 2000-05-18 15:34:45 +00:00
Andrei Zmievski
3b77fd37a9 TODO update and fix for C++ comments. 2000-04-27 14:41:18 +00:00
Sterling Hughes
68e54e9922 Small proto fix. 2000-04-26 01:16:57 +00:00
Andrei Zmievski
5c5ec88292 @Added substr_count() from Peter Kovacs. (Andrei)
# also some todo stuff
2000-04-26 00:29:59 +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
Andrei Zmievski
5cd7bf59b3 @- Fixed return of stristr() to no longer always be lowercased. (Andrei) 2000-03-30 14:34:46 +00:00
Zeev Suraski
b43f85d641 - Change new -> result. Using C++ keywords isn't too hot 2000-03-26 17:06:19 +00:00
Thies C. Arntzen
3e99a228df @- stristr() no longer modifies it's arguments. (Thies)
fix #3890
2000-03-22 08:14:00 +00:00
Egon Schmid
0275e4f665 Will watch the diffs as much as I can. 2000-02-24 10:11:42 +00:00
Zeev Suraski
86fa2aade2 the pipe is breaking all the time 2000-02-19 23:41:32 +00:00
Andi Gutmans
bac7a5085e - Not sure if len can be zero but it's better to check it once then
rechecking for it every loop and having an extra variable do nothing.
2000-02-13 15:59:32 +00:00
Andi Gutmans
7441ee5175 - Beautify a bit. 2000-02-13 15:56:07 +00:00
Zeev Suraski
6ae0902498 - Hopefully fix strip_tags bug
@- Fix overrun in strip_tags (Stas, Zend library)
2000-02-13 15:35:51 +00:00
Thies C. Arntzen
017a6353d1 @- Fixed crash in strip_tags() and related functions. (Thies) 2000-02-13 14:56:35 +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
6d0ab6166c SAPIfication, Episode VI: Return of the SAPI
Remove mostly all references to APACHE and CGI_BINARY from the code.

- Apache include files are no longer included by any PHP code, except for the Apache SAPI module.
- No server specific code is in any of the base PHP code.

Still left to be done:
- Eliminate any references to APACHE from the few remaining modules.
- Move request_info.c's logic to SAPI
- Modify the regex function names, and globals, so that we can always
  include them, without having to fear any interference with Apache;
  Always use the bundled regex library
2000-02-10 19:41:21 +00:00
Zeev Suraski
2460569ccb Change string->str where possible; string is basic a C++ class, so gdb can't look
inside variables named 'string'.
2000-02-08 22:21:43 +00:00
Zeev Suraski
489b705d4b @- Fixed memory corruption in fgetss(), strip_tags() and gzgetss() (Zeev) 2000-02-08 21:29:18 +00:00
Zeev Suraski
c12aa454ff Compile fixes 2000-02-05 15:44:20 +00:00
Andrei Zmievski
1a4e39838f (PHP wddx_deserialize) Fixed a problem with deserializing empty values.
(php_addslashes) Guard against NULL data.
2000-02-02 21:53:27 +00:00
Zeev Suraski
8a2f6c5e60 @- Fixed a crash bug in strtr() working on large input strings (Zeev) 2000-01-29 17:54:30 +00:00
Zeev Suraski
9ab35ae393 Tried to centralize global variable registration as much as possible:
- Added $HTTP_ENV_VARS[] and $HTTP_SERVER_VARS[] support, which similarly
  to $HTTP_GET_VARS[], contain environment and server variables.  Setting
  register_globals to Off will now also prevent registration of the
  environment and server variables into the global scope (Zeev)
- Renamed gpc_globals to register_globals (Zeev)
- Introduced variables_order that deprecates gpc_order, and allows control
  over the server and environment variables, in addition to GET/POST/Cookies
  (Zeev)
2000-01-28 17:24:53 +00:00
Zeev Suraski
fc678100cd post.c really had nothing to do with POST anymore, and it belongs to the top level directory 2000-01-28 13:31:12 +00:00
Jouni Ahto
9a07df6c4a (php_setlocale) Fixed memory leak (bug #3105).
# Must have been thinking something else when originally wrote this.
2000-01-05 12:26:41 +00:00
Thies C. Arntzen
402a9db2fe @- str_repeat() now returns correct length. (Thies) 2000-01-04 09:45:28 +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
Sascha Schumann
09d2e3d159 Move include into source file 1999-12-28 18:47:59 +00:00
Andi Gutmans
d6f788f56a - Get rid of two warnings 1999-12-25 09:06:55 +00:00
Thies C. Arntzen
63d0849403 pval->zval 1999-12-23 14:59:01 +00:00
Thies C. Arntzen
a94721fc4c @- strrev() no longer modifies arg1. (Thies) 1999-12-23 14:55:50 +00:00
Andrei Zmievski
6e1dbe497c Made quotemeta() binary-safe.
@ Made quotemeta() binary-safe. (Andrei)
1999-12-20 20:43:47 +00:00
Sascha Schumann
cb45c2ea55 Use zend_sprintf by default (which is defined to sprintf, if the system's
sprintf is useable).
1999-12-19 14:39:41 +00:00
Sascha Schumann
63d4411560 Use workaround function for sprintf, if the return value of sprintf is needed 1999-12-19 02:12:31 +00:00
Zeev Suraski
a1ad2872ee - The tree compiles again 1999-12-18 22:40:35 +00:00
Zeev Suraski
3ee4e65c95 More php3_ annihilation 1999-12-18 04:01:20 +00:00
Thies C. Arntzen
6553540153 @- implemented count_chars(). (Thies) 1999-12-14 03:52:12 +00:00
Andrei Zmievski
8ebba516a3 Boo. 1999-12-14 03:25:04 +00:00
Andrei Zmievski
a15916a47a Made strspn() and strcspn() binary-safe.
# Please test if you can, especially cases with embedded chr(0).

@ Made strspn() and strcspn() binary-safe.
1999-12-13 23:40:36 +00:00
Andrei Zmievski
0c779c51c9 (PHP php_implode) Made binary-safe.
@ Made implode() binary-safe (Andrei)
1999-12-11 20:00:40 +00:00
Andrei Zmievski
17ff0f3af3 Made strstr(), stristr(), and ucwords() binary-safe(). Also corrected
stristr() behavior to match that of strstr() if needle is not a string.
@ Made strstr(), stristr(), and ucwords() binary-safe() (Andrei)
1999-12-11 19:50:01 +00:00
Andrei Zmievski
d18ff45c4c A few more fixes for php_strtolower(). 1999-12-10 04:44:32 +00:00
Andrei Zmievski
7e4bd9fb60 (PHP strtoupper, strtolower, substr_replace) Made binary-safe.
@Made strtoupper(), strtolower(), substr_replace() binary-safe. (Andrei)
1999-12-09 23:45:30 +00:00
Thies C. Arntzen
5cdb16ad09 (explode) fixed newly introduced bug (them shall check twice *before* committing!) 1999-12-07 08:14:00 +00:00
Thies C. Arntzen
beb9723617 fixed warning 1999-12-06 19:01:21 +00:00
Thies C. Arntzen
1095f8a502 @- explode() is now binary-safe. (Thies)
we save one buffer-copy as well (hehe)
1999-12-06 18:29:22 +00:00
Thies C. Arntzen
db3cf21e55 @- strpos() is now binary-safe. (Thies) 1999-12-06 17:37:59 +00:00
Rasmus Lerdorf
dfd0f8824c More maintainer-mode cleanups 1999-12-05 14:16:37 +00:00
Sascha Schumann
5b983c944f Clean up php3.*\.h files. The files itself are renamed, and references in all
.*\.[ch] files were changed. There is a slight chance that my script missed
a few changes, please correct them manually.
1999-12-04 19:19:57 +00:00
Sascha Schumann
3b515617a4 Make array.c thread-safe 1999-12-01 17:21:52 +00:00
Sascha Schumann
6216edda44 Make basic/string functions thread-safe 1999-11-28 00:31:02 +00:00
Thies C. Arntzen
9788129e0e (PHP strtr) little smarter 1999-11-21 12:05:39 +00:00
Andrei Zmievski
90ecf41b19 (PHP substr_replace) Changed the order of the arguments. 1999-11-20 22:09:27 +00:00
Thies C. Arntzen
2013026c14 @- Implemented 2-Arg version of strtr($str,$translation_array). This can be used
@  to revert what htmlspecialchars() did. (Thies)
(PHP strtr) new 2-Arg version.
1999-11-20 15:53:18 +00:00
Andrei Zmievski
e46198bf7b (PHP substr_replace) New function.
@- Added substr_replace() function. (Andrei)
1999-11-16 22:44:13 +00:00
Thies C. Arntzen
4127b34a0a @- ucfirst()/ucwords() no longer modify arg1. (Thies)
(PHP ucfirst,ucwords) no longer modify arg1
1999-11-14 17:20:56 +00:00
Thies C. Arntzen
f2b0c70512 @- Fixed strtr() not to modify arg1. (Thies)
(PHP strtr) no longer modifies arg1.
1999-11-14 15:34:50 +00:00
Andrei Zmievski
b8ecfa18c1 (PHP str_repeat) New function. 1999-10-27 22:06:05 +00:00
Andrei Zmievski
9e0017536d _php3/_php3i -> php rename 1999-10-16 16:35:20 +00:00
Andrei Zmievski
22fb5f281a Renamed a couple of functions to have proper php_ prefix. 1999-10-15 20:04:31 +00:00
Andrei Zmievski
d69d118cbd (PHP implode): Properly separate zval for another case. 1999-10-15 14:53:56 +00:00
Zeev Suraski
231fe2e1aa That should do the trick - fix implode() not to modify its arguments 1999-10-15 14:45:54 +00:00
Jouni Ahto
9109d8dcdd (PHP setlocale) Locale settings are now correctly restored to the values
set in environment at request shutdown.
@- setlocale doesn't anymore screw up things if you forgot to change it back
   to the original settings. (Jouni)
# Trying to conform to the rules set up by Andrei. Let's hope this works.
1999-10-08 02:10:57 +00:00
Andrei Zmievski
97f105e450 Fix nl2br crash. 1999-09-30 20:03:32 +00:00
Andi Gutmans
cf6c92949c - Get rid of warning 1999-09-28 17:37:06 +00:00
Sascha Schumann
9442b13939 Make an extra copy of input parameter. 1999-09-27 18:00:30 +00:00
Sascha Schumann
9d1c26481a Use new Zend API 1999-09-25 11:55:42 +00:00
Stig Bakken
a4bc9478f8 kill another warning 1999-09-24 15:34:54 +00:00
Rasmus Lerdorf
cd0957112b fgetss/gzgetss fixes 1999-09-21 17:50:51 +00:00
Andrey Hristov
53fb0ea075 A couple of fixes. 1999-09-21 17:06:30 +00:00
Egon Schmid
565c322797 Here was also something missing. 1999-09-20 20:05:26 +00:00
Andi Gutmans
96a19593b2 - Internal functions which are basic language functions should be in Zend
and not in PHP. I.e. strlen(), each(), error_reporting(), count(),
  get_class_name().
1999-09-20 16:56:02 +00:00
Rasmus Lerdorf
c0dcedcafc Added optional allowable_tags arguments to strip_tags() and fgetss() to
allow you to specify a string of tags that are not to be stripped

Could have used flex for this, and Andrew sent me a flex file to do this,
but I could do the same thing with only minor additions to the existing
state machine and the resulting code is much smaller and tighter.
1999-09-20 15:50:56 +00:00
Zeev Suraski
98d95dd88e - Added support for unknown POST content types (Zeev)
- Introduce the convert_to_*_ex() API in strlen()
1999-09-16 23:18:15 +00:00
Zeev Suraski
1b6ccfe86c Cleanups & optimizations 1999-09-11 14:09:29 +00:00
Andi Gutmans
48ab0fb57d - Fix warnings and win32 compile 1999-09-07 20:29:31 +00:00
Andrey Hristov
209fe717b1 Kill warnings. 1999-09-07 16:09:18 +00:00
Jakub Skopal
5cc16d86b0 Added addcslashes(), stripcslashes().
Reverted addslashes() to the very original behaviour.
1999-09-05 20:55:13 +00:00
Jakub Skopal
8c2f752c3d C++ comment fix... sorry. 1999-09-05 00:58:59 +00:00
Jakub Skopal
06545c3364 Appended second argument of addslashes(),
Changed php_addslashes() to add \000 instead of just \0
1999-09-05 00:55:48 +00:00
Zeev Suraski
c12d4bc7d4 *** empty log message *** 1999-09-04 13:18:59 +00:00
Philippe Verdy
646db4f072 signed/unsigned warning removed 1999-08-12 10:53:29 +00:00
Egon Schmid
8588b58a5e More typos. 1999-08-09 20:52:58 +00:00
Zeev Suraski
3cb1eb0471 Removed '3' from key functions in PHP (maintained compatibility through
php3_compat.h)
1999-08-02 19:17:14 +00:00
Zeev Suraski
3ee8c8f0da This should fix the implode() problem 1999-07-30 22:17:51 +00:00
Andrey Hristov
736f4831a5 A bunch of grunt work updating function entries and declarations. 1999-07-24 22:16:54 +00:00
Sascha Schumann
58bb4adae1 use the same version as in php3 1999-07-21 09:31:48 +00:00
Zeev Suraski
4e6c2b468c * Get the mSQL module up to date 1999-07-16 17:06:48 +00:00
Zeev Suraski
c5724cbd14 License update 1999-07-16 13:13:16 +00:00
Andrey Hristov
226f75e0f3 Making the function accessible. 1999-06-22 19:36:52 +00:00
Thies C. Arntzen
8052667684 fixed implode "again" - 1999-06-21 15:57:20 +00:00
Stig Bakken
117a2fba07 * fixed some #if/#ifdef issues
* hand-patched in php3 changes from 3.0.6 to HEAD in these files:
   fopen-wrappers.[ch] ext/standard/file.[ch] ext/standard/fsock.[ch]
   ext/standard/php3_string.h ext/standard/string.c
* added some new file/socket macros for more readable code:
   FP_FGETS(buf,len,sock,fp,issock)
   FP_FREAD(buf,len,sock,fp,issock)
   FP_FEOF(sock,fp,issock)
   FP_FGETC(sock,fp,issock)
1999-06-16 17:06:53 +00:00
Stig Bakken
8c4411b5da * reverse fsock/string import patches 1999-06-15 21:51:00 +00:00
Stig Bakken
336392ea6c * now using php4.ini instead of php3.ini
* re-imported fopen-wrappers, fsock and string code from php3
  NB!  I have not tested all of the imported functions yet.
1999-06-15 17:06:22 +00:00
Thies C. Arntzen
a3464b7c11 oci8 to 3.0.9
implode works!
1999-06-09 19:47:06 +00:00
Sascha Schumann
a37a5e5c4a char * => unsigned char * 1999-05-16 11:32:51 +00:00
Sascha Schumann
39691bed9e conv_proto *.[ch] 1999-05-16 11:19:26 +00:00
Sascha Schumann
ed8a7dff62 add fast bin2hex string function 1999-05-16 11:12:23 +00:00
Sascha Schumann
a4d20864a6 - regex cache (needs some work)
- str_replace changes from php3
1999-05-12 15:40:15 +00:00
Rasmus Lerdorf
fbeeb8f29c substr() fix 1999-05-12 12:53:45 +00:00
Rasmus Lerdorf
43d93b6533 substr() fix for PHP4 as well 1999-05-12 12:43:03 +00:00
Zeev Suraski
ba88c0c47c * Move unclean_shutdown from PHP to Zend.
* The Master/Local headers in the phpinfo() table were reversed.
* Fix a gpc bug
1999-05-11 16:52:58 +00:00
Zeev Suraski
0818d96c97 A lot of cleanups... Removed old thread-safe code and other redundant code and files 1999-04-24 00:12:00 +00:00
Zeev Suraski
6f7c0edee3 Remove tls.[ch] 1999-04-23 20:06:01 +00:00
Stig Bakken
2c0ad3ee25 last bunch of extensions moving to ext/
fhttpd module taken out of functions, functions is ready to go.
The only extensions I have tested are gd+freetype and odbc(solid).
Please try compiling in your favourite extensions and let me know how it
works.
1999-04-22 02:48:28 +00:00
Zeev Suraski
751709a469 * Rename php_compat.[ch] to flock_compat.[ch] and move it to ext/standard
* Fix Win32 compilation
1999-04-21 19:01:38 +00:00
Sascha Schumann
dcc16af80c port some fixes, add compat routines 1999-04-21 17:11:01 +00:00
Sascha Schumann
a6e4ef3e31 str_replace fix 1999-04-21 16:31:27 +00:00
Zeev Suraski
5e8c322859 Make Win32 happy with the recent changes. 1999-04-18 15:58:27 +00:00
Stig Bakken
257de2bade First commit of re-structuring phase one. We have started using automake in
sub-directories and started to move extension code into ext/<name>.  For now,
I have moved the "standard" extension (which is quite a mix of everything
right now) and the GD extension into their own subdirs in ext/.
The configure script now also runs configure in the libzend directory
automatically and makes sure php4 and libzend use the same config.cache file.
To avoid running configure in libzend, use the --no-recursion option.
"make" in php4 also builds libzend now.
The Apache module doesn't compile right now, but a fix for that is
coming up.
1999-04-17 00:37:12 +00:00