mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Fix GH-13203: file_put_contents fail on strings over 4GB on Windows
Closes GH-13205
This commit is contained in:
parent
a284c3e873
commit
2343791aff
3 changed files with 71 additions and 5 deletions
|
@ -40,6 +40,7 @@
|
|||
# include "win32/time.h"
|
||||
# include "win32/ioutil.h"
|
||||
# include "win32/readdir.h"
|
||||
# include <limits.h>
|
||||
#endif
|
||||
|
||||
#define php_stream_fopen_from_fd_int(fd, mode, persistent_id) _php_stream_fopen_from_fd_int((fd), (mode), (persistent_id) STREAMS_CC)
|
||||
|
@ -353,11 +354,7 @@ static ssize_t php_stdiop_write(php_stream *stream, const char *buf, size_t coun
|
|||
|
||||
if (data->fd >= 0) {
|
||||
#ifdef PHP_WIN32
|
||||
ssize_t bytes_written;
|
||||
if (ZEND_SIZE_T_UINT_OVFL(count)) {
|
||||
count = UINT_MAX;
|
||||
}
|
||||
bytes_written = _write(data->fd, buf, (unsigned int)count);
|
||||
ssize_t bytes_written = _write(data->fd, buf, (unsigned int)(count > INT_MAX ? INT_MAX : count));
|
||||
#else
|
||||
ssize_t bytes_written = write(data->fd, buf, count);
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue