Commit Graph

87 Commits

Author SHA1 Message Date
Sara Golemon
1aa537ebd4 Update (most of) the functions in streamsfuncs.c
This commit also includes a change to tests/file/stream_rfc2397_002.phpt
which doesn't entirely pass in unicode mode yet, however that's a unicode
issue in the data:// wrapper that needs fixing, not a problem with the
streams layer itself.
2006-09-21 19:53:10 +00:00
Sara Golemon
3f56da6eba Add INI controlled default stream encoding (unicode.stream_encoding).
Add convenience function stream_defualt_encoding() for setting it.
2006-09-19 20:36:48 +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
Ilia Alshanetsky
675bda66b6 MFB: Fixed bug #38096 (large timeout values ignored on 32bit machines in
stream_socket_accept() and stream_socket_client()).
2006-09-11 14:53:33 +00:00
Antony Dovgal
d08f2e8897 more z/Z fixes 2006-08-31 14:41:15 +00:00
Antony Dovgal
dbe2092313 implement zend_unicode_to_string() and zend_string_to_unicode()
part #2 (of 2)
2006-08-08 16:59:11 +00:00
Antony Dovgal
44ad98405f MFB: rephrase the error message (fixes #38106) 2006-07-14 20:45:37 +00:00
Hannes Magnusson
731c3e4db0 Removed custom deprecate error messages
Use the fancy ZEND_ACC_DEPRECATED flag.
2006-06-26 11:31:19 +00:00
Hannes Magnusson
bf0a79d381 Updated protos
Fixed vim folding
2006-06-25 19:19:31 +00:00
Hannes Magnusson
53d262c04d Nuke unused var 2006-06-11 20:33:29 +00:00
Antony Dovgal
acf25d1aac fix typo (see #35900) 2006-04-19 08:43:05 +00:00
Antony Dovgal
becb273c16 MF51: fix #37077 (stream_socket_server() leaks when the port is not allowed) 2006-04-14 10:01:34 +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
Antony Dovgal
0b0fff07b2 fix spelling in error messages:
greater/less thEn -> greater/less thAn
2006-04-03 09:14:50 +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
a64789a452 Expand stream_context_create() to allow specifying params
as well as options.  Ignore the internal name change of the first arg.
The first arg is still for options, the second arg is for actual params.
2006-03-26 04:40:11 +00:00
Sara Golemon
f67ed7f3d4 Allow bidirectional encoding option via single context param 2006-03-24 22:27:13 +00:00
Sara Golemon
dfc827d108 Fix stream_get_line():
Checking type isn't nearly as important as checking nullness...
2006-03-24 21:37:42 +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
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
Dmitry Stogov
c366cc6d1a Nuke int32_t (everywhere except streams layer) and signed/unsigned warnings 2006-03-02 13:12:45 +00:00
Dmitry Stogov
e3b7f3fd0d Unicode support: MS Visual C compatibility 2006-02-26 11:57:14 +00:00
Ilia Alshanetsky
a9b90524d5 MFB51: Fixed bug #35900 (stream_select() should warning when tv_sec is
negative).
2006-02-23 18:28:37 +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
Antony Dovgal
8416426488 fix #36242 (Possible memory corruption in stream_select()) 2006-02-01 10:31:26 +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
Ilia Alshanetsky
c933634253 Fixed crash inside stream_get_line() when length parameter equals 0. 2005-07-05 19:24:07 +00:00
Ilia Alshanetsky
bcd33d5f18 Added offset parameter to the stream_copy_to_stream() function. 2005-06-17 23:29:20 +00:00
Sara Golemon
29ede46872 BugFix #31137 stream_filter_remove() segfaults when stream already closed 2005-03-29 04:02:03 +00:00
Ilia Alshanetsky
5bd7be94a4 Fixed compiler warning. 2005-03-13 17:03:55 +00:00
Marcus Boerger
4e390892b7 - Do not touch return_valu's refcount or is_ref 2005-03-11 01:52:24 +00:00
foobar
58c6ed3583 CS fix 2005-01-15 04:50:26 +00:00
Dmitry Stogov
9de934c210 Fixed SIGSEGV in ext/standard/tests/network/tcp4loop.phpt and ext/standard/tests/network/unixloop.phpt 2005-01-14 09:02:02 +00:00
Wez Furlong
c4bc5b7f33 Fix #31408: memory leak in stream_socket_recvfrom 2005-01-04 15:30:45 +00:00
Wez Furlong
843807c647 When a socket is non-blocking, don't block ssl enabled sockets.
Allow for non-blocking negotiation when calling stream_socket_enable_crypto().
That function will return the foolowing values:

false - negotiation failed
0     - try again when more data is available (only for non-blocking sockets)
true  - ssl was enabled
2004-12-25 02:02:56 +00:00
Wez Furlong
e1f3beaa13 really don't blow up 2004-12-23 19:39:22 +00:00
Wez Furlong
d3d757d95a don't crash... 2004-12-23 05:56:50 +00:00
Wez Furlong
419bbffeef Make it really build... 2004-12-13 13:52:01 +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
Ilia Alshanetsky
2390ca71f1 MFH: Added optional offset parameter to stream_get_contents(). 2004-10-12 23:25:24 +00:00
Ilia Alshanetsky
5c04e39383 Fixed bug #30362 (stream_get_line() not handling end string correctly). 2004-10-11 18:31:49 +00:00
Wez Furlong
99e290f882 Fix for Bug #24189: possibly unsafe select(2) usage.
We avoid the problem by using poll(2).

On systems without poll(2) (older bsd-ish systems, and win32), we emulate
poll(2) using select(2) and check for valid descriptors before attempting
to access them via the descriptor sets.

If an out-of-range descriptor is detected, an E_WARNING is raised suggesting
that PHP should be recompiled with a larger FD_SETSIZE (and also with a
suggested value).

Most uses of select(2) in the source are to poll a single descriptor, so
a couple of handy wrapper functions have been added to make this easier.

A configure option --enable-fd-setsize has been added to both the unix and
win32 builds; on unix we default to 16384 and on windows we default to 256.
Windows FD_SETSIZE imposes a limit on the maximum number of descriptors that
can be select()ed at once, whereas the unix FD_SETSIZE limit is based on the
highest numbered descriptor; 256 should be plenty for PHP scripts under windows
(the default OS setting is 64).

The win32 specific parts are untested; will do that now.
2004-09-17 12:44: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
Wez Furlong
d0ce6368b1 Avoid possible segfault when using stream_socket_client with bogus flags. 2004-08-06 14:08:17 +00:00
Wez Furlong
47e7fef08e Allow win32 stuff to build non-zts.
Fix stream crypto func (again? didn't I already commit that?)
2004-07-31 17:28:27 +00:00
Ilia Alshanetsky
45ddc6a5cd Better address availability check. 2004-07-28 23:34:27 +00:00