xref: /php-src/ext/mysqli/tests/bug28817.phpt (revision a21edc52)
1--TEST--
2Bug #28817 (problems with properties declared in the class extending MySQLi)
3--EXTENSIONS--
4mysqli
5--SKIPIF--
6<?php
7require_once 'skipifconnectfailure.inc';
8?>
9--FILE--
10<?php
11    require_once 'connect.inc';
12
13    class my_mysql extends mysqli {
14        public $p_test;
15
16        function __construct() {
17            $this->p_test[] = "foo";
18            $this->p_test[] = "bar";
19        }
20    }
21
22
23    $mysql = new my_mysql();
24
25    var_dump($mysql->p_test);
26    try {
27        $mysql->errno;
28    } catch (Error $exception) {
29        echo $exception->getMessage() . "\n";
30    }
31
32    $mysql->connect($host, $user, $passwd, $db, $port, $socket);
33    $mysql->select_db("nonexistingdb");
34
35    var_dump($mysql->errno > 0);
36
37    $mysql->close();
38?>
39--EXPECTF--
40array(2) {
41  [0]=>
42  %s(3) "foo"
43  [1]=>
44  %s(3) "bar"
45}
46my_mysql object is already closed
47bool(true)
48