1--TEST-- 2Bug #31177 (Memory leak) 3--FILE-- 4<?php 5class DbGow { 6 7 public function query() { 8 throw new Exception; 9 } 10 11 public function select() { 12 return new DbGowRecordSet($this->query()); 13 } 14 15 public function select2() { 16 new DbGowRecordSet($this->query()); 17 } 18 19} 20 21class DbGowRecordSet { 22 23 public function __construct($resource) { 24 } 25 26} 27 28$db = new DbGow; 29 30try { 31 $rs = $db->select(); 32} catch(Exception $e) { 33 echo "ok\n"; 34} 35 36try { 37 $db->select2(); 38} catch(Exception $e) { 39 echo "ok\n"; 40} 41?> 42--EXPECT-- 43ok 44ok 45