PHP7 and the preg_replace problem

Do not post support requests, bug reports or feature requests. Discuss phpBB here. Non-phpBB related discussion goes in General Discussion!
Get Involved
User avatar
AmigoJack
Registered User
Posts: 6108
Joined: Tue Jun 15, 2010 11:33 am
Location: グリーン ヒル ゾーン
Contact:

Re: PHP7 and the preg_replace problem

Post by AmigoJack »

open-your-eyes wrote: Tue Oct 31, 2017 7:48 pmtell me what to do
Read my comment in the ticket (and maybe all my posts in this topic). I won't hand out a specific list - I explained everything already.
  • "The problem is probably not my English but you do not want to understand correctly. ... We will not come anybody anyway, nevertheless, it's best to shit this." Affin, 2018-11-20
  • "But this shit is not here for you. You can follow with your. Maybe the question, instead, was for you, who know, so you shoved us how you are." axe70, 2020-10-10
  • "My reaction is not to everyone, especially to you." Raptiye, 2021-02-28
User avatar
Ger
Registered User
Posts: 2108
Joined: Wed Jan 02, 2008 7:35 pm
Location: 192.168.1.100
Contact:

Re: PHP7 and the preg_replace problem

Post by Ger »

open-your-eyes wrote: Tue Oct 31, 2017 7:48 pm Can you please tell me what to do?
Upgrade to 3.2

3.0 has reached End of Life almost 2 years ago.
My extensions:
Simple CMS, Feed post bot, Avatar Resize, Modbreak, Magic OGP, Live topic update, Modern Quote, Quoted Where (GDPR) and Autoresponder.
Newest: FAQ manager for 3.2

Like my work? Buy me a coffee to keep it coming. :ugeek:

-Don't PM me for support-
User avatar
bbthailand
Translator
Posts: 76
Joined: Wed Jun 18, 2008 6:00 am
Contact:

Re: PHP7 and the preg_replace problem

Post by bbthailand »

Code: Select all

$this->message = preg_replace_callback($regexp, function($matches) use($replacement) {eval('$str=' . $replacement[1]); return $str;}, $this->message);
Work for me
User avatar
open-your-eyes
Registered User
Posts: 94
Joined: Mon Jul 31, 2017 8:20 am
Contact:

Re: PHP7 and the preg_replace problem

Post by open-your-eyes »

Where do you put that code, bbthailand?
FoulFoot
Registered User
Posts: 262
Joined: Mon Jun 23, 2003 1:04 am
Location: Honolulu, HI
Contact:

Re: PHP7 and the preg_replace problem

Post by FoulFoot »

There's a lot more to fix than just that one line.

See the guide here: https://forum.dion-designs.com/t9154/ma ... th-php-70/

Foul
User avatar
DavidIQ
Customisations Team Leader
Customisations Team Leader
Posts: 18316
Joined: Thu Jan 06, 2005 1:30 pm
Location: Fishkill, NY
Name: David Colón
Contact:

Re: PHP7 and the preg_replace problem

Post by DavidIQ »

open-your-eyes wrote: Fri Dec 15, 2017 4:39 pm Where do you put that code, bbthailand?
According to your signature your forum is still under construction. If that's the case then why would you even bother with 3.0? :roll:
Apply to become a Jr. Extension Validator
My extensions | In need of phpBB services? | Was I helpful today?
No unsolicited PMs unless you're planning on asking for paid help.
User avatar
open-your-eyes
Registered User
Posts: 94
Joined: Mon Jul 31, 2017 8:20 am
Contact:

Re: PHP7 and the preg_replace problem

Post by open-your-eyes »

Don't believe anything you see or hear. :)
User avatar
mrgtb
Registered User
Posts: 603
Joined: Wed Oct 03, 2007 10:51 am

Re: PHP7 and the preg_replace problem

Post by mrgtb »

Frank Rizzo wrote: Sun May 17, 2015 10:47 am I note the bugtracker records for this problem such as here:

https://tracker.phpbb.com/browse/PHPBB3-13832

The issue is that 3.0.x and 3.1.x are using preg_replace with the /e modifier, which is deprecated in PHP7.
Just out of interest seeing as I run heavily modified 3.1 board, there's no way I can upgrade to 3.2. Is it simply a case of replacing preg_replace with something else in all files used by phpBB 3.1 to make it PHP 7 compatible. As that can done quite easy really using something like NotePad++ and doing a search and replace on mass files open up in it at once

I don't mind doing it as a test run with my forum is that's all which needs be replaced with something else (every instance of "preg_replace") used in files. But is that all that's stopping it from being PHP 7 compatible
nl2dav
Registered User
Posts: 105
Joined: Tue Jun 25, 2002 10:39 pm
Location: NOP, The Netherlands
Contact:

Re: PHP7 and the preg_replace problem

Post by nl2dav »

Eehh well yes.. Thats basically about it, together with the capt-cha problem.

I followed these instructions from this German website; http://www.stephan-frank.de/board/index.php?topic=2.0 .. It's 3.0 code though. Not that it is much different from 3.1 or 3.2. Some people pretend like that a lot is changed but the core code is still the same. (Hence the .1 and .2 suffix).

My forum is that much altered that I don't want to update to 3.2.. I tried though! But then I discovered that 3.2 has a cron running which changes every posting in the database in favor of this new Twig template engine stuff which I do not care about to begin with (yes, sorry).. And there is some massive extra file usage overhead and parsing which is not needed in my situation. I simply like the old template system, it's not bad, just harder to learn.

---
So anyone who likes to stick with 3.0, or 3.1 ... It's pretty easy to do, just some small changes need to be made to make it PHP7.0 compatible. (7.1 or 7.2 I do not know, it doesn't make sense for me yet to upgrade to those PHP versions).

The only major problem is Tapatalk, which I chosen to keep running in a PHP5.6 environment until somebody creates a better phone app for phpBB.
User avatar
canonknipser
Registered User
Posts: 2096
Joined: Thu Sep 08, 2011 4:16 am
Location: Germany
Name: Frank Jakobs
Contact:

Re: PHP7 and the preg_replace problem

Post by canonknipser »

nl2dav wrote: Tue Jan 09, 2018 5:51 pm 7.1 or 7.2 I do not know, it doesn't make sense for me yet to upgrade to those PHP versions
7.0 has already reached EOL and only gets security updates: http://php.net/supported-versions.php (as a remark: 5.6 security support runs approx. 1 month longer :D) . So you can even stay on 5.6 to be on the same security level...
Greetings, Frank
phpbb.de support team member
English is not my native language - no support via PM or mail
New arrival - Extensions and scripts for phpBB
Post Reply

Return to “phpBB Discussion”