Commit Graph

145 Commits

Author SHA1 Message Date
Dmitry Stogov
3c0dba4510 Fixed a bug in parameter passing/conversion API which caused tons of memleak and was the reason of ~1500 test failurs 2009-09-23 13:51:50 +00:00
Greg Beaver
80d061b18f fix segfault when running run-tests.php, and general potential for corruption
by calling php_stream_path_encode for unicode strings, php_stream_path_param_encode decrements
the refcount, but never restores it, which can cause freeing of zvals before they are done being used.
2009-07-31 23:44:52 +00:00
Arnaud Le Blanc
587137b2d3 un-duplicated code (merged unicode/string variants of stream_copy_to_stream
and let the compiler optimize specializations)
2009-05-17 16:52:35 +00:00
Arnaud Le Blanc
6b213bffb6 Better fix for #47997 2009-04-19 17:09:47 +00:00
Arnaud Le Blanc
069c0fdc80 MFB5.3: Fixed bug #47997 (stream_copy_to_stream returns 1 on empty streams) 2009-04-19 13:50:25 +00:00
Marcus Boerger
d4f5b3f0a9 - This is PHP 6 - if this ... ever gets out 2009-03-10 23:40:06 +00:00
Sebastian Bergmann
7f4dc8702a Bump copyright year, 3 of 3. 2008-12-31 11:12:40 +00:00
Lars Strojny
d0ee179f1e MFB: Remove trailing whitespaces 2008-12-13 15:07:20 +00:00
Antony Dovgal
55fecd6593 invert the logics - FLAG_FCLOSE -> FLAG_NO_FCLOSE 2008-07-23 11:24:35 +00:00
Felipe Pena
f76da1b96c - Fixed bug #44246 (closedir() accepts a file resource opened by fopen()) 2008-07-22 14:06:17 +00:00
Dmitry Stogov
00ea3108ea closeder/readdir/rewinddir must work only with directories 2008-06-11 09:01:44 +00:00
Dmitry Stogov
977cc79398 Added ability to use stream wrappers in include_path 2008-03-27 10:33:52 +00:00
Sebastian Bergmann
9b620d50b4 Bump copyright year, 2 of 2. 2007-12-31 07:12:20 +00:00
Yiduo (David) Wang
95da0dc570 Added macros for managing zval refcounts and is_ref statuses 2007-10-07 05:15:07 +00:00
Jani Taskinen
562a0629e4 - Fix compile warnings 2007-07-21 01:41:55 +00:00
Dmitry Stogov
da28d1e673 wrong comments 2007-07-09 16:42:45 +00:00
Dmitry Stogov
f766275b7a Added ability to create local or remote (URL) user streams
Local user streams must not be able to open(), URLs if allow_url_include is off
Implemented new function stream_is_local()
[
- stream_wrapper_register() extended with additional optional argument "flags"
  of type long. This time only one flag is implemented - STREAM_IS_URL, that
  means that userstream wrapper is remote (URL). By default stream is local.
- stream_is_local() is a new function that accepts stream and tell if this
  stream is local or remote (URL)
]
2007-07-03 10:22:55 +00:00
Marcus Boerger
53e5a8894c - One more tab to go 2007-03-03 22:30:07 +00:00
Marcus Boerger
3666425b9b - Change to hex to help read-/maintainability 2007-03-03 22:28:21 +00:00
Marcus Boerger
01220f548f - Add glob stream wrapper 2007-03-03 20:41:12 +00:00
Antony Dovgal
30dacafa72 implement PHP_STREAM_FLAG_NO_CLOSE and avoid hacks in plain wrapper 2007-02-21 21:56:45 +00:00
Sara Golemon
cc1b19cf0e Expand allow_url_fopen/allow_url_include functionality 2007-01-24 21:43:47 +00:00
Marcus Boerger
1c60406349 - Add more unicode stuff 2007-01-16 20:36:04 +00:00
Marcus Boerger
99bd9f758a - Help streams debugging 2007-01-15 22:19:33 +00:00
Sara Golemon
53333166fc Add convenience function for openeing files with unicode names 2007-01-10 22:43:17 +00:00
Sebastian Bergmann
3717df72ae Bump year. 2007-01-01 09:29:37 +00:00
Antony Dovgal
867d6380a8 fix php_stream_u_get_line() macro 2006-12-27 15:22:46 +00:00
Antony Dovgal
e2070c4360 eliminate a couple of compile warnings 2006-11-09 01:06:45 +00:00
Antony Dovgal
d38bf75b69 int -> size_t 2006-10-03 23:22:21 +00:00
Sara Golemon
e321287b4f Try out simplified API for encoding paths/filenames 2006-10-02 02:24:29 +00:00
Sara Golemon
f8fdb67056 PHP6 Updates for popen() and related functionality 2006-09-24 20:33:14 +00:00
Sara Golemon
3191ed0e85 Update stream_copy_to_stream() for PHP6 2006-09-22 19:54:30 +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
Sara Golemon
d229fc9048 Fix copy/paste typo in php_stream_path_decode() proto 2006-04-18 19:09: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
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
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
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
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
foobar
251c5173fd bump year and license version 2006-01-01 13:10:10 +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
Antony Dovgal
d5bb03b11a fix bugs #32742 (segmentation fault when the stream with a wrapper is not closed),
#32171 (Userspace stream wrapper crashes PHP)
2005-05-16 08:37:14 +00:00
Ilia Alshanetsky
c7b931d80d Fixed bug #31515 (Improve performance of scandir() by factor of 10 or so). 2005-02-22 00:24:13 +00:00
Wez Furlong
0569078901 Avoid bug where stream_copy_to_stream() call for precisely 2000000 bytes would
result in entire resource being copied.
The mmap brake is already present inside mmap_range() and is set to 1MB.
2005-02-06 23:17:09 +00:00
Ilia Alshanetsky
d98a44d483 Fixed bug #29801 (Set limit on the size of mmapable data). 2004-11-15 23:43:12 +00:00
Anantha Kesari H Y
a93f75ce6b NETWARE has a proper stat structure Now no need of CLIB_STAT_PATCH checks 2004-09-29 10:54:56 +00:00
Sara Golemon
34550382d8 Added stream_filter_remove() to cancel a stream filter.
Register filters as resources when
instantiated by stream_filter_(ap|pre)pend().

Export php_stream_filter_flush() internal function to wind buffered data
out of a particular filter until consumed by a later filter or sent to
stream->readbuffer or stream->ops->write()
2004-09-14 03:48:17 +00:00
Sara Golemon
955b43ba12 Add stream_wrapper_unregister()
Disables a wrapper (user-defined or built-in) for the life of the request.

Add stream_wrapper_restore()
Restores the wrapper originally defined at the time the request started
to the protocol name mentioned.
2004-09-10 20:45:35 +00:00