File tree 4 files changed +14
-0
lines changed
4 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,8 @@ PHP NEWS
173
173
174
174
- POSIX:
175
175
. Added POSIX_SC_CHILD_MAX and POSIX_SC_CLK_TCK constants. (Jakub Zelenka)
176
+ . Updated posix_isatty to set the error number on file descriptors.
177
+ (David Carlier)
176
178
177
179
- PSpell:
178
180
. Moved to PECL. (Derick Rethans)
Original file line number Diff line number Diff line change @@ -383,6 +383,10 @@ PHP 8.4 UPGRADE NOTES
383
383
- PGSQL:
384
384
. pg_select, the conditions arguments accepts an empty array and is optional.
385
385
386
+ - POSIX:
387
+ . posix_isatty now sets the error number when the file descriptor/stream argument
388
+ is invalid.
389
+
386
390
- SPL:
387
391
. SplPriorityQueue::insert() and SplPriorityQueue::recoverFromCorruption()
388
392
now has a tentative return type of true
Original file line number Diff line number Diff line change @@ -521,11 +521,13 @@ PHP_FUNCTION(posix_isatty)
521
521
522
522
/* A valid file descriptor must fit in an int and be positive */
523
523
if (fd < 0 || fd > INT_MAX ) {
524
+ POSIX_G (last_error ) = EBADF ;
524
525
RETURN_FALSE ;
525
526
}
526
527
if (isatty (fd )) {
527
528
RETURN_TRUE ;
528
529
} else {
530
+ POSIX_G (last_error ) = errno ;
529
531
RETURN_FALSE ;
530
532
}
531
533
}
Original file line number Diff line number Diff line change @@ -11,13 +11,19 @@ if (PHP_INT_SIZE != 8) die('skip C int is same size as zend_long');
11
11
12
12
$ values = [
13
13
-1 ,
14
+ 10024 ,
14
15
2 **50 +1 ,
15
16
];
16
17
17
18
foreach ($ values as $ value ) {
18
19
var_dump (posix_isatty ($ value ));
20
+ var_dump (posix_strerror (posix_get_last_error ()));
19
21
}
20
22
?>
21
23
--EXPECT--
22
24
bool(false)
25
+ string(19) "Bad file descriptor"
23
26
bool(false)
27
+ string(19) "Bad file descriptor"
28
+ bool(false)
29
+ string(19) "Bad file descriptor"
You can’t perform that action at this time.
0 commit comments