com php-src: Fix bug #64782: SplFileObject constructor make $context optional: NEWS ext/spl/spl_directory.c ext/spl/tests/bug 64782.phpt
| From: | Nikita Popov | Date: | Thu, 12 Sep 2013 15:46:14 +0000 |
| Subject: | com php-src: Fix bug #64782: SplFileObject constructor make $context optional: NEWS ext/spl/spl_directory.c ext/spl/tests/bug 64782.phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-73178@lists.php.net to get a copy of this message | ||
Commit: ad976d82405ad25fb424328c5b9bdca7b734cca4
Author: Nikita Popov <nikic@php.net> Thu, 12 Sep 2013 17:46:14 +0200
Parents: 165f544ae9a3ac674a533a45ad8a8d5dccfa2536
Branches: PHP-5.5
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=ad976d82405ad25fb424328c5b9bdca7b734cca4
Log:
Fix bug #64782: SplFileObject constructor make $context optional
Bugs:
https://bugs.php.net/64782
Changed paths:
M NEWS
M ext/spl/spl_directory.c
A ext/spl/tests/bug64782.phpt
Diff:
diff --git a/NEWS b/NEWS
index 22cd012..c907c1b 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 1a417d0..3dc7b79 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 0000000..2b225cd
--- /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) """
+}