Skip to content

Commit bc8f571

Browse files
committed
Make epoch doesn't fit into PHP String a value error for date_timestamp_get()
1 parent 1ea34fb commit bc8f571

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

ext/date/php_date.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3338,8 +3338,8 @@ PHP_FUNCTION(date_timestamp_get)
33383338

33393339
/* Seconds since epoch must fit in a zend_long */
33403340
if (epoch_does_not_fit_in_zend_long) {
3341-
php_error_docref(NULL, E_WARNING, "Epoch doesn't fit in a PHP integer");
3342-
RETURN_FALSE;
3341+
zend_value_error("Epoch doesn't fit in a PHP integer");
3342+
RETURN_THROWS();
33433343
}
33443344

33453345
RETURN_LONG(timestamp);

ext/date/php_date.stub.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function date_isodate_set(DateTime $object, int $year, int $week, int $day = 1):
7373

7474
function date_timestamp_set(DateTime $object, int $timestamp): DateTime {}
7575

76-
function date_timestamp_get(DateTimeInterface $object): int|false {}
76+
function date_timestamp_get(DateTimeInterface $object): int {}
7777

7878
function timezone_open(string $timezone): DateTimeZone|false {}
7979

@@ -230,7 +230,7 @@ public function setISODate(int $year, int $week, int $dayOfWeek = 1) {}
230230
public function setTimestamp(int $timestamp) {}
231231

232232
/**
233-
* @return int|false
233+
* @return int
234234
* @alias date_timestamp_get
235235
*/
236236
public function getTimestamp() {}
@@ -282,7 +282,7 @@ public function getTimezone() {}
282282
public function getOffset() {}
283283

284284
/**
285-
* @return int|false
285+
* @return int
286286
* @alias date_timestamp_get
287287
*/
288288
public function getTimestamp() {}

ext/date/php_date_arginfo.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: 88ffa20bdb76b268afd12d1499fa13173045567e */
2+
* Stub hash: eae561b0424a4837d35239b66be8c545d7ac2b04 */
33

44
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_strtotime, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
55
ZEND_ARG_TYPE_INFO(0, datetime, IS_STRING, 0)
@@ -151,9 +151,7 @@ ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_date_timestamp_set, 0, 2, DateTim
151151
ZEND_ARG_TYPE_INFO(0, timestamp, IS_LONG, 0)
152152
ZEND_END_ARG_INFO()
153153

154-
ZEND_BEGIN_ARG_WITH_RETURN_TYPE_MASK_EX(arginfo_date_timestamp_get, 0, 1, MAY_BE_LONG|MAY_BE_FALSE)
155-
ZEND_ARG_OBJ_INFO(0, object, DateTimeInterface, 0)
156-
ZEND_END_ARG_INFO()
154+
#define arginfo_date_timestamp_get arginfo_date_offset_get
157155

158156
ZEND_BEGIN_ARG_WITH_RETURN_OBJ_TYPE_MASK_EX(arginfo_timezone_open, 0, 1, DateTimeZone, MAY_BE_FALSE)
159157
ZEND_ARG_TYPE_INFO(0, timezone, IS_STRING, 0)

0 commit comments

Comments
 (0)