-
Notifications
You must be signed in to change notification settings - Fork 8k
Fix GH-17900 and GH-8084 #17908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix GH-17900 and GH-8084 #17908
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -72,7 +72,12 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, b | |
| } | ||
| #endif | ||
|
|
||
| if (getThis() && !ZEND_NUM_ARGS() && in_ctor) { | ||
| if (UNEXPECTED(in_ctor && (Z_MYSQLI_P(object))->ptr)) { | ||
| zend_throw_error(NULL, "Cannot call constructor twice"); | ||
| return; | ||
| } | ||
|
|
||
| if (in_ctor && !ZEND_NUM_ARGS()) { | ||
| php_mysqli_init(INTERNAL_FUNCTION_PARAM_PASSTHRU, in_ctor); | ||
| return; | ||
| } | ||
|
|
@@ -85,7 +90,9 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, bool is_real_connect, b | |
| } | ||
|
|
||
| if (object) { | ||
| #if ZEND_DEBUG | ||
|
||
| ZEND_ASSERT(instanceof_function(Z_OBJCE_P(object), mysqli_link_class_entry)); | ||
| #endif | ||
| mysqli_resource = (Z_MYSQLI_P(object))->ptr; | ||
| if (mysqli_resource && mysqli_resource->ptr) { | ||
| mysql = (MY_MYSQL*) mysqli_resource->ptr; | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| --TEST-- | ||
| GH-17900 (Assertion failure ext/mysqli/mysqli_prop.c) | ||
| --EXTENSIONS-- | ||
| mysqli | ||
| --FILE-- | ||
| <?php | ||
| mysqli_report(MYSQLI_REPORT_OFF); | ||
| $mysqli = new mysqli(); | ||
| try { | ||
| $mysqli->__construct('doesnotexist'); | ||
| } catch (Error $e) { | ||
| echo $e->getMessage(), "\n"; | ||
| } | ||
| ?> | ||
| --EXPECT-- | ||
| Cannot call constructor twice |
Uh oh!
There was an error while loading. Please reload this page.