Need to implement hook_requirements to check that PDO is installed, otherwise, bail and disable the module or functions somehow?

Comments

mikey_p’s picture

Status: Active » Closed (won't fix)

This is probably not worth it since most PHP version of 5.2 or greater come with PDO.

sdrycroft’s picture

Status: Closed (won't fix) » Active

Probably not a bad idea to add this in, and prevent users like myself experiencing PHP Fatal errors.

mikey_p’s picture

Status: Active » Postponed (maintainer needs more info)

Could you expand on how you ran into this error? This module now requires PHP 5.2 which comes with PDO, did you try enabling an older version of this module or do you have a nonstandard PDO compiled with PHP 5.2?

marvil07’s picture

Status: Postponed (maintainer needs more info) » Active

PDO installed do not mean to have the right PDO driver installed, so that seems to be a good reason :-)

BTW #978922: Implement hook_requirements() for PDO was marked as duplicate of this

kscheirer’s picture

I got this fatal error as well

  1. on a drupal6 site, enabled migrate module, which required dbtng (Installed version is 6.x-1.x-dev 2010-Nov-09)
  2. site immediately whitescreens with PHP fatal error 'Undefined class constant MYSQL_ATTR_USE_BUFFERED_QUERY'
  3. went to the db and disabled migrate module
  4. dbtng does not show any errors on the status report page
  5. we are using PHP 5.2.9, but only pdo_sqlite was installed

Implementing hook_requirements() would at least try to prevent this module from being enabled when the needed PDO drivers are not present.

I started on a patch for this over in #761098: Oracle driver compatibility and general 7.x driver issues - right now it is just a runtime check, I think we just need to add the same check when $phase is "install". I was doing it for people with Oracle PDO problems (which is almost never on by default in PHP), but maybe we should close that issue and bring the patch here.