If Drupals $db_url is defined as an array instead of a string (see http://drupal.org/node/18429 & default the case in the PressFlow distribution) _webform_mysql_views_check_requirements() produces a segmentation fault. Attached patch fixes this problem, enabling both array and string based $db_urls.

Comments

robin van emden’s picture

StatusFileSize
new1.07 KB

Missed one $db_url there. This patch should catch 'em all.

cafuego’s picture

I just hit this problem as well. I wonder if it's a good idea to modify the global $db_url in the middle of code execution. Wouldn't it be better to use a temp variable, like so?

    if (is_array($db_url))
      $_dburl = $db_url['default'];
    else
      $_dburl = $db_url;

    if (substr($_dburl, 0, 5) != 'mysql') {
      ...

It probably wouldn't hurt to implement this in hook_requirements and just refuse to install if it's not MySQL. I'll do a patch.

cafuego’s picture

StatusFileSize
new4.48 KB

Attached is a patch that moves the requirements check to hook_requirements() in the install file and happily copes with $db_url being an array.

For the record, this original code actually does exactly nothing, as variable_set() doesn't return anything.

  $meets_reqs = variable_set('webform_mysql_views_meets_reqs', FALSE);
   if ($meets_reqs) {
     return TRUE;
  }

Since the module now won't install at all unless its requirements are met, I've removed all reference to the webform_mysql_views_meets_reqs variable. Apart from in hook_uninstall()

robin van emden’s picture

Status: Needs review » Reviewed & tested by the community

Nice. Tested patch, works.

cafuego’s picture

Assigned: Unassigned » cafuego
Status: Reviewed & tested by the community » Closed (fixed)

Patch from comment #3 ported to the latest git version and applied to 6.x-1.x-dev.

nemanja’s picture

Issue summary: View changes

Is there a fix for drupal 7 version?

cafuego’s picture

Version: 6.x-1.2 » 7.x-1.x-dev
Status: Closed (fixed) » Postponed (maintainer needs more info)

It doesn't offhand look as if this was ever a problem for the D7 version, it directly queries the current database connection, as opposed to looking at what's in settings.php.

Is your Drupal segfaulting on the requirements check?