. Fixed bug #51958 (socket_accept() fails on IPv6 server sockets). (Gustavo)
- SPL extension:
+ . Fixed bug #54292 (Wrong parameter causes crash in
+ SplFileObject::__construct()). (Felipe)
. Fixed bug #54291 (Crash iterating DirectoryIterator for dir name starting
with \0). (Gustavo)
. Fixed bug #54281 (Crash in non-initialized RecursiveIteratorIterator).
zend_replace_error_handling(EH_THROW, spl_ce_RuntimeException, &error_handling TSRMLS_CC);
- intern->u.file.open_mode = "r";
- intern->u.file.open_mode_len = 1;
+ intern->u.file.open_mode = NULL;
+ intern->u.file.open_mode_len = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|sbr",
&intern->file_name, &intern->file_name_len,
&intern->u.file.open_mode, &intern->u.file.open_mode_len,
- &use_include_path, &intern->u.file.zcontext) == FAILURE) {
+ &use_include_path, &intern->u.file.zcontext) == FAILURE) {
+ intern->u.file.open_mode = NULL;
+ intern->file_name = NULL;
zend_restore_error_handling(&error_handling TSRMLS_CC);
return;
}
+ if (intern->u.file.open_mode == NULL) {
+ intern->u.file.open_mode = "r";
+ intern->u.file.open_mode_len = 1;
+ }
+
if (spl_filesystem_file_open(intern, use_include_path, 0 TSRMLS_CC) == SUCCESS) {
tmp_path_len = strlen(intern->u.file.stream->orig_path);
--- /dev/null
+--TEST--
+Bug #54292 (Wrong parameter causes crash in SplFileObject::__construct())
+--FILE--
+<?php
+
+try {
+ new SplFileObject('foo', array());
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+string(74) "SplFileObject::__construct() expects parameter 2 to be string, array given"