Welcome to the Cumulus Support forum.

Latest Cumulus MX release 3.6.10 (build 3086) - 24 June 2020 (please see important announcement regarding releases since 3.5.0)
Legacy Cumulus 1 release v1.9.4 (build 1099) - 28 November 2014 (a patch is available for 1.9.4 build 1099 that extends the date range of the NOAA report and Snow Index drop-down menus to 2030)

See the Wiki to download the software or click on the Downloads link in the Forum Banner.

Deprecated function

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

Moderator: daj

Post Reply
Mapantz
Posts: 747
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 »

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: 2950
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 »

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: 747
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 »

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: 1035
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 »

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