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 } 14 if ($normalFunctions) { 15 $this->sqlite->createFunction("func", array($this, "SQLiteIndex"), 0); 16 $this->sqlite->createCollation("collation", array($this, "SQLiteIndex")); 17 } 18 } 19 public function SQLiteIndex() {} 20 public function SQLiteFinal() {} 21} 22 23// Test different combinations to check for null pointer derefs 24$x = new Foo(true, true); 25$y = new Foo(false, true); 26$z = new Foo(true, false); 27$w = new Foo(false, false); 28?> 29Done 30--EXPECT-- 31Done 32