- Fixed bug #33277 (private method accessed by child class). (Dmitry)
- Fixed bug #33268 (iconv_strlen() works only with a parameter of < 3 in
length). (Ilia)
+- Fixed bug #33263 (mysqli_real_escape doesn't work in __construct) (Georg)
- Fixed bug #33243 (ze1_compatibility_mode does not work as expected). (Dmitry)
- Fixed bug #33242 (Mangled error message when stream fails). (Derick)
- Fixed bug #33222 (segfault when CURL handle is closed in a callback). (Tony)
mysqli_resource = (MYSQLI_RESOURCE *)ecalloc (1, sizeof(MYSQLI_RESOURCE));
mysqli_resource->ptr = (void *)mysql;
- MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry);
+
+ if (!getThis()) {
+ MYSQLI_RETURN_RESOURCE(mysqli_resource, mysqli_link_class_entry);
+ } else {
+ ((mysqli_object *) zend_object_store_get_object(getThis() TSRMLS_CC))->ptr = mysqli_resource;
+ ((mysqli_object *) zend_object_store_get_object(getThis() TSRMLS_CC))->valid = 1;
+ }
}
/* }}} */
--- /dev/null
+--TEST--
+bug #33263 (mysqli_real_connect in __construct)
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+
+ include "connect.inc";
+
+ class test extends mysqli
+ {
+ public function __construct($host, $user, $passwd, $db) {
+ parent::init();
+ parent::real_connect($host, $user, $passwd, $db);
+ }
+ }
+
+ $mysql = new test($host, $user, $passwd, "test");
+
+ $stmt = $mysql->prepare("SELECT DATABASE()");
+ $stmt->execute();
+ $stmt->bind_result($db);
+ $stmt->fetch();
+ $stmt->close();
+
+ var_dump($db);
+
+ $mysql->close();
+?>
+--EXPECT--
+string(4) "test"