Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> Wordpress - Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback
miladam
post 16.03.2017, 11:42:50
Post #1





Grupa: Zarejestrowani
Postów: 1
Pomógł: 0
Dołączył: 16.03.2017

Ostrzeżenie: (0%)
-----


Witam serdecznie grono fanów i developerów.

Mam następujący problem, zmieniłem wersję php na serwerze na 5.6 i wywaliło mi błąd na stronie wordpressa.

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/gazetta/domains/miastoiludzie.pl/public_html/prolink.php on line 177

W momencie kiedy użyłem wspomnianego preg_replace_callback, dostałem kolejny błąd.

Warning: preg_replace_callback(): Requires argument 2, ''s:'.strlen('$2').':"$2";'', to be a valid callback in /home/gazetta/domains/miastoiludzie.pl/public_html/prolink.php on line 177


Błąd występuje w funkcji, zaznaczę linię 177. Proszę o pomoc w przekształceniu kodu tak aby działał, ponieważ sam nie jestem w stanie gdyż nie rozumiem, a nie jestem programistą. Jak nie naprawię tego to mnie szefowa zje : ) Dzięki wielkie

  1. function prolink_getLink($intIndex) {
  2. $text = file_get_contents('prolink_' . C_ID . '.txt');
  3. $text = preg_replace('!s:(\d+):"(.*?)";!se', "'s:'.strlen('$matches[2]').':\"$matches[2]\";'", $text); /** linia 177 do zamiany callbackiem **/
  4. $arrLinks = unserialize($text);
  5.  
  6. $strIndex = prolink_getHash();
  7. if ($strIndex !== NULL && isSet($arrLinks[$strIndex][$intIndex])) {
  8. return $arrLinks[$strIndex][$intIndex]['pre'] . ' <a target="_blank" href="' . $arrLinks[$strIndex][$intIndex]['link'] . '">' . $arrLinks[$strIndex][$intIndex]['text'] . '</a> ' . $arrLinks[$strIndex][$intIndex]['post'];
  9. }
  10. return '';
  11. }


Ten post edytował miladam 16.03.2017, 11:44:35
Go to the top of the page
+Quote Post
kapslokk
post 16.03.2017, 11:52:52
Post #2





Grupa: Zarejestrowani
Postów: 965
Pomógł: 285
Dołączył: 19.06.2015
Skąd: Warszawa

Ostrzeżenie: (0%)
-----


http://stackoverflow.com/questions/2349839...eplace-callback
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 Użytkowników czyta ten temat (1 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Wersja Lo-Fi Aktualny czas: 24.07.2025 - 14:22