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
Mysqli warning promotion #5803
Mysqli warning promotion #5803
Conversation
d1d1ac2
to
6131745
Compare
f5e67f1
to
777f11c
Compare
777f11c
to
99ac5b7
Compare
d86e165
to
67e6b6a
Compare
4d53fdc
to
1e66beb
Compare
26cdc04
to
15f2f4b
Compare
ext/mysqli/mysqli_api.c
Outdated
} | ||
|
||
if (types_len != (size_t) argc) { | ||
/* number of bind variables doesn't match number of elements in type definition string */ | ||
php_error_docref(NULL, E_WARNING, "Number of elements in type definition string doesn't match number of bind variables"); | ||
RETURN_FALSE; | ||
zend_argument_count_error("Number of elements in type definition string doesn't match number of bind variables"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think a few the
is missing from this message. :) I would say The number of elements in the type definition string doesn't match the number of bind variables
, but maybe it's too much now (?). Otherwise, you could say argument #2 (...)
instead of type definition string
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides, you could use the ... must match the number of bind variables
format, which is the most common wording we use (rather than ... doesn't match ...
).
ext/mysqli/mysqli_api.c
Outdated
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); | ||
|
||
if (mysqli_result_is_unbuffered(result)) { | ||
// TODO Promoto to Exception? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I do think it makes sense to forbid this case. The other PR handles this though.
4b52075
to
717d1fd
Compare
c9b011c
to
0c4501d
Compare
ext/mysqli/mysqli_api.c
Outdated
MYSQLI_FETCH_RESOURCE(result, MYSQL_RES *, mysql_result, "mysqli_result", MYSQLI_STATUS_VALID); | ||
|
||
if (mysqli_result_is_unbuffered(result)) { | ||
php_error_docref(NULL, E_WARNING, "Function cannot be used with MYSQL_USE_RESULT"); | ||
RETURN_FALSE; | ||
zend_throw_error(NULL, "Function cannot be used with MYSQL_USE_RESULT"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
zend_throw_error(NULL, "Function cannot be used with MYSQL_USE_RESULT"); | |
zend_throw_error(NULL, "mysqli_data_seek() cannot be used with MYSQL_USE_RESULT"); |
etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have suggested a PR for this error. I believe the constant should be MYSQLI_USE_RESULT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, this should be MYSQLI_USE_RESULT.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think the message I suggested is better "cannot be used in MYSQLI_USE_RESULT mode". The constant describes result mode. You don't use the function with this constant but rather your result is in one or the other mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can address this in your PR, I just want to get done with this one at this point ^^"
0c4501d
to
e096674
Compare
ext/opcache/tests/func_info.phpt is failing due to outdated zend_func_info.c. |
e096674
to
8a81c50
Compare
@@ -488,7 +488,7 @@ static const func_info_t func_infos[] = { | |||
F1("mysqli_prepare", MAY_BE_FALSE | MAY_BE_OBJECT), | |||
F1("mysqli_real_escape_string", MAY_BE_STRING), | |||
F1("mysqli_stmt_affected_rows", MAY_BE_LONG | MAY_BE_STRING), | |||
F0("mysqli_stmt_data_seek", MAY_BE_NULL | MAY_BE_FALSE), | |||
F0("mysqli_stmt_data_seek", MAY_BE_NULL), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just drop the line completely now.
I will split this extension into multiple PRs as it's already starting to become rather large.