summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorFelipe Pena <felipe@php.net>2011-03-23 01:22:18 +0000
committerFelipe Pena <felipe@php.net>2011-03-23 01:22:18 +0000
commit2adf58cfcf9a2e4b55a775fcbd3ccc5dd16ec979 (patch)
tree29115de742fd104fe43966ad676148ec8c31828b /ext
parent63673a533f49e090172e2fac7e303fc755df23b4 (diff)
downloadphp-git-2adf58cfcf9a2e4b55a775fcbd3ccc5dd16ec979.tar.gz
- Fixed bug #54283 (new DatePeriod(NULL) causes crash)
Diffstat (limited to 'ext')
-rw-r--r--ext/date/php_date.c2
-rw-r--r--ext/date/tests/bug54283.phpt14
2 files changed, 15 insertions, 1 deletions
diff --git a/ext/date/php_date.c b/ext/date/php_date.c
index 56c6f8e976..1930e88abd 100644
--- a/ext/date/php_date.c
+++ b/ext/date/php_date.c
@@ -3762,7 +3762,7 @@ PHP_METHOD(DatePeriod, __construct)
dpobj = zend_object_store_get_object(getThis() TSRMLS_CC);
dpobj->current = NULL;
- if (isostr_len) {
+ if (isostr) {
date_period_initialize(&(dpobj->start), &(dpobj->end), &(dpobj->interval), &recurrences, isostr, isostr_len TSRMLS_CC);
if (dpobj->start == NULL) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "The ISO interval '%s' did not contain a start date.", isostr);
diff --git a/ext/date/tests/bug54283.phpt b/ext/date/tests/bug54283.phpt
new file mode 100644
index 0000000000..780d0fa762
--- /dev/null
+++ b/ext/date/tests/bug54283.phpt
@@ -0,0 +1,14 @@
+--TEST--
+Bug #54283 (new DatePeriod(NULL) causes crash)
+--FILE--
+<?php
+
+try {
+ var_dump(new DatePeriod(NULL));
+} catch (Exception $e) {
+ var_dump($e->getMessage());
+}
+
+?>
+--EXPECTF--
+string(51) "DatePeriod::__construct(): Unknown or bad format ()"