[php-src] PR #22454: Fix GH-16217: guard uninitialized SplFileObject in fputcsv() and next()
| From: | iliaal | Date: | Thu, 25 Jun 2026 18:28:32 +0000 |
| Subject: | [php-src] PR #22454: Fix GH-16217: guard uninitialized SplFileObject in fputcsv() and next() | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-36642@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/22454
Author: iliaal
SplFileObject::fputcsv() and ::next() were the only two SplFileObject methods reaching the file
stream without the CHECK_SPL_FILE_OBJECT_IS_INITIALIZED backstop the others carry. On an object
built via newInstanceWithoutConstructor() the constructor never runs and the stream stays NULL;
calling either through reflection (which bypasses the get_method init check) segfaults. next() only
reaches the stream when READ_AHEAD is set, itself reachable via the unguarded setFlags(). Both now
throw Error: "Object not initialized".
Fixes #16217