Forums

Unfortunately no one can be told what FluxBB is - you have to see it for yourself.

You are not logged in.

#1 2017-11-30 15:54:24

bagu
Member
Registered: 2010-10-18
Posts: 31

create_function and PHP 7.2

Hello,

I'm under php 7.2 and i have some problems with create_function in parser.php here :

	$text = preg_replace($pattern, $replace, $text);
	$count = count($pattern_callback);
	for($i = 0 ; $i < $count ; $i++)
	{
		$text = preg_replace_callback($pattern_callback[$i], create_function('$matches', 'return '.$replace_callback[$i].';'), $text);
	}
	return $text;

I try to rewrite it to :

	$text = preg_replace($pattern, $replace, $text);
	$count = count($pattern_callback);
	for($i = 0 ; $i < $count ; $i++)
	{
		$text = preg_replace_callback($pattern_callback[$i], function ($matches) { return $replace_callback[$i];}, $text);
	}
	return $text;

But it don't work here (everywhere else, my modifications works fine)

Can you help me to solve this ?
Thanks

Offline

#2 2017-11-30 17:01:13

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,185
Website

Re: create_function and PHP 7.2

Offline

#3 2017-11-30 17:52:48

bagu
Member
Registered: 2010-10-18
Posts: 31

Re: create_function and PHP 7.2

Nice wink

Thanks a lot

Offline

#4 2017-11-30 18:10:35

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,559
Website

Re: create_function and PHP 7.2

Thanks for the heads-up.

I am planning to release a version that supports PHP 7.2 very soon.


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#5 2017-12-05 05:16:27

abdulhalim
Member
From: Iran, Bandar Abbas
Registered: 2014-03-13
Posts: 19

Re: create_function and PHP 7.2

Franz wrote:

I am planning to release a version that supports PHP 7.2 very soon.

Is this just a update to supporting new PHP version, or maybe new feature too ?

Offline

#6 2017-12-05 08:15:31

Otomatic
FluxBB Donor
From: Paris - France
Registered: 2010-01-26
Posts: 550
Website

Re: create_function and PHP 7.2

Hi,

In some cases, it's relatively simple to replace "create_function" with "anonymous function", but in many cases this is pretty complicated because create_function internally performs an eval() which anonymous function can not do.


Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Ghandi
An error does not become truth by reason of multiplied propagation. Ghandi

Offline

#7 2018-04-23 13:57:12

JayJay
Member
Registered: 2010-11-04
Posts: 12

Re: create_function and PHP 7.2

Franz wrote:

Thanks for the heads-up.

I am planning to release a version that supports PHP 7.2 very soon.

Any update on supporting PHP 7.2?
How soon is "very soon"? wink

Offline

#8 2018-04-24 07:14:45

Otomatic
FluxBB Donor
From: Paris - France
Registered: 2010-01-26
Posts: 550
Website

Re: create_function and PHP 7.2

Hi,

I'm not hiding it, I went to pump Visman's modifications and I'm very happy about it.
Thank you, Visman.

Когда вы пишете «Я говорю только по-русски», я просматриваю Google Translation, чтобы выразить свою благодарность по-русски.


Ce n'est pas parce que l'erreur se propage qu'elle devient vérité. Ghandi
An error does not become truth by reason of multiplied propagation. Ghandi

Offline

#9 2018-07-16 18:21:07

nsuchy
Developer
From: United States
Registered: 2018-07-15
Posts: 4
Website

Re: create_function and PHP 7.2

As Franz said an update to support PHP 7.2 will come soon though it may take time to make sure everything works as expected afterwards. A short term solution, if you have access to the server would be to run an older version of PHP or if FluxBB is not entirely broken (works for me with but warnings!), to suppress error messages if this is affecting a production install.

----

I'm posting this information in my reply for statistical information and for historical record.

On my own system running PHP 7.2 I get a create_function is deprecated warning. This is PHP 7.2 for macOS High Sierra through Homebrew Package manager.

Nathaniels-MBP:fluxbb nathanielsuchy$ php -v
PHP 7.2.7 (cli) (built: Jun 22 2018 06:27:50) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.2.0, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.2.7, Copyright (c) 1999-2018, by Zend Technologies

Offline

#10 2018-07-17 01:51:38

Visman
Member
From: Siberia
Registered: 2010-07-10
Posts: 1,185
Website

Re: create_function and PHP 7.2

@nsuchy, do not fool around the garden. The solution in the second post of this topic.

Last edited by Visman (2018-07-17 01:54:23)

Offline

#11 2018-07-17 02:07:42

nsuchy
Developer
From: United States
Registered: 2018-07-15
Posts: 4
Website

Re: create_function and PHP 7.2

Visman wrote:

@nsuchy, do not fool around the garden. The solution in the second post of this topic.

Hi I'm glad to see you were able to come up with a workaround in your FluxBB Fork - perhaps they could get reviewed and merged directly into FluxBB's Core Repository @Franz?

Offline

#12 2018-07-17 08:48:12

Franz
Lead developer
From: Germany
Registered: 2008-05-13
Posts: 6,559
Website

Re: create_function and PHP 7.2

Yes, they are already lying around on my local machine, although slightly tweaked.


fluxbb.de | develoPHP

"As code is more often read than written it's really important to write clean code."

Offline

#13 2018-10-25 21:21:47

JayJay
Member
Registered: 2010-11-04
Posts: 12

Re: create_function and PHP 7.2

Any update on this? My webhost is dropping PHP 5.5 and 5.6 in January 2019 and I need to move to a new server with 7.2 before that. Any chance 7.2 compatibility will be officially available soon?

Offline

Board footer

Powered by FluxBB