Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

function.preg-replace failure on fresh install #415

Closed
SilentSeraphim opened this Issue Jan 10, 2019 · 6 comments

Comments

Projects
None yet
3 participants
@SilentSeraphim
Copy link

SilentSeraphim commented Jan 10, 2019

Hi, I just did a fresh install at http://polyamr.us and I can't get it to stop giving me this error:

Warning: preg_replace() [function.preg-replace]: Compilation failed: invalid range in character class at offset 22 in /storage/content/39/1005439/polyamr.us/_0220/framework/Layout/Tpl/Engine/PH7Tpl/Predefined/Predefined.class.php on line 105

The installation process seems to go fine but when I try to access anything after deleting the install folder, this is what I get. I deleted the entire install and reinstalled with a freshly downloaded copy to no avail. Here's the code in the predefined.class.php that the error references:

/** * Adding Function. * * @param string $sKey * @param string $sValue * * @return void */ protected function addFunc($sKey, $sValue) { $this->sCode = preg_replace( '#' . $sKey . '#', static::PHP_OPEN . static::WRITE . $sValue . static::PHP_CLOSE, $this->sCode ); }

It's that final sCode that is on line 105. I've also attached a screenshot of the entire debug message. Needless to say, I'm not a programmer, so any help you guys could give me would be greatly appreciated.
2019-01-10

@SilentSeraphim

This comment has been minimized.

Copy link
Author

SilentSeraphim commented Jan 10, 2019

Also, that code didn't look very helpful in the OP so here's a screenshot of the code surrounding line 105 in the predifined.class.php.
2019-01-10- 1

@SilentSeraphim

This comment has been minimized.

Copy link
Author

SilentSeraphim commented Jan 10, 2019

Nevermind. Figured it out myself. Apparently, the code doesn't play nice with PHP 7.3. I switched to 7.1 and it works fine.

@pH-7

This comment has been minimized.

Copy link
Member

pH-7 commented Jan 11, 2019

Hi @SilentSeraphim
Thanks for reporting this! This is because PHP 7.3 now uses PCRE2, and the new version is more aggressive in pattern validations.
Anyway, it will be fixed in the next version of the software :)

pH-7 added a commit that referenced this issue Jan 12, 2019

@pH-7

This comment has been minimized.

Copy link
Member

pH-7 commented Jan 14, 2019

The patch is here 2e43a5a (in case, someone wants to run the software already now with PHP 7.3+).

Anyway, the fix will be released with pH7Builder 14.9.0

@ibacompre

This comment has been minimized.

Copy link

ibacompre commented Feb 9, 2019

I was having the same issue and fixed it by modifying Func.class.php:
$this->addFunc('<ph:date value="([\w\s\-/\|\.,:\\\\]+)" ?/?>', 'date(\'$1\')');

More specifically, if you look at the pattern in this call to addFunc(), you'll see a '-' (dash) character, which was taken as a range symbol. I modified it with a backslash, and it fixed the issue for me.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 11, 2019

Hi there, I locked the thread since there has not been any recent activity after it was closed. Please open a new issue for related bugs. Thank you, Pierre-Henry Soria 🤖

@lock lock bot locked as resolved and limited conversation to collaborators Mar 11, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.