Ticket #32 (assigned defect)

Opened 1 year ago

Last modified 1 year ago

Fix handling of $DB / $__Auth_OpenID_PEAR_AVAILABLE

Reported by: http://daniel.hahler.de/ Assigned to: http://cygnus.myopenid.com/ (accepted)
Priority: major Milestone:
Keywords: Cc:
Project: php-openid OpenID Protocol:
Series: 2.x.x Web Browser:

Description (Last modified by http://keturn.myopenid.com/)

The current code tries to include_once "DB.php" and decides upon the result, if PEAR is available ($__Auth_OpenID_PEAR_AVAILABLE). Because it's using "@include_once" this can create a fatal error, which is hard to spot, because there's no error logged/displayed anywhere. E.g., in b2evolution there's already a class DB and therefor you'll get "cannot redeclare class", if PEAR DB is available and gets sources here.

I've created a patch to remove the $__Auth_OpenID_PEAR_AVAILABLE global altogether and use another check ("method_exists") where setFetchMode is supposed to get called for PEAR DB instances. Another solution might be to check for (is_subclass_of($this->connection, 'db_common')).

Attachments

php-openid-remove-__Auth_OpenID_PEAR_AVAILABLE.patch (1.4 kB) - added by http://daniel.hahler.de/ on 09/18/07 14:27:52.

Change History

09/17/07 13:42:49 changed by http://keturn.myopenid.com/

  • description changed.

09/18/07 14:27:52 changed by http://daniel.hahler.de/

  • attachment php-openid-remove-__Auth_OpenID_PEAR_AVAILABLE.patch added.

09/19/07 13:24:30 changed by http://cygnus.myopenid.com/

  • owner set to http://cygnus.myopenid.com/.
  • status changed from new to assigned.

We can remove the include check and variable, but there's a possibility that DB_FETCHMODE_ASSOC won't be defined unless the user has already included the PEAR database code in the calling application.