-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Convert resources to objects in ext/pgsql #6791
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
777ebcf
to
1c1b974
Compare
ext/pgsql/pgsql.c
Outdated
|
||
/* Compatibility definitions */ | ||
|
||
#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT | ||
#define pg_encoding_to_char(x) "SQL_ASCII" | ||
#endif | ||
|
||
/* {{{ _php_pgsql_trim_message */ |
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 removed some of these unnecessary comments because they annoyed me at some point
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.
This does make a lot of noise in the PR sadly :-/
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 agree that it was not a good idea to do this here. I can get rid of these changes If they make code review difficult
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.
Feel free to simply separately land a removal of all folder marks in pgsql (though I don't mind it being part of this change).
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 do it separately!
1c1b974
to
5b34373
Compare
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.
Looks OK from a quick glance if persistent connections still work (as currently there is no plan nor deprecation getting rid of those)
|
9c9bb86
to
45f55f7
Compare
Now only ~12 tests fail and I also tried to implement the suggestionss in in c7a86a3 (notices doesn't yet work perfectly). |
45f55f7
to
6a929c9
Compare
My latest commit (6931655) fixes all tests, finally! |
6931655
to
eb22b17
Compare
dbf23ba
to
98c2c0d
Compare
ext/pgsql/pgsql.c
Outdated
|
||
/* Compatibility definitions */ | ||
|
||
#ifndef HAVE_PGSQL_WITH_MULTIBYTE_SUPPORT | ||
#define pg_encoding_to_char(x) "SQL_ASCII" | ||
#endif | ||
|
||
/* {{{ _php_pgsql_trim_message */ |
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.
Feel free to simply separately land a removal of all folder marks in pgsql (though I don't mind it being part of this change).
98c2c0d
to
c05c20b
Compare
I addressed most of the review comments, however, currently many tests end up with a memory leak. The issue is with the default connection handling, so I'll continue chasing this problem. |
I pushed a few changes that should fix the leaks. |
Windows build failed with:
Not really obvious to me why ... |
} | ||
|
||
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) { | ||
zend_argument_type_error(1, "must be of type PgSql when the connection is provided"); |
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_argument_type_error(1, "must be of type PgSql when the connection is provided"); | |
zend_argument_type_error(1, "must be of type PgSql\\Connection when the connection is provided"); |
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.
This one isn't resolved yet.
The idea came up in php@c7a86a3
The idea came up in php@c7a86a3
4acde1a
to
d735e83
Compare
I had to force push because of a conflict in the readme, but only the last commit is new. |
} | ||
|
||
if ((pgsql = (PGconn *)zend_fetch_resource2(link, "PostgreSQL link", le_link, le_plink)) == NULL) { | ||
zend_argument_type_error(1, "must be of type PgSql when the connection is provided"); |
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.
This one isn't resolved yet.
Did it when applying the commit! |
Per: - php/php-src#6791 - https://github.com/php/php-src/blob/a846547ed4bb67f00dc12bbfc529e9c992cbfd07/UPGRADING The pgsql functions now accept and return **resource objects** and not **resources**. As such, the return value of `get_resource_type()` varies, and technically, in PHP 8.1, we should not use `is_resource()`, but a typecheck instead. However, we still need to support pre-8.1 code as well. Signed-off-by: Matthew Weier O'Phinney <[email protected]>
No description provided.