1--TEST-- 2Bug #29311 (Cannot override mysqli constructor) 3--SKIPIF-- 4<?php 5require_once('skipif.inc'); 6require_once('skipifconnectfailure.inc'); 7?> 8--FILE-- 9<?php 10 require_once("connect.inc"); 11 12 /* class 1 calls parent constructor */ 13 class mysql1 extends mysqli { 14 function __construct() { 15 global $host, $user, $passwd, $db, $port, $socket; 16 parent::__construct($host, $user, $passwd, $db, $port, $socket); 17 } 18 } 19 20 /* class 2 has an own constructor */ 21 class mysql2 extends mysqli { 22 23 function __construct() { 24 global $host, $user, $passwd, $db, $port, $socket; 25 $this->connect($host, $user, $passwd, $db, $port, $socket); 26 } 27 } 28 29 /* class 3 has no constructor */ 30 class mysql3 extends mysqli { 31 32 } 33 34 $foo[0] = new mysql1(); 35 $foo[1] = new mysql2(); 36 $foo[2] = new mysql3($host, $user, $passwd, $db, $port, $socket); 37 38 39 for ($i=0; $i < 3; $i++) { 40 if (($result = $foo[$i]->query("SELECT DATABASE()"))) { 41 $row = $result->fetch_row(); 42 if ($row[0] != $db) 43 printf("%d: %s\n", $i, $row[0]); 44 $result->close(); 45 } 46 $foo[$i]->close(); 47 } 48 print "done!"; 49?> 50--EXPECTF-- 51done! 52