Commit Graph

269 Commits

Author SHA1 Message Date
Antony Dovgal
e2d3206e78 MFB: fix #37395 (recursive mkdir() fails to create nonexistent directories in root dir) 2006-05-16 13:05:23 +00:00
Marcus Boerger
1bbfe90571 - No need to have this controlled by allow_url_fopen 2006-05-14 19:13:17 +00:00
Marcus Boerger
3856d8da6d - Add strict compliant RFC2397 support (no //) 2006-05-14 18:35:40 +00:00
Marcus Boerger
3b66ab74f9 - RFC2397 add decoding
# done (need to decide whether all examples shouldl work or specs are
# followed)
2006-05-14 01:39:24 +00:00
Marcus Boerger
f9c249407d - Enforce stream mode correct 2006-05-14 01:03:42 +00:00
Marcus Boerger
73069100fd - Change to use dedicated stream ops 2006-05-14 00:45:27 +00:00
Marcus Boerger
4f29479a22 - RFC 2397 meta data handling 2006-05-14 00:40:53 +00:00
Marcus Boerger
29c0f5bede - Initial RFC2397 support
# decoding is missing right now
2006-05-13 17:53:01 +00:00
Antony Dovgal
8a434f5df0 merge fix for #37158 into HEAD
add test
2006-04-22 23:49:39 +00:00
Michael Wallner
54ff84d3d5 MFB: Fix reading stream filters never notified about EOF 2006-04-20 17:52:01 +00:00
Sara Golemon
d229fc9048 Fix copy/paste typo in php_stream_path_decode() proto 2006-04-18 19:09:31 +00:00
Antony Dovgal
78fdeb1acc fix CS and prevent NULL dereference 2006-04-13 18:14:14 +00:00
Sara Golemon
d05836890b Preserve full name of filter for use in stream_get_meta_data() 2006-04-13 04:41:08 +00:00
Sara Golemon
0b84c73635 Allow http:// wrapper to automatically apply correct unicode.from.* filter based on content-type header 2006-04-12 22:40:56 +00:00
Sara Golemon
3b35b15961 Do runtime conversions (with an E_NOTICE) on writing unicode data to a binary stream. Take the WTF out of the equation 2006-04-06 19:39:11 +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
Andrei Zmievski
1709428494 Implement to-Unicode conversion error behavior. Note the adjusted APIs. 2006-03-26 06:19:24 +00:00
Andrei Zmievski
930bde5897 * Remove unicode.from_error_mode and unicode.from_subst_char from INI
settings.
* Add unicode_set_error_mode() and unicode_set_subst_char() functions to
  manipulate these global settings.
2006-03-26 01:48:33 +00:00
Sara Golemon
e883cee0b1 Handle converter instantiation errors properly 2006-03-25 04:37:44 +00:00
Andrei Zmievski
abf44bf9df This is probably not a test.. 2006-03-24 21:25:44 +00:00
Sara Golemon
0260dfc9b1 Hook into new unicode conversion error handling API 2006-03-24 20:21:48 +00:00
Sara Golemon
880dd406f2 Add php_stream_get_record_unicde() API call.
Update stream_get_line() userspace function to handle unicode streams.
2006-03-24 19:22:24 +00:00
Sara Golemon
eb44e642b1 Add some error checking when stream converters are instantiated.
Use the global conversion error handlers for output conversion (for now)
We may want to make this customizable on a per-stream basis
via context param later on...
2006-03-24 00:19:39 +00:00
Sara Golemon
201d5df650 Allow grow_mode && !bufstart (original assertion logic) 2006-03-21 18:28:42 +00:00
Marcus Boerger
46bc026fb0 - Fix seek/eof issue in temp streams 2006-03-18 19:56:35 +00:00
Marcus Boerger
d7a4909ed2 - Fix issue in _php_stream_get_line(): Allow maxchars == 0 as macro
php_stream_get_line() does
2006-03-18 19:44:51 +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
Marcus Boerger
6380908706 - Fix warning 2006-03-16 00:53:58 +00:00
Sara Golemon
1eca7b87d1 Fix improper byte count on partial reads 2006-03-15 21:18:36 +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
Sara Golemon
04df7e3bdc Make php_stream_write_buffer() return characters written, not bytes 2006-03-13 20:54:06 +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
Ilia Alshanetsky
27e175eef0 So long safe_mode mode.
Also removed the magic_quotes configure option, no longer relevant since
the magic is gone :-).
2006-03-08 14:41: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
Marcus Boerger
56ec57c614 - If (SEEK_CUR,0) means an illegal seek we return -1 to denote the error 2006-02-28 18:00:03 +00:00
Marcus Boerger
6531669e4e - Cleanup 2006-02-28 12:06:54 +00:00
Dmitry Stogov
0f1209ab3d Portable unicode string API:
- use the same type (int) for zval.value.usr.len and zval.value.str.len
  - use union "zstr" as char*/UChar* mixture instead of void*
  - Z_UNISTR() and Z_UNILEN() no longer check for Z_TYPE()
  - nuke int32_t from ZE (not finisned)
2006-02-21 20:12:43 +00:00
Andi Gutmans
1efe984d08 - Get rid of using ENFORCE_SAFE_MODE. 2006-02-19 04:29:42 +00:00
Andi Gutmans
8f126f33ac - Fix according to Sara's reply 2006-02-19 03:41:25 +00:00
Andi Gutmans
d3f7bee047 Nuke php_check_safe_mode_include_dir 2006-02-19 01:19:37 +00:00
Andi Gutmans
e3b1e8c5dd - Some more safe_mode nuking 2006-02-19 01:10:13 +00:00
Sara Golemon
ff87d57268 Prevent bindport from being used uninitialized 2006-02-02 18:16:25 +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
Ilia Alshanetsky
1204ea0e63 MFB51: Only report mkdir() errors if error reporting option is set. 2006-01-17 02:32:34 +00:00
Antony Dovgal
07ff99a075 fix bug #35999 (recursive mkdir() does not work with relative path like "foo/bar") 2006-01-16 19:47:07 +00:00