1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Fix GH-14930: Custom stream wrapper dir_readdir output truncated to 255 characters in PHP 8.3

Revert "Reserve less file space if possible in a directory entry"
This reverts commit 00c1e7bf0f.

Closes GH-14933.
This commit is contained in:
Joe Cai
2024-07-12 20:13:44 +10:00
committed by Niels Dossche
parent a23775a30d
commit 38501ed48a
3 changed files with 31 additions and 4 deletions

4
NEWS
View File

@@ -58,6 +58,10 @@ PHP NEWS
. Fix 32-bit wordwrap test failures. (orlitzky)
. Fixed bug GH-14774 (time_sleep_until overflow). (David Carlier)
- Streams:
. Fixed bug GH-14930 (Custom stream wrapper dir_readdir output truncated to
255 characters in PHP 8.3). (Joe Cai)
- Tidy:
. Fix memory leak in tidy_repair_file(). (nielsdos)

View File

@@ -0,0 +1,27 @@
--TEST--
GH-14930: Custom stream wrapper dir_readdir output truncated to 255 characters in PHP 8.3
--FILE--
<?php
class DummyWrapper
{
public $context;
public function dir_opendir($url, $options)
{
return true;
}
public function dir_readdir()
{
return 'very-long-filename-ieNoquiaC6ijeiy9beejaiphoriejo2cheehooGou8uhoh7eh0gefahyuQuohd7eec9auso9eeFah2Maedohsemi1eetoo5fo5biePh5eephai7SiuguipouLeemequ2oope9aigoQu5efak2aLeri9ithaiJ9eew3dianaiHoo1aexaighiitee6geghiequ5nohhiikahwee8ohk2Soip2Aikeithohdeitiedeiku7DiTh2eep3deitiedeiku7DiTh2ee.txt';
}
}
stream_wrapper_register('dummy', DummyWrapper::class);
$dh = opendir('dummy://', stream_context_create());
var_dump(readdir($dh));
?>
--EXPECT--
string(288) "very-long-filename-ieNoquiaC6ijeiy9beejaiphoriejo2cheehooGou8uhoh7eh0gefahyuQuohd7eec9auso9eeFah2Maedohsemi1eetoo5fo5biePh5eephai7SiuguipouLeemequ2oope9aigoQu5efak2aLeri9ithaiJ9eew3dianaiHoo1aexaighiitee6geghiequ5nohhiikahwee8ohk2Soip2Aikeithohdeitiedeiku7DiTh2eep3deitiedeiku7DiTh2ee.txt"

View File

@@ -107,11 +107,7 @@ typedef struct _php_stream_statbuf {
} php_stream_statbuf;
typedef struct _php_stream_dirent {
#ifdef NAME_MAX
char d_name[NAME_MAX + 1];
#else
char d_name[MAXPATHLEN];
#endif
unsigned char d_type;
} php_stream_dirent;