[php-src] PR #21657: Fix GH-18105: Wrong file & line on exception trace with trait default parameter

From: Date: Mon, 06 Apr 2026 22:43:26 +0000
Subject: [php-src] PR #21657: Fix GH-18105: Wrong file & line on exception trace with trait default parameter
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-35595@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/21657 Author: iliaal When a trait method has a default parameter using new (e.g., new ThrowableParam) and the constructor throws, the exception reports the file of the class using the trait, not the file where the throw occurs. zend_ast_evaluate_ex sets EG(filename_override) to the scope's filename during constant expression evaluation. For trait clones, the scope points to the using class's file. When ZEND_AST_NEW calls the constructor and it throws, zend_default_exception_new picks up this stale override. Save and clear EG(filename_override) before constructor calls in zend_ast_evaluate_inner's ZEND_AST_NEW handler, restore after. The VM's normal stack frame resolution then applies during constructor execution. Fixes #18105

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