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