Skip to content

Commit

Permalink
- Fixed bug #54283 (new DatePeriod(NULL) causes crash)
Browse files Browse the repository at this point in the history
  • Loading branch information
felipensp committed Mar 23, 2011
1 parent 63673a5 commit 2adf58c
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion ext/date/php_date.c
Expand Up @@ -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);
Expand Down
14 changes: 14 additions & 0 deletions 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 ()"

0 comments on commit 2adf58c

Please sign in to comment.