]> granicus.if.org Git - php/commitdiff
Fix #70266 (DateInterval::__construct.interval_spec is not supposed to be optional)
authorChristoph M. Becker <cmb@php.net>
Fri, 14 Aug 2015 12:19:12 +0000 (14:19 +0200)
committerChristoph M. Becker <cmb@php.net>
Fri, 14 Aug 2015 12:19:12 +0000 (14:19 +0200)
The required_num_args argument of ZEND_BEGIN_ARG_INFO_EX() has to be 1.

ext/date/php_date.c
ext/date/tests/bug70266.phpt [new file with mode: 0644]

index 2e3b3fdf11b41bfdc33c7587f71ad879daf0c9be..4ed439c4f5a0f729e1b4177f673d9d004aaa9a88 100644 (file)
@@ -383,7 +383,7 @@ ZEND_BEGIN_ARG_INFO_EX(arginfo_date_period_construct, 0, 0, 3)
        ZEND_ARG_INFO(0, end)
 ZEND_END_ARG_INFO()
 
-ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 0)
+ZEND_BEGIN_ARG_INFO_EX(arginfo_date_interval_construct, 0, 0, 1)
        ZEND_ARG_INFO(0, interval_spec)
 ZEND_END_ARG_INFO()
 /* }}} */
diff --git a/ext/date/tests/bug70266.phpt b/ext/date/tests/bug70266.phpt
new file mode 100644 (file)
index 0000000..5eeebab
--- /dev/null
@@ -0,0 +1,8 @@
+--TEST--
+Bug #70266 (DateInterval::__construct.interval_spec is not supposed to be optional)
+--FILE--
+<?php
+var_dump((new ReflectionParameter(['DateInterval', '__construct'], 0))->isOptional());
+?>
+--EXPECT--
+bool(false)