Commit Graph

442 Commits

Author SHA1 Message Date
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
Ilia Alshanetsky
55fd7ac601 Added optional maxlen parameter to file_get_contents(). 2005-02-08 15:25:45 +00:00
Wez Furlong
1069cefada support sucking data from streams in file_put_contents() 2005-02-06 23:05:24 +00:00
Wez Furlong
d213b67cdf Add missing constants for socketpair().
I thought I had included these...
Good catch Nuno :)
2004-12-12 23:21:53 +00:00
Wez Furlong
d10b86f8f4 Add stream_socket_pair(), a streams based version of socketpair().
Modified patch from Vincent [six at t0x dot net]
2004-12-12 16:10:35 +00:00
Antony Dovgal
01b996b98b fix buffer overrun & segfault in get_meta_tags() when there is no tag value 2004-12-10 10:30:01 +00:00