1--TEST-- 2GH-11878 (SQLite3 callback functions cause a memory leak with a callable array) 3--EXTENSIONS-- 4sqlite3 5--FILE-- 6<?php 7class Foo { 8 public $sqlite; 9 public function __construct(bool $normalFunctions, bool $aggregates) { 10 $this->sqlite = new SQLite3(":memory:"); 11 if ($aggregates) { 12 $this->sqlite->createAggregate("indexes", array($this, "SQLiteIndex"), array($this, "SQLiteFinal"), 0); 13 $this->sqlite->createAggregate("indexes_closure", fn () => 0, fn () => 0, 0); 14 } 15 if ($normalFunctions) { 16 $this->sqlite->createFunction("func", array($this, "SQLiteIndex"), 0); 17 $this->sqlite->createFunction("func_closure", fn () => 0, 0); 18 $this->sqlite->createCollation("collation", array($this, "SQLiteIndex")); 19 $this->sqlite->createCollation("collation_closure", fn () => 0); 20 } 21 } 22 public function SQLiteIndex() {} 23 public function SQLiteFinal() {} 24} 25 26// Test different combinations to check for null pointer derefs 27$x = new Foo(true, true); 28$y = new Foo(false, true); 29$z = new Foo(true, false); 30$w = new Foo(false, false); 31?> 32Done 33--EXPECT-- 34Done 35