-
Notifications
You must be signed in to change notification settings - Fork 7.9k
ext/dba/inifile: Do some refactoring #15316
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
base: master
Are you sure you want to change the base?
Conversation
Failures are legit, looks like some warnings that got turned into errors. |
ext/dba/libinifile/inifile.c
Outdated
{ | ||
php_stream *fp; | ||
|
||
if (pos_start == pos_end) { | ||
*ini_copy = NULL; | ||
return SUCCESS; | ||
return 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.
return false; | |
return true; |
because it was SUCCESS; the fact this was not caught by tests is not good :-(
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'll try to see if I can come up with a test case
inifile *ini_tmp = NULL; | ||
php_stream *fp_tmp = NULL; | ||
int ret; | ||
int ret = FAILURE; |
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.
wait shouldn't this variable (and the function's return value) be zend_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.
Yes, it should, but I feel ideally this should just return bool
, but I would have needed to go and change stuff at the DBA driver level which I wanted to do in a follow-up.
Turns out, nothing works
This is an attempt to remove some PHPism/ZENDism from the library
@cmb69 do you have an idea how I can fix the permission issue I am hitting on Windows? |
@Girgias, just tried running the test locally with a x86 build and got:
Running the test without OPcache appears to hang. Running the test with an unpatched |
ext/dba/tests/dba_inifile_group_keys.phpt | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/ext/dba/tests/dba_inifile_group_keys.phpt b/ext/dba/tests/dba_inifile_group_keys.phpt
index eb30527574..b435c44f68 100644
--- a/ext/dba/tests/dba_inifile_group_keys.phpt
+++ b/ext/dba/tests/dba_inifile_group_keys.phpt
@@ -12,7 +12,7 @@
require_once __DIR__ . '/setup/setup_dba_tests.inc';
$name = __DIR__ . '/inifile_group_keys_tests.db';
-$db = dba_open($name, 'c', 'inifile');
+$db = dba_open($name, 'c-', 'inifile');
echo "Checks on an empty database:\n";
var_dump(dba_delete(['group', 'name'], $db)); makes the test pass; I wonder why there is a lock on Windows, but apparently not on other platforms? |
Thanks to @cmb69
Considering the state of this library, I don't know, might be something related to default OS behaviours? But thank you! |
D'oh! Windows always uses mandatory locking. :) I'm still somewhat concerned about the assertion failure on x86 builds. That may or may not be Windows specific, and 32bit builds are likely not that important anymore, but still this should be addressed. It's not related to this PR, though. |
Probably makes sense opening a new issue then to track this? |
So some code was not error-checked, and so you removed the error-returning code. However, why didn't you add error checks instead? |
I rebased and force-pushed so that the test is the first commit, which I used to check what the behaviour of the current implementation is. None of the other commits were amended. I'm not sure that I understand the part about the error checking that I removed? As far as I can see, I didn't do any of that? |
off topic replies
I'll have a look at this right away.
This might be because when |
Thanks for clarifying. The thing is that I can't see that easily when hitting the "compare" button, which is why I brought it up.
No, you didn't remove error checking. My point is this: |
This is an attempt to remove some PHPism/ZENDism from the library