-
Notifications
You must be signed in to change notification settings - Fork 208
PHPC-1716 Allow configuring server API version in manager #1204
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
Conversation
b241321
to
0248588
Compare
851de9e
to
bac6f18
Compare
@@ -7,7 +7,7 @@ DO NOT EDIT THIS FILE | |||
--FILE-- | |||
<?php | |||
|
|||
require_once __DIR__ . '/../utils/tools.php'; |
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.
Is this the result of using a wide net for search/replace? I would have assumed tests that manually include tools.php
could be left as-is, because they typically do not connect to a server.
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 replaced all instances of tools.php
to require the .inc
file for consistency. I can revert this change if you think that's unwise.
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.
It's not necessary but I can see how it'd make maintenance easier by not having to think about which file to include. No objections to leaving as-is.
.gitmodules
Outdated
@@ -1,6 +1,6 @@ | |||
[submodule "src/libmongoc"] | |||
path = src/libmongoc | |||
url = https://github.com/mongodb/mongo-c-driver.git | |||
url = https://github.com/alcaeus/mongo-c-driver.git |
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.
Is this still necessary given that CDRIVER-3821 is merged?
The only open PR I found on libmongoc is mongodb/mongo-c-driver#753, but that seems unrelated to PHP.
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 had not managed to create the PR before. mongodb/mongo-c-driver#765 contains the changes necessary, most notably fixing a wrong function name and adding a getter for the version
field in mongoc_server_api_t
.
|
||
if (*server_api) { | ||
mongoc_server_api_destroy(*server_api); | ||
} |
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.
Is this ever reached? If not, would it be better to throw an exception and return false
? AFAICT, this is only called from the constructor and php_phongo_serverapi_init_from_hash
, both of which should use freshly initialized objects.
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.
Replaced this with an exception instructing users to file a bug report as it shouldn't happen.
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.
Should we standardize on American English spelling ("initialized") here?
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 forgot we use American English as opposed to British English. I'll update it.
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.
Some questions on code formatting for macros, but LGTM otherwise.
Beyond that, take a look at the CI failures. AppVeyor reports a compilation failure in some macro.
The Evergreen failure appears to be related to what you fixed in #1206.
EH_THROW, \ | ||
phongo_exception_from_phongo_domain(PHONGO_ERROR_INVALID_ARGUMENT), \ | ||
&error_handling); \ | ||
ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_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.
Should this be indented consistently with the lines above since it falls within do {
?
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're right, totally missed that. Thanks!
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.
Ah...I was wondering about this: it seems like clang-format immediately wants to undo my changes and restore this broken formatting, so I'm afraid we're stuck with this for the time being :(
ZEND_PARSE_PARAMETERS_START(min_num_args, max_num_args) | ||
|
||
#define PHONGO_PARSE_PARAMETERS_END \ | ||
ZEND_PARSE_PARAMETERS_END_EX( \ |
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.
Same question about indentation here.
@@ -7,7 +7,7 @@ DO NOT EDIT THIS FILE | |||
--FILE-- | |||
<?php | |||
|
|||
require_once __DIR__ . '/../utils/tools.php'; |
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.
It's not necessary but I can see how it'd make maintenance easier by not having to think about which file to include. No objections to leaving as-is.
This was due to me using
Yes, those are fixed as well now. |
Note: holding off on merge until mongodb/mongo-c-driver#765 is merged. |
I'm familiar with that. I assume it's because Our previous issues with I don't think we need to stop using |
A centralised entry point is required to inject the API_VERSION env variable later.
This changed when migrating from our own scripts to drivers-evergreen-tools and was not updated properly, causing all tests to run with auth disabled.
This macro is missing on PHP < 7.3
This causes compile failures on PHP < 7.3 that I have yet to understand.
PHPC-1716
This PR is built on the current WIP state of versioned API support in the C driver to allow designing the PHP driver interface and verify that it passes all spec tests. Note that the changes to submodules (including the libmongoc version) will be re-done once versioned API support lands in the main libmongoc development branch.