summaryrefslogtreecommitdiff
path: root/main/streams
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Fix expression warnings and break warningstwosee2020-06-075-10/+10
| | | | | | | | | | | | Close GH-5675.
* | | Fix [-Wundef] warning in streams implementationGeorge Peter Banyard2020-05-122-11/+11
| | |
* | | Fix #79467: data:// wrappers are writableChristoph M. Becker2020-05-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Despite the docs claiming that data: wrappers would not be writable[1], they are implemented as writing to a memory stream. That does not seem to be particularly sensible, so we disallow writing altogether. [1] <https://www.php.net/manual/en/wrappers.data.php#refsect1-wrappers.data-options>
* | | Merge branch 'PHP-7.4'Nikita Popov2020-04-141-0/+6
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fixed bug #79468
| * | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-04-141-0/+6
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fixed bug #79468
| | * Fixed bug #79468dinosaur2020-04-141-0/+6
| | | | | | | | | | | | Close the stream filter resources when removing them from the stream.
* | | Merge branch 'PHP-7.4'Christoph M. Becker2020-03-111-0/+6
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #78210: Invalid pointer address
| * | Merge branch 'PHP-7.3' into PHP-7.4Christoph M. Becker2020-03-111-0/+6
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fix #78210: Invalid pointer address
| | * Fix #78210: Invalid pointer addressChristoph M. Becker2020-03-111-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is actually about three distinct issues: * If an empty string is passed as $address to `stream_socket_sendto()`, the `sa` is not initialized, so we must not pass it as `addr` to `php_stream_xport_sendto()`. * On POSIX, `recvfrom()` truncates messages which are too long to fit into the specified buffer (unless `MSG_PEEK` is given), discards the excessive bytes, and returns the buffer length. On Windows, the same happens, but `recvfrom()` returns `SOCKET_ERROR` with the error code `WSAEMSGSIZE`. We have to catch this for best POSIX compatibility. * In `php_network_parse_network_address_with_port()`, we have to zero `in6` (not only its alias `sa`) to properly support IPv6. Co-Authored-By: Nikita Popov <nikita.ppv@googlemail.com>
* | | Remove unnecessary uses of CHECK_SILENTNikita Popov2020-03-061-1/+1
| | | | | | | | | | | | If no error is passed, it is always silent.
* | | Promote invalid mode/unknow option from Warning to ValueError for plain streams.George Peter Banyard2020-02-041-2/+2
| | | | | | | | | | | | Closes GH-5076
* | | Merge branch 'PHP-7.4'Nikita Popov2020-01-231-2/+9
|\ \ \ | |/ / | | | | | | | | | | | | * PHP-7.4: Fixed bug #78902 Add unit test for bug #78902
| * | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2020-01-231-2/+9
| |\ \ | | |/ | | | | | | | | | | | | * PHP-7.3: Fixed bug #78902 Add unit test for bug #78902
| | * Fixed bug #78902liudaixiao2020-01-231-2/+9
| | |
* | | Make error messages more consistent by fixing capitalizationMáté Kocsis2020-01-177-18/+18
| | | | | | | | | | | | Closes GH-5066 As a first step, let's capitalize their initial letter when it is applicable.
* | | Fix #78880: Another bunch of spelling errorsMáté Kocsis2020-01-161-1/+1
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-301-0/+3
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Properly propagate url_stat exceptions during include
| * | Properly propagate url_stat exceptions during includeNikita Popov2019-12-301-0/+3
| | | | | | | | | | | | | | | Make sure we abort operations early, and that we don't emit additional warnings or errors if an exception has been thrown.
* | | Use RETURN_THROWS() during ZPP in main, sapi, win32, and ZendMáté Kocsis2019-12-301-3/+3
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2019-12-201-17/+23
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fixed bug #79000
| * | Fixed bug #79000Nikita Popov2019-12-201-17/+23
| | | | | | | | | | | | | | | | | | | | | | | | Don't report EAGAIN/EWOULDBLOCK as errors for fwrite on non-blocking socket streams. This matches behavior for fread, as well as behavior for plain file streams. Closes GH-5026.
* | | Merge branch 'PHP-7.4'Christoph M. Becker2019-12-021-14/+20
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #78883: fgets(STDIN) fails on Windows
| * | Fix #78883: fgets(STDIN) fails on WindowsChristoph M. Becker2019-12-021-14/+20
| | | | | | | | | | | | | | | | | | | | | | | | We add the `is_seekable` member to `php_stdio_stream_data`, and prefer that over `is_pipe`, since the latter is simply a misnomer. We keep `is_pipe` for now for Windows only, though, because we need special support for pipes there. We also fix the misaligned bitfield which formerly took 33 bit.
* | | Merge branch 'PHP-7.4'Nikita Popov2019-10-311-6/+0
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix bug #77930: Remove mmap limit
| * | Fix bug #77930: Remove mmap limitNikita Popov2019-10-311-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | First, the limitation already doesn't trigger if you copy the whole file (i.e. use copy() or stream_copy_to_stream() and don't specify a length). This happens because length will be 0 at the time of the check and only later calculated based on the file size. This means that we're already completely blowing the length limit for what is likely the most common case, and it doesn't seem like anyone complained about that. Second, the premise of the code comment ("to avoid runaway swapping") seems incorrect to me. Because this performs a file-backed non-private mmap, no swap backing is needed for the mapping. Concerns over "memory usage" are also misplaced, as this is a virtual mapping.
* | | Don't use chunking for stream writesNikita Popov2019-10-301-7/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We're currently splitting up large writes into 8K size chunks, which adversely affects I/O performance in some cases. Splitting up writes doesn't make a lot of sense, as we already must have a backing buffer, so there is no memory/performance tradeoff to be made here. This change disables the write chunking at the stream layer, but retains the current retry loop for partial writes. In particular network writes will typically only write part of the data for large writes, so we need to keep the retry loop to preserve backwards compatibility. If issues due to this change turn up, chunking should be reintroduced at lower levels where it is needed to avoid issues for specific streams, rather than unnecessarily enforcing it for all streams.
* | | Merge branch 'PHP-7.4'Remi Collet2019-10-111-7/+8
|\ \ \ | |/ / | | | | | | | | | | | | * PHP-7.4: NEWS Fix #78662: stream_write bad error detection
| * | Fix #78662: stream_write bad error detectionRemi Collet2019-10-111-7/+8
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2019-10-101-2/+6
|\ \ \ | |/ /
| * | Also check for exception after stream_eofNikita Popov2019-10-101-2/+6
| | |
* | | Merge branch 'PHP-7.4'Nikita Popov2019-10-101-18/+19
|\ \ \ | |/ /
| * | Report error if stream_read is not implementedNikita Popov2019-10-101-18/+19
| | | | | | | | | | | | | | | We need to return -1 in this case. Slightly restructure the code to avoid unnecessary conditions.
* | | Merge branch 'PHP-7.4'Nikita Popov2019-10-081-1/+7
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-10-081-1/+7
| |\ \ | | |/
| | * Check for exception after applying stream filtersNikita Popov2019-10-081-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | This makes the stream opening actually fail, and avoids assertion failures when we tokenize with EG(exception) set. Also avoid throwing an additional warning after an exception has already been thrown.
* | | Merge branch 'PHP-7.4'Joe Watkins2019-10-032-6/+0
|\ \ \ | |/ / | | | | | | | | | * PHP-7.4: Fix #76859 stream_get_line skips data if used with data-generating filter
| * | Merge branch 'PHP-7.3' into PHP-7.4Joe Watkins2019-10-032-6/+0
| |\ \ | | |/ | | | | | | | | | * PHP-7.3: Fix #76859 stream_get_line skips data if used with data-generating filter
| | * Merge branch 'PHP-7.2' into PHP-7.3Joe Watkins2019-10-032-6/+0
| | |\ | | | | | | | | | | | | | | | | * PHP-7.2: Fix #76859 stream_get_line skips data if used with data-generating filter
| | | * Fix #76859 stream_get_line skips data if used with data-generating filterKonstantin Kopachev2019-10-032-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | stream_get-line repeatedly calls php_stream_fill_read_buffer until enough data is accumulated in buffer. However, when stream contains filters attached to it, then each call to fill buffer essentially resets buffer read/write pointers and new data is written over old. This causes stream_get_line to skip parts of data from stream This patch fixes such behavior, so fill buffer call will append.
* | | | Remove unused mmap_file + mmap_len from basic_globalsNikita Popov2019-09-271-1/+1
| | | |
* | | | Remove mention of PHP major version in Copyright headersGabriel Caruso2019-09-2518-36/+0
|/ / / | | | | | | | | | Closes GH-4732.
* | | Fixed bug #78506Nikita Popov2019-09-111-18/+16
| | |
* | | Fix pipe detection and stream position handlingNikita Popov2019-09-051-31/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two related changes here: 1. Also check for S_ISCHR/FILE_TYPE_CHAR when checking for pipes, so that we detect ttys as well, which are also not seekable. 2. Always set position=-1 (i.e. ftell will return false) when a pipe is detected. Previously position=0 was sometimes used, depending on whether we're on Windows/Linux and whether the FD or FILE codepath was used.
* | | Replace strncat in filter implementationNikita Popov2019-08-231-2/+3
| | | | | | | | | | | | | | | In this case we already know exactly where we need to write, no need to use strncat at all.
* | | Fixed bug #78396Nikita Popov2019-08-121-1/+1
| | |
* | | Merge branch 'PHP-7.3' into PHP-7.4Nikita Popov2019-07-291-1/+6
|\ \ \ | |/ /
| * | Merge branch 'PHP-7.2' into PHP-7.3Nikita Popov2019-07-291-1/+6
| |\ \ | | |/
| | * Fix bug #78326Albert Casademont2019-07-291-1/+6
| | | | | | | | | | | | | | | Similar to what fread() does, truncate the stream_get_contents() result if the original buffer was way too large.
* | | Throw notice for plain wrapper fread/fwrite errorsNikita Popov2019-07-252-5/+20
| | | | | | | | | | | | Similar to what is done for socket read/write errors.
* | | Report errors from stream read and write operationsNikita Popov2019-07-226-108/+176
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The php_stream_read() and php_stream_write() functions now return an ssize_t value, with negative results indicating failure. Functions like fread() and fwrite() will return false in that case. As a special case, EWOULDBLOCK and EAGAIN on non-blocking streams should not be regarded as error conditions, and be reported as successful zero-length reads/writes instead. The handling of EINTR remains unclear and is internally inconsistent (e.g. some code-paths will automatically retry on EINTR, while some won't). I'm landing this now to make sure the stream wrapper ops API changes make it into 7.4 -- however, if the user-facing changes turn out to be problematic we have the option of clamping negative returns to zero in php_stream_read() and php_stream_write() to restore the old behavior in a relatively non-intrusive manner.