Commit Graph

126 Commits

Author SHA1 Message Date
Gustavo André dos Santos Lopes
f413b3726c - Fixed bug #61253: Wrappers opened with errors concurrency problem
#NOTE: There is a very small possibility that this will further break
#extensions that access wrapper->{err_stack, err_count}. On PECL SVN, rar is the
#only one and it may leak memory after this. I say "further break" because
#extensions that do that are already broken (will segfault) under ZTS, which is
#why this patch is necessary.
#There was what I deem as tacit acceptance from 5.3/5.4 RMs on this.
2012-03-08 12:30:59 +00:00
Felipe Pena
e4ca0ed09f - Year++ 2012-01-01 13:15:04 +00:00
Felipe Pena
927bf09c29 - Year++ 2011-01-01 02:19:59 +00:00
Ilia Alshanetsky
c946ff2f51 Fixed bug #53541 (format string bug in ext/phar). 2010-12-14 17:00:36 +00:00
Gustavo André dos Santos Lopes
8342c36f09 - Renamed php_stream_rep_nonstand_mode to
php_stream_mode_sanitize_fdopen_fopencookie, made it not
  exported and movied it from php_streams.h to
  php_streams_int.h.
2010-11-05 18:53:48 +00:00
Gustavo André dos Santos Lopes
68107ae1c3 - Fixed bug #53241 (stream casting that relies on fdopen/fopencookie fails
with streams opened with, inter alia, the 'xb' mode).
2010-11-05 01:29:08 +00:00
Adam Harvey
6e06a45f24 Fix bug #52802 (Out-of-date comment for
file_get_contents/php_stream_copy_to_mem) by updating the relevant comments.
2010-09-10 03:08:05 +00:00
Sebastian Bergmann
9ba1e81665 sed -i "s#1997-2009#1997-2010#g" **/*.c **/*.h **/*.php 2010-01-03 09:23:27 +00:00
Arnaud Le Blanc
8ea9eb8560 MFH: Better fix for #47997 2009-04-19 17:10:35 +00:00
Arnaud Le Blanc
14c717f449 Fixed bug #47997 (stream_copy_to_stream returns 1 on empty streams) 2009-04-19 13:46:47 +00:00
Sebastian Bergmann
08659c2dcd MFH: Bump copyright year, 3 of 3. 2008-12-31 11:15:49 +00:00
Lars Strojny
e34f9a87ac Cleanup: remove trailing whitespaces 2008-12-13 15:06:53 +00:00
Antony Dovgal
28a22396d4 MFH: invert the logics - FLAG_FCLOSE -> FLAG_NO_FCLOSE 2008-07-23 11:25:14 +00:00
Felipe Pena
fdfbfb96a1 - MFH: Fixed bug #44246 (closedir() accepts a file resource opened by fopen()) 2008-07-22 14:09:24 +00:00
Dmitry Stogov
99933df5e2 closeder/readdir/rewinddir must work only with directories 2008-06-11 09:01:56 +00:00
Dmitry Stogov
862f9ee3d2 Added ability to use stream wrappers in include_path 2008-03-27 10:33:40 +00:00
Sebastian Bergmann
d1dded8751 MFH: Bump copyright year, 2 of 2. 2007-12-31 07:17:19 +00:00
Marcus Boerger
6362476b20 MFH streams stuff 2007-11-06 11:02:36 +00:00
Jani Taskinen
d271071067 MFH: Fixed compile warnings 2007-07-21 01:43:33 +00:00
Dmitry Stogov
539f67ed8f 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-09 17:27:24 +00:00
Antony Dovgal
4a95928d1d MFH: implement PHP_STREAM_FLAG_NO_CLOSE and avoid hacks 2007-02-21 21:57:21 +00:00
Sebastian Bergmann
4223aa4d5e MFH: Bump year. 2007-01-01 09:36:18 +00:00
foobar
5bd93221a8 bump year and license version 2006-01-01 12:51:34 +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
Sara Golemon
a2c24ae90e BugFix#28868 (Part Two): This fixes thread unsafety in the userspace
filters which relates to the fix just applied for userspace wrappers.
2004-06-21 21:08:05 +00:00
Sara Golemon
7fcfa8865e BugFix#28868: Wrapper hash not thread-safe.
Userdefined wrappers were being registered into a global wrapper hash
which can cross threads.  Termination of once instance then has the
potential to leave an active stream in another instance with no wrapper
leading to segfault.
2004-06-21 18:58:55 +00:00
Hartmut Holzgraefe
b8f7d9f9f5 wrap all PHPAPI prototypes into BEGIN_EXTERN_C/END_EXTERN_C blocks
(else they won't be usable from C++ extensions)
2004-02-20 08:04:30 +00:00
Sara Golemon
6d10371ec6 'Bug Fix': scandir, being a new function in PHP5 should have always been wrapper aware. 2004-01-28 22:21:54 +00:00
foobar
ccfc46b0aa - Happy new year and PHP 5 for rest of the files too..
# Should the LICENSE and Zend/LICENSE dates be updated too?
2004-01-08 17:33:29 +00:00
Sara Golemon
a67bf6ecc9 Fix Win32 Build. mkdir/rmdir are macros 2003-12-13 18:48:39 +00:00
Sara Golemon
c56647833b Route mkdir()/rmdir() via wrapper ops.
Move current rmdir()/rmdir() code to plain_wrappers.c
Implement mkdir()/rmdir() in ftp:// wrapper
2003-12-13 04:07:18 +00:00
Sara Golemon
b1f8236b63 Route rename() via wrapper ops.
Move current rename() code to main/streams/plain_wrapper.c
Implement ftp/rename()
Implement userstreams/rename()
2003-12-12 23:06:42 +00:00
Sara Golemon
681d18effd Move safemode/basedir checks for url_stat to plain_wrapper. 2003-12-01 19:47:05 +00:00
Sara Golemon
026d4c9e4c Route php_stat() via streams/url_stat API (php_stream_stat_path).
This enables fopen-wrappers support on stat() and related family calls.
2003-11-28 23:25:28 +00:00
Wez Furlong
3ee72aa5be port "liveness" checks and a couple of other things from the 4.3 branch.
Liveness checks are used to validate persistent socket connects when they
are re-used.
2003-11-27 17:39:01 +00:00
Derick Rethans
3ab8d263b8 - Always store the URI path in the streams structure, and expose it with
stream_get_meta_data().
2003-11-03 14:12:46 +00:00
Ilia Alshanetsky
4d98e9ec97 Finalize the closing process of persistent streams. The current
behavior/API is as follows:

1) To close a persistent use php_stream_pclose(), it will close the stream
and remove it from the persistent list.

2) Inside PHP code only explicit fclose() will close persistent streams,
all other actions such as unset() or assigning a value to stream handle
will not.

3) Regular streams can still be closed by either fclose(), unset() or an
assignment of a value to the stream handler.
2003-07-29 18:26:34 +00:00
Wez Furlong
5ecc91c27d Merge selectable descriptor casting from PHP_4_3 branch. 2003-06-28 11:24:47 +00:00
James Cox
f68c7ff249 updating license information in the headers. 2003-06-10 20:04:29 +00:00
Sara Golemon
65d359d71a Fold 'options' parameter into wops->unlink method 2003-05-14 15:12:07 +00:00
Sara Golemon
5126fbe556 Setup unlink() method in wrapper_ops structure, implement unlink in plainfiles wrapper, explicitly set method NULL in other wrappers (for now), and rewrite unlink userland function to call into wrapper_ops 2003-05-14 06:10:04 +00:00
Sara Golemon
0c366c24e5 Macro: php_stream_get_from_zval(php_stream *stream, zval **zstream, char *mode, int options, char **opened_path, php_stream_context *context) Z_TYPE_PP(zstream) can be either IS_RESOURCE (An already opened stream) or IS_STRING (a path to a stream to be opened) 2003-04-17 00:00:34 +00:00
Wez Furlong
86fb577d59 Implement persistent plain file streams.
Usage:

php_stream *stream = php_stream_fopen("/path/to/file", "r+b", NULL,
	STREAM_OPEN_PERSISTENT | ENFORCE_SAFE_MODE | REPORT_ERRORS);

the filename and mode are combined to form the hash key for the persistent
list; they must be identical for this same stream to be returned again in the
next request.

Calling php_stream_close() on a persistent stream *will* close it, as is
usual with all persistent resources in PHP/ZE.

This is deliberately *not* exposed to user-space PHP at this time.
2003-03-18 23:37:54 +00:00