FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

pg_fetch_object() with abstract classes by Girgias · Pull Request #20180 · php/php-src · GitHub

/ php-src Public

pg_fetch_object() with abstract classes - #20180

Merged
Girgias merged 10 commits into
php:PHP-8.3from
Girgias:pgsql-abstract-class
Nov 4, 2025
Merged

pg_fetch_object() with abstract classes#20180
Girgias merged 10 commits into
php:PHP-8.3from
Girgias:pgsql-abstract-class

Conversation

Girgias commented Oct 15, 2025

Copy link
Copy Markdown
Member

No description provided.

Girgias force-pushed the pgsql-abstract-class branch 3 times, most recently from 4db2580 to dc642e8 Compare October 15, 2025 14:25
Girgias marked this pull request as ready for review October 15, 2025 14:25
Girgias requested a review from devnexen as a code owner October 15, 2025 14:25

Girgias commented Oct 15, 2025

Copy link
Copy Markdown
Member Author

@devnexen do you know why Windows fails, it says there is an issue with the CLEAN section of the test

Copy link
Copy Markdown
Member

I have no real idea honestly.

} catch(Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

nit: would it be possible to add the closing tag ?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Might also be the reason windows is confused

$result = pg_query($db, $sql);
var_dump(pg_fetch_object($result, NULL, 'E'));
} catch(Throwable $e) {
echo $e::class, ': ', $e->getMessage(), PHP_EOL;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Maybe try without this last PHP_EOL wdyt ?

Comment thread ext/pgsql/pgsql.c Outdated
Comment thread ext/pgsql/pgsql.c Outdated
Girgias force-pushed the pgsql-abstract-class branch from dc642e8 to c48266c Compare October 21, 2025 20:03
Girgias requested a review from ndossche October 21, 2025 20:10

ndossche left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I did not test this myself, but the code changes look good.
I don't think you need all those CE variants (i.e. interface, enum, ...) for the test, but it doesn't hurt.

Girgias commented Oct 21, 2025

Copy link
Copy Markdown
Member Author

I don't think you need all those CE variants (i.e. interface, enum, ...) for the test, but it doesn't hurt.

I mainly wanted them to check the error messages, but they indeed can't hurt (especially considering how poorly tested ext/pgsql is)

This shouldn't really be happening in the first place
include('config.inc');
$db = pg_connect($conn_str);
pg_query($db, "DROP TABLE IF EXISTS pg_fetch_object_abstract_class cascade");
$db = @pg_connect($conn_str);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

This issue really weirds me out. would it be possible to do the cleaning somewhere in the file section instead just for testing once at least ?

ndossche requested a review from TimWolla as a code owner October 22, 2025 21:48

Copy link
Copy Markdown
Member

So it fails because the CLEAN section somehow outputs " \r\n" and that's not equal to the empty string so it borks. I don't know what produces these whitespace characters. Pushing some more debugging code...

Copy link
Copy Markdown
Member

Will continue debugging this later ig. The simple fix is just get rid of the clean section and do the table deletion in the FILE section, that's how the other tests do it.
I don't know what causes the extra whitespace output.

TimWolla removed their request for review October 24, 2025 11:05

Copy link
Copy Markdown
Member

I was completely confused by the random syntax error that appears when I remove the php end tags. Especially since it doesn't even reproduce in my Windows VM.
Turns out CI is completely fucking stupid and we have this piece of shit in the CI batch file:

echo ^<?php $conn_str = "host=127.0.0.1 dbname=test port=5432 user=%PGUSER% password=%PGPASSWORD%"; ?^> >> "./ext/pgsql/tests/config.inc"

That should be illegal. That is the thing that adds whitespace characters to the config script which then gets into the output.

ndossche force-pushed the pgsql-abstract-class branch from 2bc7aae to 9a149a7 Compare October 26, 2025 22:26

ndossche commented Oct 26, 2025
edited
Loading

Copy link
Copy Markdown
Member

It's green finally. And the code is adjusted such that we will never run into this again in the future. I'll leave the cleanup to you (i.e. squashing + reverting my CI workflow adaptations that disable other jobs and only run the pgsql tests)

Girgias merged commit 94dc6ae into php:PHP-8.3 Nov 4, 2025
9 checks passed
Girgias deleted the pgsql-abstract-class branch November 4, 2025 00:04
Girgias added a commit that referenced this pull request Nov 4, 2025
* PHP-8.3:
  Update NEWS for recent pgsql bugfix
  ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
Girgias added a commit that referenced this pull request Nov 4, 2025
* PHP-8.4:
  Update NEWS for recent pgsql bugfix
  ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
Girgias added a commit that referenced this pull request Nov 4, 2025
* PHP-8.5:
  Update NEWS for recent pgsql bugfix
  ext/pgsql: Fix segfaults when attempting to fetch row into a non-instantiable class name (#20180)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants


Back | FazBrowse Home | New Git URL