Skip to content

Commit 2bc23cc

Browse files
committed
Deprecate imap NIL constant
Part of https://wiki.php.net/rfc/deprecations_php_8_1.
1 parent f0b190c commit 2bc23cc

File tree

4 files changed

+17
-2
lines changed

4 files changed

+17
-2
lines changed

UPGRADING

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -350,6 +350,10 @@ PHP 8.1 UPGRADE NOTES
350350
instead.
351351
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
352352

353+
- IMAP:
354+
. The NIL constant has been deprecated. Use 0 instead.
355+
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
356+
353357
- Intl:
354358
. Calling IntlCalendar::roll() with bool argument is deprecated. Pass 1 and -1
355359
instead of true and false respectively.

ext/imap/php_imap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ PHP_MINIT_FUNCTION(imap)
491491
imap_object_handlers.clone_obj = NULL;
492492

493493
/* lets allow NIL */
494-
REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS);
494+
REGISTER_LONG_CONSTANT("NIL", NIL, CONST_PERSISTENT | CONST_CS | CONST_DEPRECATED);
495495

496496
/* plug in our gets */
497497
mail_parameters(NIL, SET_GETS, (void *) NIL);

ext/imap/tests/imap_open_error.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ try {
2323
}
2424

2525
try {
26-
imap_open('', '', '', NIL, -1);
26+
imap_open('', '', '', 0, -1);
2727
} catch (\ValueError $e) {
2828
echo $e->getMessage() . \PHP_EOL;
2929
}

ext/imap/tests/nil_constant.phpt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
--TEST--
2+
NIL constant is deprecated
3+
--EXTENSIONS--
4+
imap
5+
--FILE--
6+
<?php
7+
var_dump(NIL);
8+
?>
9+
--EXPECTF--
10+
Deprecated: Constant NIL is deprecated in %s on line %d
11+
int(0)

0 commit comments

Comments
 (0)