diff options
author | Nikita Popov <nikic@php.net> | 2013-09-12 17:46:14 +0200 |
---|---|---|
committer | Nikita Popov <nikic@php.net> | 2013-09-12 17:46:14 +0200 |
commit | ad976d82405ad25fb424328c5b9bdca7b734cca4 (patch) | |
tree | 3880289db61e352efcab82d02c30a96e95929271 | |
parent | 165f544ae9a3ac674a533a45ad8a8d5dccfa2536 (diff) | |
download | php-git-ad976d82405ad25fb424328c5b9bdca7b734cca4.tar.gz |
Fix bug #64782: SplFileObject constructor make $context optional
-rw-r--r-- | NEWS | 4 | ||||
-rw-r--r-- | ext/spl/spl_directory.c | 2 | ||||
-rw-r--r-- | ext/spl/tests/bug64782.phpt | 21 |
3 files changed, 26 insertions, 1 deletions
@@ -59,6 +59,10 @@ PHP NEWS . Fixed bug #51127/#65359 Request #25630/#43980/#54383 (Added php_serialize session serialize handler that uses plain serialize()). (Yasuo) +- SPL: + . Fix bug #64782 (SplFileObject constructor make $context optional / give it + a default value). (Nikita) + - Standard: . Fix issue with return types of password API helper functions. Found via static analysis by cjones. (Anthony Ferrara) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 1a417d0f58..3dc7b7925c 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -2290,7 +2290,7 @@ SPL_METHOD(SplFileObject, __construct) intern->u.file.open_mode = NULL; intern->u.file.open_mode_len = 0; - if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|sbr", + if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|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) { diff --git a/ext/spl/tests/bug64782.phpt b/ext/spl/tests/bug64782.phpt new file mode 100644 index 0000000000..2b225cd043 --- /dev/null +++ b/ext/spl/tests/bug64782.phpt @@ -0,0 +1,21 @@ +--TEST-- +Bug #64782: SplFileObject constructor make $context optional / give it a default value +--FILE-- +<?php + +var_dump(new SplFileObject(__FILE__, "r", false, null)); + +?> +--EXPECTF-- +object(SplFileObject)#1 (%d) { + ["pathName":"SplFileInfo":private]=> + string(50) "%s/bug64782.php" + ["fileName":"SplFileInfo":private]=> + string(12) "bug64782.php" + ["openMode":"SplFileObject":private]=> + string(1) "r" + ["delimiter":"SplFileObject":private]=> + string(1) "," + ["enclosure":"SplFileObject":private]=> + string(1) """ +} |