-
Notifications
You must be signed in to change notification settings - Fork 7.8k
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
ext/pdo: Refactor PDO::FETCH_CLASS to not rely on a FCI and use a HashTable for ctor_arg #17427
base: master
Are you sure you want to change the base?
Conversation
702f741
to
2bad75c
Compare
2bad75c
to
81490b2
Compare
81490b2
to
5711354
Compare
5711354
to
808b10e
Compare
808b10e
to
4791772
Compare
stmt->fetch.cls.ce = cep; | ||
zval ce_name_from_column; | ||
fetch_value(stmt, &ce_name_from_column, column_index_to_fetch++, NULL); | ||
if (Z_TYPE(ce_name_from_column) == IS_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.
If the type is not string, then we silently ignore it? That seems not nice... should warn or throw or something
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.
Annoyingly, due to the previous usage of try_convert_to_string()
it would accept integers/null/floats convert them to string, and because no class could possibly exist set the CE to stdClass.
fci->param_count = 0; | ||
fci->params = NULL; | ||
|
||
zend_fcall_info_args_ex(fci, ce->constructor, &stmt->fetch.cls.ctor_args); |
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.
Can you document the new behaviour wrt references in UPGRADING please?
zval_ptr_dtor(return_value); | ||
RETVAL_FALSE; |
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.
Okay let's just make it consistently not use it then as it's a big refactor anyway it seems like a good opportunity to do so.
zend_argument_value_error(3, "must be empty when class provided in argument #2 ($class) does not have a constructor"); | ||
return false; | ||
} | ||
GC_TRY_ADDREF(Z_ARRVAL(args[1])); |
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.
Okay without looking too deep again: check why you refcount
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.
The HashTable comes from userland via the call to POD::setFetchMode()
4791772
to
83b8a92
Compare
Commits should be reviewed in order.
This removes the last usage of
zend_fcall_info_args_ex()
and basically supersedes #9725, which would allow merging #9723.This also aligns the behaviour of the
ctor_arguments
to be have like CUFA.Some follow-up ideas: