We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4144
    • 2 Posts
    The environment:

    CentOS 5.3
    PHP 5.1.6
    MODx Evo RC1

    The error (occurs when I attempt to click on one of the returned search items):

    -----------------------------------------------------------------------------

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »

    PHP error debug
    Error: preg_replace() [function.preg-replace]: Compilation failed: lookbehind assertion is not fixed length at offset 11
    Error type/ Nr.: Warning - 2
    File: /var/www/vhosts/aristacloud.com/httpdocs/manager/includes/document.parser.class.inc.php(745) : eval()’d code
    Line: 120

    -----------------------------------------------------------------------------

    I’ve searched the bug db, the forums (found one other similar unanswered problem), and google with no real clue as to why this is occurring. Any pointers on where to look would be very much appreciated.
      • 4144
      • 2 Posts
      I solved the problem by compiling and installing pcre 7.9. CentOS 5.x (and RedHat 5) ship with pcre 6.6. Since that is such a common platform I still consider this to be a bug in the way the MODx code is using this library. A hint on how to fix this miight be found here:

      http://community.mybboard.net/thread-41499.html
      • Thanks for the research brooks.
          Ryan Thrash, MODX Co-Founder
          Follow me on Twitter at @rthrash or catch my occasional unofficial thoughts at thrash.me
          • 10405
          • 288 Posts
          Is there any way of fixing this other than updating the actual underlying OS? (I have a very similar error message when clicking on a link in a search result)

          Failing that, does someone have install instructions for how to carry out the update?
          • It’s not the OS, it’s the pcre library that needs to be updated. The problem is that a couple of very commonly used OS come with the known buggy library.

            The "fix" mentioned in the link posted below is simply to put the error-suppressing @ in front of the offending preg_replace function, since in their case it only fails under certain conditions.

              Studying MODX in the desert - http://sottwell.com
              Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
              Join the Slack Community - http://modx.org
              • 23571
              • 223 Posts
              you can either fetch the CentOS 5.3 RPMS (you need all 4) that i built from

              http://www.mcritch.com/rpms

              OR

              you can build your own. the spec file i used and the source tarball are there as well. put the pcre.spec in /usr/src/redhat/SPECS and put the tar.bz2 in /usr/src/redhat/SOURCES

              then do

              cd /usr/src/redhat/SPECS

              rpmbuild -bb pcre.spec

              the finished RPMS will be in /usr/src/redhat/RPMS/i386

              rpm -Uivh rpmname.rpm will install them
                • 10405
                • 288 Posts
                Unfortunately I get an error when unpacking the RPMs, as follows:

                > rpmbuild -bb pcre.spec
                error: File /usr/src/redhat/SOURCES/pcre-7.3-multilib.patch: No such file or directory
                  • 10405
                  • 288 Posts
                  Looks like there was an error with the compiler. I’ve now installed the 3 RPMs as specified, however I’m still getting exactly the same error when clicking on any search result link.

                  Does anyone have any other solutions / fixes for this issue?
                  • You might need to restart your Apache.
                      Studying MODX in the desert - http://sottwell.com
                      Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
                      Join the Slack Community - http://modx.org
                      • 10405
                      • 288 Posts
                      Thanks, that seems to have done the trick.

                      Only issue is that if I follow the search result link to the relevant page, then hit the back button in the browser I get a "Webpage has expired" message. Is there a way of stopping this?