Repository navigation
Conversation
Conditionally set standard_conforming_strings based on PostgreSQL version.
|
Thanks for picking this up. I tested this approach on PostgreSQL 19.0 with a copy of a Joomla 6.2.0 site, and found a problem with it. Skipping $text = str_replace("'", "''", (string) $text);
return addcslashes($text, "\000\n\r\\\032");With -- what escape() produces for "line1<LF>line2 dir\sub":
SELECT '[' || 'line1\nline2 dir\\sub' || ']';
-- PostgreSQL 18, standard_conforming_strings = off (current behaviour):
[line1
line2 dir\sub]
-- PostgreSQL 19 (always on), with this PR:
[line1\nline2 dir\\sub]So the page renders, but data written through I think the escaping has to change together with the
Since PostgreSQL has defaulted to Tested with Joomla 6.2.0, joomla/database 4.0.0, PHP 8.5.12, PostgreSQL 19.0 (PGDG packages, Debian 12 arm64). |
|
thanks for the feedback |
|
@alikon PHPstan is not happy with is_int and is_float, see the PHPstan errors shown here: https://github.com/joomla-framework/database/pull/419/changes . I think he/she/it is right, these methods check for the data type, not if a string is numeric or not. Maybe you can use |
|
@richard67 let me 1st make happy the Unit tests, after i'll look at PHPstan |
Added messages for impossible type checks in PgsqlDriver.php
|
@alikon To add it to the baseline file is not right. Please check the PHP documentation, e.g. for ìs_int`: https://www.php.net/manual/en/function.is-int.php
Example #1 is_int() example The above example will output: |
|
@richard67 there are already there for PDOdriver database/phpstan-baseline.neon Lines 298 to 307 in df80c29 the goal of this pr is to make joomla run with postgresql 19.0 room for another pr imho |
|
Hmm, not nice, but ok, old issue, has to be fixed separately. |
|
@alikon PHPstan fails: Have you updated that file manually? On a development environment with composer, you can use |
|
Thanks, this is worth testing after Joomla 6.2.1 release! |
|
I have tested this PR on a Joomla 6.2.1 site running on PostgreSQL 19, and everything works as expected. Test Results
Environment
Thanks for the fix! PS |
Pull Request for Issue #418
Summary of Changes
Conditionally set standard_conforming_strings based on PostgreSQL version.
Testing Instructions
Use joomla with PostgreSQL 19.0
Documentation Changes Required