Skip to content

odbc back-end resource handling broken on PHP 8.4 #45

@MarkMaldaba

Description

@MarkMaldaba

Note: This task is similar to #37 which raised similar issues with the pgsql back-end, on PHP 8.1

Since PHP 8.4, various odbc methods now return a PHP object rather than a resource.

From https://www.php.net/manual/en/migration84.incompatible.php#migration84.incompatible.resource2object.odbc:

Several resources have been migrated to objects. Return value checks using is_resource() should be replaced with checks for false, unless specified otherwise.

  • The ODBC functions now accept and return Odbc\Result objects instead of odbc_result resources.
  • The ODBC functions now accept and return Odbc\Connection objects instead of odbc_connection resources.

In PEAR::DB, the DB_pdbc class is implemented on the assumption that the returned result is a PHP resource reference. In particular, there are various is_resource() checks that will no longer work as expected as this function only returns true for the resource implementation.

The class needs to be updated to handle both implementations, in order to support older PHP versions as well as continuing to run on PHP >= 8.4.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions