mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Deprecate calling DatePeriod::__construct() with less than 3 arguments
This commit is contained in:
parent
866aa12bcd
commit
adc26424aa
8 changed files with 34 additions and 5 deletions
|
@ -142,6 +142,10 @@ PHP 8.4 UPGRADE NOTES
|
|||
4. Deprecated Functionality
|
||||
========================================
|
||||
|
||||
- Date:
|
||||
. Calling DatePeriod::__construct(string $isostr, int $options = 0) is
|
||||
deprecated. Use DatePeriod::createFromISO8601String() instead.
|
||||
|
||||
========================================
|
||||
5. Changed Functions
|
||||
========================================
|
||||
|
|
|
@ -5061,6 +5061,12 @@ PHP_METHOD(DatePeriod, __construct)
|
|||
dpobj->current = NULL;
|
||||
|
||||
if (isostr) {
|
||||
zend_error(E_DEPRECATED, "Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, "
|
||||
"use DatePeriod::createFromISO8601String() instead");
|
||||
if (UNEXPECTED(EG(exception))) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
if (!date_period_init_iso8601_string(dpobj, date_ce_date, isostr, isostr_len, options, &recurrences)) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
|
|
@ -58,7 +58,8 @@ foreach ($period as $i => $notDate) {
|
|||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
0: 2012-07-01
|
||||
1: 2012-07-08
|
||||
2: 2012-07-15
|
||||
|
@ -79,10 +80,14 @@ foreach ($period as $i => $notDate) {
|
|||
1: 2012-07-08
|
||||
2: 2012-07-15
|
||||
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
0: 2012-07-01
|
||||
1: 2012-07-08
|
||||
2: 2012-07-15
|
||||
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
0: 1
|
||||
1: 2
|
||||
2: 3
|
||||
|
|
|
@ -21,9 +21,11 @@ try {
|
|||
echo $e::class, ': ', $e->getMessage(), "\n";
|
||||
}
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
OK
|
||||
OK
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
OK
|
||||
OK
|
||||
TypeError: DatePeriod::__construct() accepts (DateTimeInterface, DateInterval, int [, int]), or (DateTimeInterface, DateInterval, DateTime [, int]), or (string [, int]) as arguments
|
||||
|
|
|
@ -26,7 +26,8 @@ foreach ( $dp as $d )
|
|||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
DateMalformedPeriodStringException: Unknown or bad format (2D)
|
||||
DateMalformedPeriodStringException: Unknown or bad format (2D)
|
||||
string(24) "2008-07-20T22:44:53+0200"
|
||||
|
|
|
@ -12,4 +12,6 @@ try {
|
|||
?>
|
||||
--EXPECTF--
|
||||
Deprecated: DatePeriod::__construct(): Passing null to parameter #1 ($start) of type string is deprecated in %s on line %d
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
string(24) "Unknown or bad format ()"
|
||||
|
|
|
@ -34,9 +34,13 @@ try {
|
|||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
DateMalformedIntervalStringException: Unknown or bad format (P3"D)
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
DateMalformedPeriodStringException: Unknown or bad format (P3"D)
|
||||
DateMalformedPeriodStringException: Unknown or bad format (P3"D)
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
DateMalformedPeriodStringException: Unknown or bad format (2008-03-01T12:00:00Z1)
|
||||
DateMalformedPeriodStringException: Unknown or bad format (2008-03-01T12:00:00Z1)
|
||||
|
|
|
@ -40,10 +40,15 @@ try {
|
|||
}
|
||||
|
||||
?>
|
||||
--EXPECT--
|
||||
--EXPECTF--
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
DateMalformedPeriodStringException: DatePeriod::__construct(): ISO interval must contain a start date, "R4" given
|
||||
DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): ISO interval must contain a start date, "R4" given
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
DateMalformedPeriodStringException: DatePeriod::__construct(): ISO interval must contain an interval, "R4/2012-07-01T00:00:00Z" given
|
||||
DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): ISO interval must contain an interval, "R4/2012-07-01T00:00:00Z" given
|
||||
|
||||
Deprecated: Calling DatePeriod::__construct(string $isostr, int $options = 0) is deprecated, use DatePeriod::createFromISO8601String() instead in %s on line %d
|
||||
DateMalformedPeriodStringException: DatePeriod::__construct(): Recurrence count must be greater than 0
|
||||
DateMalformedPeriodStringException: DatePeriod::createFromISO8601String(): Recurrence count must be greater than 0
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue