Commit Graph

547 Commits

Author SHA1 Message Date
Rui Hirokawa
424d842729 MF PHP_5_2 2007-08-12 02:00:03 +00:00
Antony Dovgal
edd76024a3 MFB: Fixed bug #42243 (copy() does not ouput an error when the first arg is a dir) 2007-08-10 08:58:12 +00:00
Antony Dovgal
b608bd654d fix ws, cs & folding 2007-07-14 08:38:20 +00:00
Dmitry Stogov
5e4fde527b Fixed fgets() and fgetss() with limits 2007-07-10 17:02:43 +00:00
foobar
f730ecf98c - Fixed bug #41865 (fputcsv(): 2nd parameter is not optional) 2007-07-01 21:26:30 +00:00
Pierre Joye
a06fbeebc5 - #41609, file_put_contents is not binary safe when a binary string is
given (make it consistent with fwrite&co when unicode=1)
2007-06-14 19:56:35 +00:00
Antony Dovgal
f90bb0e967 check length only when it's specified
add the same check to fgetss()
2007-05-30 09:16:29 +00:00
Antony Dovgal
7b5215d83a fix #41516 (fgets() returns a line of text when length parameter is <= 0) 2007-05-29 20:48:38 +00:00
Antony Dovgal
5b56ff03b4 fix leak and check for < 0 only of the 5th arg was passed 2007-05-18 20:34:07 +00:00
Antony Dovgal
eb2240d494 fix #41430 (Fatal error with negative values of maxlen parameter of file_get_contents()) 2007-05-18 12:05:55 +00:00
Dmitry Stogov
2908322c14 WIN64 support 2007-04-16 09:43:53 +00:00
Marcus Boerger
2b5f0d87b7 - Fix realpath() logic 2007-03-03 19:07:51 +00:00
Antony Dovgal
72c8da0695 fix #40606 (umask is not being restored when request is finished) 2007-02-23 16:21:31 +00:00
Antony Dovgal
f6987cb6bc plug possible leak 2007-02-13 12:56:10 +00:00
Marcus Boerger
e5762b7241 - Fix mem access 2007-01-10 20:12:14 +00:00
Sebastian Bergmann
3717df72ae Bump year. 2007-01-01 09:29:37 +00:00
Antony Dovgal
a04c65f97f fix ZTS build 2006-12-28 15:03:19 +00:00
Andrei Zmievski
6212288bea Unicode support in sscanf() and fscanf(). (Tony, Andrei) 2006-12-26 22:34:05 +00:00
Antony Dovgal
0bf0c3c75a fix double free 2006-12-21 00:00:11 +00:00
Antony Dovgal
2073b38b0f fix double free on error 2006-12-20 22:42:59 +00:00
Dmitry Stogov
938f3d6efa Added function stream_socket_shutdown(). It is a wraper for system shutdown() function, that shut downs part of a full-duplex connection 2006-12-19 08:59:26 +00:00
Antony Dovgal
6f0472aa4c erm.. somehow this part got here twice 2006-12-12 22:38:30 +00:00
Sara Golemon
aa08686c85 More BC bodges for fgets/fgetss 2006-12-08 01:02:49 +00:00
Antony Dovgal
7ea07ff6dc MFB tests (they still fail though)
fix BC in fgetss()
2006-12-07 23:00:45 +00:00
Sara Golemon
53a4c18c6a Change fgets() behavior back to BC version 2006-12-07 09:51:36 +00:00
Antony Dovgal
2f5f375850 don't pass negative maxchars to php_stream_get_line_ex() 2006-12-05 13:45:49 +00:00
Sara Golemon
fac71c77c1 Add str_getcsv() and fix a couple cases in recent fgetcsv() reimplementation 2006-12-05 04:52:44 +00:00
Sara Golemon
78f65cc451 Unicode upgrade for fgetcsv() 2006-12-05 04:13:47 +00:00
Pierre Joye
19abc4b507 - #39538, fgetcsv can't handle starting newlines and trailing odd
number of backslashes (David Soria Parra, Pierre)
2006-11-22 12:56:26 +00:00
Antony Dovgal
7032c7dddf efree() if not NULL 2006-11-20 11:12:35 +00:00
Antony Dovgal
c7fd59af0f don't forget to close the stream when/if flock() fails 2006-11-13 20:31:15 +00:00
Antony Dovgal
49a2ae60d0 fix leaks in get_meta_tags() when used with b0rked HTML
add test
2006-11-13 20:17:05 +00:00
Andrei Zmievski
bee52acb7d Unicode support for fnmatch(). 2006-10-25 17:28:20 +00:00
Ilia Alshanetsky
f3eee9d980 MFB: Fixed bug #38934 (move_uploaded_file() cannot read uploaded file
outside of open_basedir).
2006-10-13 01:44:42 +00:00
Sara Golemon
25af62e3f4 Fix realpath() in unicode mode 2006-10-09 02:52:27 +00:00
Hannes Magnusson
176b72284c Error message clean up
(patch by Matt W (php_lists -AT- realpain.com))
2006-10-08 13:34:24 +00:00
Antony Dovgal
1bdcfa172a use correct type for p_len 2006-10-03 23:09:08 +00:00
Sara Golemon
a4b9e3719b Apply new path encoding style to the rest of e/s/file.c
This layout is definately simpler to maintain
and every bit as functional as the other version.
2006-10-02 03:13:47 +00:00
Sara Golemon
d2ff6db191 Apply simplified path encoding to copy() and give it a context param.
Funnily enough, this makes the copy() implementation almost identical
to what it was back in PHP5.
2006-10-02 02:47:34 +00:00
Sara Golemon
e321287b4f Try out simplified API for encoding paths/filenames 2006-10-02 02:24:29 +00:00
Sara Golemon
e1c934d56c PHP6 Updates for rmdir/mkdir/rename 2006-09-24 21:40:44 +00:00
Sara Golemon
f8fdb67056 PHP6 Updates for popen() and related functionality 2006-09-24 20:33:14 +00:00
Sara Golemon
74e30fd41d PHP6 Update for get_meta_tags() -- What a silly function... 2006-09-24 20:01:29 +00:00
Sara Golemon
6dffc7bf14 Fix copy() from last commit and add a few more PHP6 updates 2006-09-22 21:48:33 +00:00
Sara Golemon
6905daca8e Update copy() for PHP6 2006-09-22 20:02:26 +00:00
Sara Golemon
29ccb96d9e Tweak file_get_contents()'s return value a little 2006-09-22 18:23:33 +00:00
Dmitry Stogov
128548a5c0 Disabled autoconversion of hash keys (from string to unicode) for PHP arrays 2006-09-19 10:38:31 +00:00
Antony Dovgal
84060835f7 add a notice to fgetcsv() when delimiter or enclosure is longer than 1 char
(feature request #38496)
2006-08-18 12:50:36 +00:00
Antony Dovgal
6b4bfe4a35 all stream functions are actually macros that already have TSRMLS_CC,
no need to pass it manually
2006-07-16 15:54:25 +00:00
Marcus Boerger
d795e0b9bb - Implement todo: SplFileObject: ability to set the CSV separator per object 2006-07-15 14:31:51 +00:00
Sara Golemon
74eb59da59 #38105 (4/3) ustrlen != USTRLEN, update variable names used to keep this block's meaning clear 2006-07-14 20:50:45 +00:00
Antony Dovgal
44ad98405f MFB: rephrase the error message (fixes #38106) 2006-07-14 20:45:37 +00:00
Sara Golemon
165b2f2b76 #38105 (3/3) Default file_put_contents() to FILE_TEXT when unicode.semantics=on and flags param not specified 2006-07-14 19:16:23 +00:00
Antony Dovgal
d5f90c48c7 initialize srcstream
use different variable in local scope
2006-05-29 10:42:10 +00:00
Antony Dovgal
f59d444d8a prevent resource leaking when passing invalid stream resource as second argument 2006-05-29 10:23:53 +00:00
Hartmut Holzgraefe
205bdeda41 Name change: php_get_tmpdir() renamed to sys_get_temp_dir() 2006-05-19 10:44:34 +00:00
Hartmut Holzgraefe
daa5febadf Added php_get_tmpdir() function that returns the default directory for
temporary files (as requested in bug #35380)
2006-05-06 09:59:02 +00:00
Sara Golemon
d77a8562c2 Unicode Updates:
file() now unicode ready
get_meta_tags() updated for FS encoding, but content is still non-unicode
2006-05-02 18:23:32 +00:00
Frank M. Kromann
e6e2754439 Remove ZSTR() from stream macros. Calling function must apply this macro 2006-04-28 19:03:58 +00:00
Frank M. Kromann
1791befa0c Fix Win32 build. NULL_ZSTR was converted to ZSTR(NULL_ZSTR) 2006-04-22 10:39:31 +00:00
Sara Golemon
ea106887a7 Silence compiler warnings 2006-04-18 19:10:12 +00:00
Sara Golemon
1e9a9d596b MFB (r-1.409.2.6) copy() should not disrespect open_basedir on source file 2006-04-14 17:44:56 +00:00
Sara Golemon
b2523b29b8 Update filename handling and mark various functions for unicode safety 2006-04-01 00:05:31 +00:00
Sara Golemon
fd606a8d78 Add API hooks and unicode.filesystem_encoding for handling unicode
conversions of filename entries.

Normal path conversions will simply use this converter,
Certain other protocols (such as http) which specify a
required character set (utf8), may override the conversion
by defining a path_encode() and/or path_decode() wrapper ops method.
2006-03-31 22:51:37 +00:00
Sara Golemon
51b9a0f269 Make php_stream_copy_to_mem() unicode aware and
update userspace function file_get_contents().

Note: fgc()'s second parameter (use_include_path) has been changed
to be a bitmask "flags" parameter instead.

For the most commonly used values (TRUE, 1) this will continue functioning
as expected since the value of FILE_USE_INCLUDE_PATH is (coincidentally) 1.
The impact to other values should be noted in the migration6 guide.

This change makes it possible to allow fgc() to return binary file
contents (default) or unicode transcoded contents (using FILE_TEXT flag).
2006-03-30 00:22:51 +00:00
Sara Golemon
1c97a0d78c Update php_stream_passthru() to handle unicode data.
This updates userspace functions fpassthru() and readfile()

UG(output_encoding) is used by php_stream_passthru() to translate
unicode stream contents back to an outputable character set.

Note: readfile()'s second parameter (use_include_path) has been changed
to be a bitmask "flags" parameter instead.

For the most commonly used values (TRUE, 1) this will continue functioning
as expected since the value of FILE_USE_INCLUDE_PATH is (coincidentally) 1.
The impact to other values should be noted in the migration6 guide.

This change makes it possible to allow readfile() to output binary file
contents (default) or unicode transcoded contents (using FILE_TEXT flag).
2006-03-29 22:52:24 +00:00
Sara Golemon
30a2bd1d11 Another (and hopefully last) major streams commit.
This moves unicode conversion to the filter layer
(rather than at the lower streams layer)
unicode_filter.c has been moved from ext/unicode to main/streams
as it's an integral part of the streams unicode conversion process.

There are now three ways to set encoding on a stream:

(1) By context
$ctx = stream_context_create(NULL,array('encoding'=>'latin1'));
$fp = fopen('somefile', 'r+t', false, $ctx);

(2) By stream_encoding()
$fp = fopen('somefile', 'r+');
stream_encoding($fp, 'latin1');

(3) By filter
$fp = fopen('somefile', 'r+');
stream_filter_append($fp, 'unicode.from.latin1', STREAM_FILTER_READ);
stream_filter_append($fp, 'unicode.to.latin1', STREAM_FILTER_WRITE);

Note: Methods 1 and 2 are convenience wrappers around method 3.
2006-03-29 01:20:43 +00:00
Ilia Alshanetsky
75c7f810ea MFB51: Check 2nd parameter of tempnam() against path components. 2006-03-27 23:41:05 +00:00
Sara Golemon
0b2b16e6c7 Update fgetss() for unicode 2006-03-24 21:32:39 +00:00
Andrei Zmievski
a75b8f5f35 Fix compiler errors by using NULL_ZSTR where zstr is expected.
# I guess we need to use NULL_ZSTR instead of NULL when passing NULL to
# functions that expect zstr parameter.
2006-03-17 22:52:55 +00:00
Sara Golemon
df77705572 Switch (zstr) casts to use ZSTR() macro. 2006-03-15 00:28:57 +00:00
Sara Golemon
b576354982 More stream updates.
fgets() will work now as will anything which calls one of the
_php_stream_get_line() family of functions.
The one exception here is when the legacy defines are used on a unicode
stream.  At the moment they'll simply return NULL, I'll update these
to do sloppy conversion in a bit.

'make (u)test' still doesn't work, but it's a different doesn't work.
2006-03-14 21:15:05 +00:00
Derick Rethans
f7bfe18307 This makes file_put_contents() work for:
<?php
    declare(encoding="latin1");
    $a = "1234å67890";
    file_put_contents( "/tmp/testuc.1", $a);
    file_put_contents( "/tmp/testuc.2", (string) $a);

    $context = stream_context_create();
    stream_context_set_params($context, array( "output_encoding" => "latin1" ) );
    file_put_contents( "/tmp/testuc.3", $a, FILE_TEXT, $context);
    file_put_contents( "/tmp/testuc.4", (string) $a, FILE_TEXT, $context);
?>

But it still throws a warning on ".3". It's a small design issue that I
didn't want to touch right now.
2006-03-13 15:01:44 +00:00
Sara Golemon
48798021b5 Refactor streams layer for PHP6.
Don't be frightened by the size of this commit.
A significant portion of it is restoring the read buffer semantics back
to what PHP4/5 use.  (Or a close aproximation thereof).

See main/streams/streams.c and ext/standard/file.c for a set of
UTODO comments covering work yet to be done.
2006-03-13 04:40:11 +00:00
Pierre Joye
bb1ec86f9d - remove magic_quotes_gpc, magic_quotes_runtime, magic_quotes_sybase
(calling ini_set('magic_....') returns 0|false
- get_magic_quotes_gpc, get_magic_quotes_runtime are kept but always return false
- set_magic_quotes_runtime raises an E_CORE_ERROR
2006-03-08 00:43:32 +00:00
Ilia Alshanetsky
edd7d2a1df Fixed bug #36630 (umask not reset at the end of the request).
# This needs to be MFHed, but since it requires an API break it has to wait
# until the next minor release.
2006-03-06 14:27:45 +00:00
Dmitry Stogov
c366cc6d1a Nuke int32_t (everywhere except streams layer) and signed/unsigned warnings 2006-03-02 13:12:45 +00:00
Ilia Alshanetsky
c6ba5765be Nuke safe_mode 2006-02-19 18:19:33 +00:00
Andi Gutmans
1efe984d08 - Get rid of using ENFORCE_SAFE_MODE. 2006-02-19 04:29:42 +00:00
Andi Gutmans
ac1e7362b3 - More safe_mode nuking 2006-02-19 03:07:39 +00:00
Andi Gutmans
e94e25e621 Start nuking safe_mode. Still a lot of work to do... 2006-02-19 00:55:22 +00:00
Dmitry Stogov
227295a4f1 Unicode stuff is changed according to decision maden on PDM.
Now IS_BINRAY data type is removed and IS_STRING starts behave as IS_BINARY in unicode mode. IS_STRING is incompatible with IS_UNICODE, so ALL functions should be improved to support unicode mode.
2006-01-17 12:18:53 +00:00
Pierre Joye
d7772d5203 - MFB: add php_mkdir_ex 2006-01-13 04:10:32 +00:00
foobar
251c5173fd bump year and license version 2006-01-01 13:10:10 +00:00
foobar
0ac2b74b0b - Nuke php3 legacy 2005-12-05 22:53:34 +00:00
Dmitry Stogov
45699741e1 Fixed fgetcsv() and fputcsv() inconsistency. 2005-10-21 12:14:11 +00:00
Antony Dovgal
363d0aa028 fix fgetc() & compile warnings 2005-08-12 19:27:45 +00:00
Andrei Zmievski
264cec8be6 Unicode support. 2005-08-11 23:36:07 +00:00
foobar
23e671a51e - Bumber up year 2005-08-03 14:08:58 +00:00
Ilia Alshanetsky
fa4ea0fff4 Added support for LOCK_EX flag for file_put_contents(). 2005-07-12 17:55:38 +00:00
Ilia Alshanetsky
49c233212b Fixed bug #32160 (copying a file into itself leads to data loss). 2005-06-22 16:13:47 +00:00
Ilia Alshanetsky
a7ae41bf89 Fixed bug #31363 (broken non-blocking flock()).
# Patch by ian at snork dot net
2005-04-06 13:57:30 +00:00
Ilia Alshanetsky
f95651e338 revert copy patch. 2005-03-27 15:52:49 +00:00
Marcus Boerger
6bd8257607 - Fix proto
- Do not try to write zero bytes
2005-03-07 22:10:08 +00:00
Marcus Boerger
cf6711abfa - Length needs to be positive 2005-03-07 21:54:08 +00:00
Marcus Boerger
97655f8a3b - Make maic qutes runtime work if length is specified too 2005-03-07 21:52:34 +00:00
Marcus Boerger
85ebbd28a0 - Delay memory allocation, speeds up faiure case 2005-03-07 21:28:38 +00:00
Marcus Boerger
7fbc91acce - Allow length 0 as default (e.g. skip param) 2005-03-07 00:16:18 +00:00
Ilia Alshanetsky
09a8f38e39 Fixed bug #32160 (file truncation in copy() when source & destination are
the same).
2005-03-03 03:29:23 +00:00
Anantha Kesari H Y
67a2998335 NetWare libc has pwd.h 2005-02-17 13:56:49 +00:00