Skip to content

Commit 92f6e21

Browse files
committed
Deprecate FILE_BINARY and FILE_TEXT constants
These constants have no effect. Part of https://wiki.php.net/rfc/deprecations_php_8_1.
1 parent 6390158 commit 92f6e21

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

UPGRADING

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -355,10 +355,13 @@ PHP 8.1 UPGRADE NOTES
355355
RFC: https://wiki.php.net/rfc/phase_out_serializable
356356

357357
- Standard:
358-
. Calling key(), current(), next(), prev(), reset(), or end() on objects
358+
. Calling key(), current(), next(), prev(), reset(), or end() on objects
359359
is deprecated. Instead cast the object to array first, or make use of
360360
ArrayIterator.
361361
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
362+
. The FILE_BINARY and FILE_TEXT constants are deprecated. They already had
363+
no effect previously.
364+
RFC: https://wiki.php.net/rfc/deprecations_php_8_1
362365

363366
========================================
364367
5. Changed Functions

ext/standard/file.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,8 +300,8 @@ PHP_MINIT_FUNCTION(file)
300300
REGISTER_LONG_CONSTANT("FILE_APPEND", PHP_FILE_APPEND, CONST_CS | CONST_PERSISTENT);
301301
REGISTER_LONG_CONSTANT("FILE_NO_DEFAULT_CONTEXT", PHP_FILE_NO_DEFAULT_CONTEXT, CONST_CS | CONST_PERSISTENT);
302302

303-
REGISTER_LONG_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT);
304-
REGISTER_LONG_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT);
303+
REGISTER_LONG_CONSTANT("FILE_TEXT", 0, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
304+
REGISTER_LONG_CONSTANT("FILE_BINARY", 0, CONST_CS | CONST_PERSISTENT | CONST_DEPRECATED);
305305

306306
#ifdef HAVE_FNMATCH
307307
REGISTER_LONG_CONSTANT("FNM_NOESCAPE", FNM_NOESCAPE, CONST_CS | CONST_PERSISTENT);
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
--TEST--
2+
The FILE_BINARY and FILE_TEXT constants are deprecated
3+
--FILE--
4+
<?php
5+
6+
var_dump(FILE_BINARY);
7+
var_dump(FILE_TEXT);
8+
9+
?>
10+
--EXPECTF--
11+
Deprecated: Constant FILE_BINARY is deprecated in %s on line %d
12+
int(0)
13+
14+
Deprecated: Constant FILE_TEXT is deprecated in %s on line %d
15+
int(0)

0 commit comments

Comments
 (0)