Skip to content
This repository has been archived by the owner on Mar 8, 2021. It is now read-only.

Errors since upgrade to PHP7 and MySQL5.6 with preg_replace #716

Closed
soydemadrid opened this issue Aug 25, 2016 · 3 comments
Closed

Errors since upgrade to PHP7 and MySQL5.6 with preg_replace #716

soydemadrid opened this issue Aug 25, 2016 · 3 comments

Comments

@soydemadrid
Copy link

Hi I unfortunately had to upgrade my server but my Evolution 1.1 site is now showing Jot errors:

ErrorType[num]  WARNING[2]
File    /home/public_html/assets/snippets/jot/includes/phx.parser.class.inc.php
Line    254
Source  $output = preg_replace("~(\b\w+\b)~e","wordwrap('\\1',\$wrapat,' ',1)",$output);
Current Snippet     Jot

Error : preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead

Any workaround or way to fix this please just to get my site back up and running?

@soydemadrid
Copy link
Author

Hi with advice from a forum member I changed line 254 in phx.parser.class.inc.php to:

$output = preg_replace_callback("~(\b\w+\b)~", function($matches) { return wordwrap($matches[0], $wrapat, ' ', 1); }, $output);

Which seems to have fixed that error but has now presented me with a load of other errors as follows:

DocumentParser->executeParser() index.php on line 145 DocumentParser->prepareResponse() manager/includes/document.parser.class.inc.php on line 1803 DocumentParser->outputContent() manager/includes/document.parser.class.inc.php on line 1906 DocumentParser->parseDocumentSource(string $var1) manager/includes/document.parser.class.inc.php on line 634 DocumentParser->evalSnippets(string $var1) manager/includes/document.parser.class.inc.php on line 1655 DocumentParser->_get_snip_result(string $var1) manager/includes/document.parser.class.inc.php on line 1172 DocumentParser->evalSnippet(string $var1, array $var2) manager/includes/document.parser.class.inc.php on line 1195 eval() manager/includes/document.parser.class.inc.php on line 1120 CJot->Run() manager/includes/document.parser.class.inc.php(1120) : eval()'d code on line 60 CJot->getOutputDefault() assets/snippets/jot/jot.class.inc.php on line 305 CJot->getOutputComments() assets/snippets/jot/jot.class.inc.php on line 357 CChunkie->Render() assets/snippets/jot/jot.class.inc.php on line 444 PHxParser->Parse(string $var1) assets/snippets/jot/includes/chunkie.class.inc.php on line 57 PHxParser->ParseValues(string $var1) assets/snippets/jot/includes/phx.parser.class.inc.php on line 60 PHxParser->Filter(string $var1, ':wordwrap:esc:nl2br') assets/snippets/jot/includes/phx.parser.class.inc.php on line 165 preg_replace_callback('~(\b\w+\b)~', Closure $var2, string $var3) assets/snippets/jot/includes/phx.parser.class.inc.php on line 254 PHxParser->{closure}(array $var1) on line wordwrap('We', NULL, ' ', 1) assets/snippets/jot/includes/phx.parser.class.inc.php on line 254

@Deesen
Copy link
Contributor

Deesen commented Aug 25, 2016

Not tested.. maybe

$output = preg_replace_callback("~(\b\w+\b)~", 
  function($matches) use($wrapat) { 
    return wordwrap($matches[0], $wrapat, ' ', 1); 
  }, $output);

And it seems to me $matches[0] has to be changed to $matches[1].

@soydemadrid
Copy link
Author

That's fixed it thanks! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants