felipe Wed May 28 18:02:52 2008 UTC
Added files:
/php-src/ext/standard/tests/streams stream_encoding.phpt
Modified files:
/php-src/ext/standard streamsfuncs.c
Log:
- Added check for encoding optional parameter (avoiding the segfault in
filter.c: strlen(encoding))
If the parameter is not suplied, it will try to use the UG(stream_enconding)
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/streamsfuncs.c?r1=1.115&r2=1.116&diff_format=u
Index: php-src/ext/standard/streamsfuncs.c
diff -u php-src/ext/standard/streamsfuncs.c:1.115
php-src/ext/standard/streamsfuncs.c:1.116
--- php-src/ext/standard/streamsfuncs.c:1.115 Sun May 4 21:16:22 2008
+++ php-src/ext/standard/streamsfuncs.c Wed May 28 18:02:52 2008
@@ -17,7 +17,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: streamsfuncs.c,v 1.115 2008/05/04 21:16:22 colder Exp $ */
+/* $Id: streamsfuncs.c,v 1.116 2008/05/28 18:02:52 felipe Exp $ */
#include "php.h"
#include "php_globals.h"
@@ -1578,6 +1578,14 @@
if (remove_write_tail) {
php_stream_filter_remove(stream->writefilters.tail, 1
TSRMLS_CC);
}
+
+ if (encoding_len == 0) {
+ if (UG(stream_encoding) == NULL) {
+ php_error_docref(NULL TSRMLS_CC, E_WARNING, "The
stream_encoding must be defined");
+ RETURN_FALSE;
+ }
+ encoding = UG(stream_encoding);
+ }
/* UTODO: Allow overriding error handling for converters */
php_stream_encoding_apply(stream, 1, encoding, UG(from_error_mode),
UG(from_subst_char));
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/streams/stream_encoding.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/streams/stream_encoding.phpt
+++ php-src/ext/standard/tests/streams/stream_encoding.phpt
--TEST--
Testing stream_encoding()
--FILE--
<?php
stream_encoding(fopen(__FILE__, 'r'));
print "Done";
?>
--EXPECT--
Done
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php