From: Nikita Popov Date: Thu, 12 Sep 2013 15:46:14 +0000 (+0200) Subject: Fix bug #64782: SplFileObject constructor make $context optional X-Git-Tag: php-5.5.4~12 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=ad976d82405ad25fb424328c5b9bdca7b734cca4;p=php Fix bug #64782: SplFileObject constructor make $context optional --- diff --git a/NEWS b/NEWS index 22cd0120e5..c907c1bc30 100644 --- a/NEWS +++ b/NEWS @@ -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-- + +--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) """ +}