Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Problem po aktualizacji
KR2615
post
Post #1





Grupa: Zarejestrowani
Postów: 311
Pomógł: 13
Dołączył: 7.05.2007

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


Wykonałem aktualizację Debiana z 7.8 do 8.1. Przy okazji PHP poszło do 5.6.9-0+deb8u1. Mam na nim LMSa. Dostaję teraz błędy w stylu:
Cytat
Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /var/www/lms/lib/common.php

Przykładowe fragmenty kodu sprawiające problemy:
  1. function docnumber($number=NULL, $template=NULL, $time=NULL, $ext_num='')
  2. {
  3. <------>$number = $number ? $number : 1;
  4. <------>$template = $template ? $template : DEFAULT_NUMBER_TEMPLATE;
  5. <------>$time = $time ? $time : time();
  6. <------>
  7. <------>// extended number part
  8. <------>$result = str_replace('%I', $ext_num, $template);
  9.  
  10. <------>// main document number
  11. [b]<------>$result = preg_replace('/%(\\d*)N/e', "sprintf('%0\\1d', $number)", $result);[/b]
  12. <------>
  13. <------>// time conversion specifiers
  14. <------>return strftime($result, $time);
  15. }
  16. ]


  1. function smarty_modifier_striphtml($args)
  2. {
  3. $search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript
  4. "'<[\/\!]*?[^<>]*?>'si", // Strip out html tags
  5. "'([\r\n])[\s]+'", // Strip out white space
  6. "'&(quot|#34);'i", // Replace html entities
  7. "'&(amp|#38);'i",
  8. "'&(lt|#60);'i",
  9. "'&(gt|#62);'i",
  10. "'&(nbsp|#160);'i",
  11. "'&(iexcl|#161);'i",
  12. "'&(cent|#162);'i",
  13. "'&(pound|#163);'i",
  14. "'&(copy|#169);'i",
  15. [b]"'&#(\d+);'e"); // evaluate as php[/b]
  16.  
  17.  
  18. $replace = array ("",
  19. "\\1",
  20. "\"",
  21. "&",
  22. "<",
  23. ">",
  24. " ",
  25. chr(161),
  26. chr(162),
  27. chr(163),
  28. chr(169),
  29. "chr(\\1)");
  30.  
  31. return preg_replace ($search, $replace, $args);
  32.  
  33. }


Niestety moje umiejętności programowania w PHP są zbyt ubogie aby przerobić ten kod. Prosiłbym o pomoc
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 7)
ohm
post
Post #2





Grupa: Zarejestrowani
Postów: 623
Pomógł: 144
Dołączył: 22.12.2010

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


  1. "'/%(\\d*)N/e'",
  2. function($m) { return sprintf('%0\\1d', $number); },
  3. $result
  4. );


Coś w tym stylu, pisane w ciemno (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
KR2615
post
Post #3





Grupa: Zarejestrowani
Postów: 311
Pomógł: 13
Dołączył: 7.05.2007

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


Ok, udało mi się przerobić obie funkcje. Nie sypią errorami i działają jak powinny. Temat do zamknięcia.
Go to the top of the page
+Quote Post
redeemer
post
Post #4





Grupa: Zarejestrowani
Postów: 915
Pomógł: 210
Dołączył: 8.09.2009
Skąd: Tomaszów Lubelski/Wrocław

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


Nie lepiej zaktualizować LMS? https://github.com/lmsgit/lms

Ten post edytował redeemer 21.07.2015, 08:06:28
Go to the top of the page
+Quote Post
Pyton_000
post
Post #5





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

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


Najlepiej i jedno i drugie (IMG:style_emoticons/default/smile.gif)
Go to the top of the page
+Quote Post
redeemer
post
Post #6





Grupa: Zarejestrowani
Postów: 915
Pomógł: 210
Dołączył: 8.09.2009
Skąd: Tomaszów Lubelski/Wrocław

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


Cytat(Pyton_000 @ 21.07.2015, 09:21:48 ) *
Najlepiej i jedno i drugie (IMG:style_emoticons/default/smile.gif)
Przecież to się wyklucza.
Go to the top of the page
+Quote Post
Pyton_000
post
Post #7





Grupa: Zarejestrowani
Postów: 8 068
Pomógł: 1414
Dołączył: 26.10.2005

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


Aktualizacja systemu i lms ? (IMG:style_emoticons/default/wink.gif)
Go to the top of the page
+Quote Post
redeemer
post
Post #8





Grupa: Zarejestrowani
Postów: 915
Pomógł: 210
Dołączył: 8.09.2009
Skąd: Tomaszów Lubelski/Wrocław

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


Cytat(Pyton_000 @ 21.07.2015, 09:43:16 ) *
Aktualizacja systemu i lms ? (IMG:style_emoticons/default/wink.gif)
Ręczna poprawa plików LMS i jego aktualizacja :-)
Go to the top of the page
+Quote Post

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

 



RSS Aktualny czas: 22.08.2025 - 19:24