diff --git a/UPGRADING b/UPGRADING index a2426ad40cc..aad55c83197 100644 --- a/UPGRADING +++ b/UPGRADING @@ -350,6 +350,10 @@ PHP 8.1 UPGRADE NOTES instead. RFC: https://wiki.php.net/rfc/deprecations_php_8_1 +- IMAP: + . The NIL constant has been deprecated. Use 0 instead. + RFC: https://wiki.php.net/rfc/deprecations_php_8_1 + - Intl: . Calling IntlCalendar::roll() with bool argument is deprecated. Pass 1 and -1 instead of true and false respectively. diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c index 8a57d39cb60..37d4681d484 100644 --- a/ext/imap/php_imap.c +++ b/ext/imap/php_imap.c @@ -491,7 +491,7 @@ PHP_MINIT_FUNCTION(imap) imap_object_handlers.clone_obj = NULL; /* lets allow NIL */ - REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS); + REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS | CONST_DEPRECATED); /* plug in our gets */ mail_parameters(NIL, SET_GETS, (void *) NIL); diff --git a/ext/imap/tests/imap_open_error.phpt b/ext/imap/tests/imap_open_error.phpt index 8cd9c385cf7..965109db5e8 100644 --- a/ext/imap/tests/imap_open_error.phpt +++ b/ext/imap/tests/imap_open_error.phpt @@ -23,7 +23,7 @@ try { } try { - imap_open('', '', '', NIL, -1); + imap_open('', '', '', 0, -1); } catch (\ValueError $e) { echo $e->getMessage() . \PHP_EOL; } diff --git a/ext/imap/tests/nil_constant.phpt b/ext/imap/tests/nil_constant.phpt new file mode 100644 index 00000000000..dbf07aa2b00 --- /dev/null +++ b/ext/imap/tests/nil_constant.phpt @@ -0,0 +1,11 @@ +--TEST-- +NIL constant is deprecated +--EXTENSIONS-- +imap +--FILE-- + +--EXPECTF-- +Deprecated: Constant NIL is deprecated in %s on line %d +int(0)