Problem/Motivation

When trying to install Drupal 7.85 on PHP 8.1 and PostgreSQL 11, this deprecated message appears:

Deprecated function: fwrite(): Passing null to parameter #2 ($data) of type string is deprecated in InsertQuery_pgsql->execute() (line 33 of xxx\includes\database\pgsql\query.inc).

It will appear after database credentials are entered and installation process is in the batch where all modules are being installed.

This message is not present while installing Drupal 7.85 on MySQL database.

Steps to reproduce

Issue can be reproduced on clean Drupal 7.85 install:

  1. Install Drupal 7.85 with standard profile
  2. Enter PostgreSQL database credentials and proceed to the next step
  3. The deprecated message will be shown while batch is installing modules

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Release notes snippet

Issue fork drupal-3259482

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

poker10 created an issue. See original summary.

liam morland’s picture

This bug prevents testing on Postgres; example.

liam morland’s picture

Status: Active » Needs review
liam morland’s picture

The Postgres test fails, but it gets further than it does without the patch. Now it is failing with a bunch of "Duplicate table" errors.

poker10’s picture

Well, it seems like that there was a new test (TEST_UPPERCASE) introduced by this issue: #2802159: [D7] SQL layer: $match_operator is vulnerable to injection attack and this commit https://git.drupalcode.org/project/drupal/-/commit/093e02fb731756bcc75b0c7af0228357034f2822 and this changes were not tested against PostgreSQL database.

The issue with TEST_UPPERCASE seems to be that in PostgreSQL all identifiers are alway folded to lowercase. See: https://www.postgresql.org/docs/14/sql-syntax-lexical.html

Quoting an identifier also makes it case-sensitive, whereas unquoted names are always folded to lower case. For example, the identifiers FOO, foo, and "foo" are considered the same by PostgreSQL, but "Foo" and "FOO" are different from these three and each other.

And we use it this way (without quotes):

$sql = "CREATE TABLE {" . $name . "} (\n\t";

So maybe it is time to create another issue with this regression.

liam morland’s picture

Yes, the present issue is only about fwrite(). This needs to be committed even if tests do not pass on Postgres. We need a new issue for this problem, probably a child of #710858: Meta issue: fix the remaining PostgreSQL bugs.

poker10’s picture

poker10’s picture

Some other exceptions in the PostgreSQL tests seems to be caused by this issue (still missing D7 backport) - #998898: Make sure that the identifiers are not more the 63 characters on PostgreSQL (PostgreSQL limit for indentifiers is 63 characters). Linking it here also.

  • mcdruid committed 32504a5 on 7.x
    Issue #3259482 by Liam Morland, poker10: [PHP 8.1] fwrite(): Passing...
mcdruid’s picture

Status: Needs review » Fixed

Thanks for this, and filing the other PostgreSQL issues.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.