Welcome to the Cumulus Support forum.

Latest Cumulus MX release v3.0.0 build 3050 - 1 May 2019.
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014

See the Wiki for downloading either version.

Deprecated function

Other discussion about creating web sites for Cumulus that doesn't have a specific subforum

Moderator: daj

Post Reply
Mapantz
Posts: 598
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 10 x64
Location: Dorset - UK
Contact:

Deprecated function

Post by Mapantz » Wed 14 Aug 2019 7:15 pm

I've just been testing a new hosting provider, and despite the PHP being the same version as my last, i'm getting a couple of errors

Code: Select all

     create_function('$matches', 'return strtoupper($matches[0]);'), $fixedtxt);
    $wxalltext[$i] = $fixedtxt;
PHP Deprecated: Function create_function() is deprecated

Any qualified people around? - :(
Image

User avatar
beteljuice
Posts: 2710
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: ex XP SP3 - now W10 laptop grr
Location: Dudley, West Midlands, UK

Re: Deprecated function

Post by beteljuice » Thu 15 Aug 2019 1:15 am

That's php 7.2 message ....

I was getting confused about what it did, until I realised it was part of a larger construct.

This is the part that's the problem:

create_function('$matches', 'return strtoupper($matches[0]);'), $fixedtxt);

See if this works or not:

Code: Select all

function('$matches'){ return strtoupper($matches[0]);} , $fixedtxt);
$wxalltext[$i] = $fixedtxt;
... although I'm in the dark with php7.x :roll:
Image
......................Imagine, what you will KNOW tomorrow !

Mapantz
Posts: 598
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 10 x64
Location: Dorset - UK
Contact:

Re: Deprecated function

Post by Mapantz » Thu 15 Aug 2019 3:17 pm

beteljuice wrote:
Thu 15 Aug 2019 1:15 am
That's php 7.2 message ....

I was getting confused about what it did, until I realised it was part of a larger construct.

This is the part that's the problem:

create_function('$matches', 'return strtoupper($matches[0]);'), $fixedtxt);

See if this works or not:

Code: Select all

function('$matches'){ return strtoupper($matches[0]);} , $fixedtxt);
$wxalltext[$i] = $fixedtxt;
... although I'm in the dark with php7.x :roll:
Bingo!

Thanks beteljuice! :D
Image

User avatar
saratogaWX
Posts: 981
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Deprecated function

Post by saratogaWX » Thu 15 Aug 2019 3:24 pm

It would be helpful to see the code in context.

I've used a function to replace the deprecated 'e' modifier in preg_replace() function with a preg_replace_callback().

The original code was

Code: Select all

      $text = preg_replace('!\.\s+([a-z])!es',"'.  ' . strtoupper('\\1')",$text);
and due to the deprecated 'e' modifier had to be changed to

Code: Select all

      $text = preg_replace_callback('!\.\s+([a-z])!s',
	  function ($matches) { return('.  ' . strtoupper($matches[1]) ); }
	  ,$text);
It looks like your code snippet was attempting to do a similar thing.

Hope this helps...

Post Reply