mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Fix #75031: Support append mode in php://temp
streams
This patch introduces a distinction between write mode and append mode in `php://temp` and `php://memory` streams, achieving parity with C stdio.
This commit is contained in:
parent
a1a949d89c
commit
db96b7c245
5 changed files with 65 additions and 16 deletions
|
@ -25,9 +25,10 @@
|
|||
|
||||
#define PHP_STREAM_MAX_MEM 2 * 1024 * 1024
|
||||
|
||||
#define TEMP_STREAM_DEFAULT 0
|
||||
#define TEMP_STREAM_READONLY 1
|
||||
#define TEMP_STREAM_TAKE_BUFFER 2
|
||||
#define TEMP_STREAM_DEFAULT 0x0
|
||||
#define TEMP_STREAM_READONLY 0x1
|
||||
#define TEMP_STREAM_TAKE_BUFFER 0x2
|
||||
#define TEMP_STREAM_APPEND 0x4
|
||||
|
||||
#define php_stream_memory_create(mode) _php_stream_memory_create((mode) STREAMS_CC)
|
||||
#define php_stream_memory_create_rel(mode) _php_stream_memory_create((mode) STREAMS_REL_CC)
|
||||
|
@ -41,6 +42,7 @@
|
|||
#define php_stream_temp_open(mode, max_memory_usage, buf, length) _php_stream_temp_open((mode), (max_memory_usage), (buf), (length) STREAMS_CC)
|
||||
|
||||
BEGIN_EXTERN_C()
|
||||
|
||||
PHPAPI php_stream *_php_stream_memory_create(int mode STREAMS_DC);
|
||||
PHPAPI php_stream *_php_stream_memory_open(int mode, char *buf, size_t length STREAMS_DC);
|
||||
PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length STREAMS_DC);
|
||||
|
@ -48,6 +50,10 @@ PHPAPI char *_php_stream_memory_get_buffer(php_stream *stream, size_t *length ST
|
|||
PHPAPI php_stream *_php_stream_temp_create(int mode, size_t max_memory_usage STREAMS_DC);
|
||||
PHPAPI php_stream *_php_stream_temp_create_ex(int mode, size_t max_memory_usage, const char *tmpdir STREAMS_DC);
|
||||
PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC);
|
||||
|
||||
PHPAPI int php_stream_mode_from_str(const char *mode);
|
||||
PHPAPI const char *_php_stream_mode_to_str(int mode);
|
||||
|
||||
END_EXTERN_C()
|
||||
|
||||
extern PHPAPI php_stream_ops php_stream_memory_ops;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue