[php-src] PR #12915: Fix life time of FFI CData and FFI CType with FFI\CDef

From: Date: Sat, 09 Dec 2023 17:58:26 +0000
Subject: [php-src] PR #12915: Fix life time of FFI CData and FFI CType with FFI\CDef
Groups: php.git-pulls 
Request: Send a blank email to git-pulls+get-24474@lists.php.net to get a copy of this message
Pull Request: https://github.com/php/php-src/pull/12915 Author: nielsdos For GH-8556 the return type is stored in the CDef and doesn't outlive the CData. In that case it happened because temporaries were used, but it's also possible to get this with compiled variables when the variable holding the CDef leaves the scope. For GH-12910 the exception trace is built after the compiled variables are destroyed, so that means the FFI CDef instance got destroyed but the CData argument still remained. When the trace building code tries to get the class string for the exception, the CData instance tries to access the already-freed CDef. Fix all of this by storing a reference to the CDef object inside of CData and CType. Closes GH-8556. Closes GH-12910.

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