Compilation failed error with 5.6.2.1

Permalink 2 users found helpful
I was interested in thehttps://github.com/concrete5/concrete5/pull/1138... patch to tidy up orphanned aliases so I installed 5.6.2.1 from a clean install with an empty database today.

However when I install my package which worked fine on 5.6.1.2 I am getting a whole load of problems.

The package contains a large number of block types, attributes and a theme. It also downloads a CSV file and programmatically creates the raw structure of the site when it is installed. However when I run the install script now I get a lot of these errors:

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: regular expression is too large at offset 64137 in (...)/www/concrete/libraries/3rdparty/urlify.php on line 208

and then:

Warning: fgetcsv() [function.fgetcsv]: SSL: Connection reset by peer in (...)/www/packages/foundry/controller.php on line 205

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: regular expression is too large at offset 231777 in (...)/www/concrete/libraries/3rdparty/urlify.php on line 208

Warning: Missing argument 2 for Concrete5_Model_Config::save(), called in (...)/www/packages/foundry/controller.php on line 239 and defined in (...)/www/concrete/core/models/config.php on line 129

Warning: Cannot modify header information - headers already sent by (output started at (...)/www/concrete/libraries/3rdparty/urlify.php:208) in (...)/www/concrete/core/libraries/controller.php on line 418

I think that I get one of the original errors for every page that I'm trying to create (~350 of them).
Once the process has finished, and I reload the dashboard then concrete thinks that my package is installed, the pages have all been created and I can browse the site. I've simplified the page installation process down to the point where all I'm doing is this:

$data = array(
   'cName' => $row[R_TITLE],
   'cHandle' => substr($url, $lastSlash + 1),
   'pkgID' => $pkg->getPackageID()
);
$pageType = CollectionType::getByHandle($row[R_PAGETYPE]);
if ($pageType) {
   $page = $parent->add($pageType, $data);
} else {
   Log::addEntry('Cannot resolve pageType of '.$row[R_PAGETYPE].' in row '.$r);
}


ie not doing anything with the page at all other than creating it. Have you any idea why I might be getting these errors or what might be the sensible next place to look to try and deduce what is going on?

 
mhawke replied on at Permalink Reply
mhawke
Same here when submitting a Formidable form:

Warning: preg_match_all() [function.preg-match-all]: Compilation failed: regular expression is too large at offset 64772 in home/definit6/public_html/updates/concrete5.6.2.1_updater/concrete/libraries/3rdparty/urlify.php on line 208


I have reported this in the bug tracker.
bigearl replied on at Permalink Reply
bigearl
Looking at the port of Django's Urlify, the "init" function is concatting the character map every time it's used. So in my case, as I iterated over an array of pages I was auto-generating, the regex got bigger and bigger and bigger. It's only 640 chars, but each time it added that amount... 1280, 1920, 2560, etc...

patch?

/concrete/libraries/3rdparty/urlify.php
move line 165 up to line 159

<code>
/* Is a specific m
if (isset(self::$m
/* Move this m
$m = self::$ma
unset(self::$m
self::$maps[$l
/***************************/
/* NOTE: THIS MOVED */
/***************************/
}

/* Reset static va
self::$language =
self::$map = array
self::$chars = '';
self::$regex = '';
</code>

Hope that helps.
mhawke replied on at Permalink Reply
mhawke
bigearl replied on at Permalink Reply
bigearl
Yes, the above patch makes that error go away. It's just a silly loop issue, not a major defect.

But def. escalate to Andrew, (or someone on C5 Core) to double check me, just in case, if you can.
bigearl replied on at Permalink Reply
bigearl
Yes, the above patch makes that error go away. It's just a silly loop issue, not a major defect.

But def. escalate to Andrew, (or someone on C5 Core) to double check me, just in case, if you can.