mirror of
https://github.com/php/php-src.git
synced 2024-10-01 23:06:11 +00:00
1fe9f1e4f5
The fix was correct but break some code (at least in Horde) This is a temporary workaround to fix regressioni in 5.4, 5.5 and 5.6 This make php_date_initialize more consistent - on success return 1 + time initiliazed - on failure return 0 + time = zero which is check by DATE_CHECK_INITIALIZED by later method call Will restore consistency with other date classes in master.
28 lines
662 B
PHP
28 lines
662 B
PHP
--TEST--
|
|
Bug #67118 crashes in DateTime when this used after failed __construct
|
|
--INI--
|
|
date.timezone=Europe/Berlin
|
|
--FILE--
|
|
<?php
|
|
class mydt extends datetime
|
|
{
|
|
public function __construct($time = 'now', $tz = NULL, $format = NULL)
|
|
{
|
|
if (!empty($tz) && !is_object($tz)) {
|
|
$tz = new DateTimeZone($tz);
|
|
}
|
|
try {
|
|
@parent::__construct($time, $tz);
|
|
} catch (Exception $e) {
|
|
echo "Bad date" . $this->format("Y") . "\n";
|
|
}
|
|
}
|
|
|
|
};
|
|
|
|
new mydt("Funktionsansvarig rådgivning och juridik", "UTC");
|
|
?>
|
|
--EXPECTF--
|
|
Warning: DateTime::format(): The DateTime object has not been correctly initialized by its constructor in %sbug67118.php on line %d
|
|
Bad date
|