Welcome to the Cumulus Support forum.

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Deprecated function

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

Moderator: daj

Post Reply
Mapantz
Posts: 1808
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 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: 3292
Joined: Tue 09 Dec 2008 1:37 pm
Weather Station: None !
Operating System: W10 - Threadripper 16core, etc
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: 1808
Joined: Sat 17 Dec 2011 11:55 am
Weather Station: Davis Vantage Pro2
Operating System: Windows 11 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: 1185
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