[php-src] PR #25875: Zend: Map the scanner position through both filters on encoding switch

From: Date: Sat, 28 Nov 2026 15:26:23 +0000
Subject: [php-src] PR #25875: Zend: Map the scanner position through both filters on encoding switch
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-41160@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/25875 Author: iliaal With zend.multibyte on, declare(encoding=...) re-converts the script with the new encoding but keeps the scanner cursor at its byte offset in the old converted buffer. When the code before the declare converts to a different length, scanning resumes at the wrong place, so valid scripts fail to parse or skip code, and a shorter conversion such as UTF-32 leaves the cursor past the end of the buffer. Map the cursor back to a source offset through the old filter and forward through the new one. The backward search shared with zend_get_scanned_file_offset() becomes a bisection, so it stops on a character boundary even when a truncated unit converts to a substitute.

« previous php.git-pulls (#41160) next »