[php-src] master: calendar: improve ValueError for jdtounix()

Gina Peter Banyard <[email protected]>
Newsgroups gmane.comp.php.cvs.general
Message-ID <[email protected]>
Author: Gina Peter Banyard (Girgias)
Date: 2026-08-04T13:33:21+01:00

Commit: https://github.com/php/php-src/commit/588dd0445c47d5a541bc387427e9404c3065ad76
Raw diff: https://github.com/php/php-src/commit/588dd0445c47d5a541bc387427e9404c3065ad76.diff

calendar: improve ValueError for jdtounix()

Changed paths:
  M  ext/calendar/cal_unix.c
  M  ext/calendar/tests/bug80185.phpt
  M  ext/calendar/tests/gh16231.phpt
  M  ext/calendar/tests/jdtounix_error1.phpt


Diff:

diff --git a/ext/calendar/cal_unix.c b/ext/calendar/cal_unix.c
index 983857c553d9..a5970691efef 100644
--- a/ext/calendar/cal_unix.c
+++ b/ext/calendar/cal_unix.c
@@ -59,7 +59,7 @@ PHP_FUNCTION(jdtounix)
 		RETURN_THROWS();
 	}
 	if (uday < 2440588 || (uday - 2440588) > (ZEND_LONG_MAX / SECS_PER_DAY)) { /* before beginning of unix epoch or greater than representable */
-		zend_value_error("jday must be between 2440588 and " ZEND_LONG_FMT, ZEND_LONG_MAX / SECS_PER_DAY + 2440588);
+		zend_argument_value_error(1, "jday must be between 2440588 and " ZEND_LONG_FMT, ZEND_LONG_MAX / SECS_PER_DAY + 2440588);
 		RETURN_THROWS();
 	}
 
diff --git a/ext/calendar/tests/bug80185.phpt b/ext/calendar/tests/bug80185.phpt
index 44b9df86ac0c..e9ca439b7178 100644
--- a/ext/calendar/tests/bug80185.phpt
+++ b/ext/calendar/tests/bug80185.phpt
@@ -19,4 +19,4 @@ try {
 --EXPECT--
 int(2170713600)
 int(9223372036854720000)
-ValueError: jday must be between 2440588 and 106751993607888
+ValueError: jdtounix(): Argument #1 ($julian_day) jday must be between 2440588 and 106751993607888
diff --git a/ext/calendar/tests/gh16231.phpt b/ext/calendar/tests/gh16231.phpt
index d003f38b1f06..a68a4ea665be 100644
--- a/ext/calendar/tests/gh16231.phpt
+++ b/ext/calendar/tests/gh16231.phpt
@@ -17,5 +17,5 @@ try {
 }
 ?>
 --EXPECTF--
-ValueError: jday must be between 2440588 and %d
-ValueError: jday must be between 2440588 and %d
+ValueError: jdtounix(): Argument #1 ($julian_day) jday must be between 2440588 and %d
+ValueError: jdtounix(): Argument #1 ($julian_day) jday must be between 2440588 and %d
diff --git a/ext/calendar/tests/jdtounix_error1.phpt b/ext/calendar/tests/jdtounix_error1.phpt
index adad98947dcd..56e4e6fc05a2 100644
--- a/ext/calendar/tests/jdtounix_error1.phpt
+++ b/ext/calendar/tests/jdtounix_error1.phpt
@@ -15,4 +15,4 @@ try {
 }
 ?>
 --EXPECTF--
-ValueError: jday must be between 2440588 and %d
+ValueError: jdtounix(): Argument #1 ($julian_day) jday must be between 2440588 and %d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.