Hello,

On Monday, we restarted our apache server. After the restart, we get the following message for some of our (sub)sites:

warning: preg_match() [function.preg-match]: Compilation failed: internal error: previously-checked referenced subpattern not found at offset 389 in <path>/drupal-6.22/includes/database.inc on line 347.

We are currently running Drupal-6.22, apache-2.2.11 and php-5.2.17_2 on FreeBSD-8.2.

Any ideas?

-- Thanks,

Franky

Comments

lendude’s picture

We are encountering the same problem (running Drupal 6.22) since yesterday afternoon (after Apache/PHP/MySQL update all to latest versions). Have you found a solution yet?

I realise the fault probably does not lie with Drupal. As a workaround you can switch of all node access type modules (not much of a workaround, I know), and other modules that use hook_db_rewrite_sql, since the preg_match problem is encounted in db_rewrite_sql

    $pattern = '{
      # Beginning of the string
      ^
      ((?P<anonymous_view>
        # Everything within this set of parentheses is named "anonymous view"
        (?:
          [^()]++                   # anything not parentheses
        |
          \( (?P>anonymous_view) \)          # an open parenthesis, more "anonymous view" and finally a close parenthesis.
        )*
      )[^()]+WHERE)
    }x';
    preg_match($pattern, $query, $matches);

UPDATE: Rollback of Apache and PCRE updates 'solved' the problem. Still trying to figure out why the issues appeared with these updates.

Thanks,
Len

drsnuggles’s picture

Having the same issue here :(. Currently running Drupal-6.22 and Mysql 5.1.59.

I have no idea how to solve the "previously-checked referenced sub pattern not found at offset 389" error. Tried so far without result:
-Login to Drupal installation to disable some modules: can't login because of the error
-Revert to old Mysql database from backup: still having the error
-Revert to old backup from all files: still having the error.
-Asked my host if they changed something in the server configuration: they say they didn't change anything, although I did see a restart of the database server on the 28 of September 2011 in the log. No idea how to check the apache version without access to a console.
-Other web page that have this issue are mostly non-English. This makes me believe the i18n internationalization module is interfering with a new update of some server software. Disabling all i18n submodules did make me able to login again. All content is displayed double and I get an error that the language code is not recognized, since i18n is disabled.

So what can I do to get the web page working again? Wait for module i18n to get updated?

ktwo’s picture

The same problem when uploading to hosting, in my case has been a problem with the version of MySQL. In local have 5.0.7 (no problems) in the hosting 5.1.50 (sintaxi problems). I applied for a previous version they have a 5.0.37 not giving problems.

fowler_’s picture

Hello!

Problem is solved after upgrade PCRE library (PCRE - Perl Compatible Regular Expressions) from version 8.02 to the last version 8.13 (hosting admin remake PHP-module php52-pcre with shared library pcre-8.13_1).

History:

I have the same problen after migration to new hosting.

I have the erros "warning: preg_match() [function.preg-match]:
Compilation failed: internal error: previously-checked referenced subpattern not found at offset 389 in database.inc on line 348."

In line 348 of database.inc located call of function preg_match - this is one function form PCRE package.

I have PCRE PHP library version 8.00 on my old hosting and it was PCRE library version 8.02 on my new hosting.

I found in "ChangeLog for PCRE Version 8.13 16-Aug-2011"

Version 8.02 19-Mar-2010
------------------------
...
5.  A pattern such as (?&t)*+(?(DEFINE)(?<t>.)) which has a possessive
    quantifier applied to a forward-referencing subroutine call, could compile
    incorrect code or give the error "internal error: previously-checked
    referenced subpattern not found".
...

The regulare expression, used into database.inc on line 348 hase very similare to this, described in PCRE changelog.

The upgrade of PCRE to the newest version solved my problem.

Sorry for my English.

drifter’s picture

This problem just popped up for me, here's a patch for database.inc that seems to help if you need a quick fix:

https://www.drupal.org/node/1268858#comment-5653320