Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PROBLEM php8
#1
Hi,
my server now can run php8. It seems that gs 3.3.16 does work, but there are errors thrown on some pages that uses extended i18n navigation themes. All errors seem to point to i18n:

Fatal error: Uncaught TypeError: count(): Argument #1 ($var) must be of type Countable|array, null given in /var/www/gs3.3.16/plugins/i18n_navigation/frontend.class.php:219 Stack trace:

#0 /var/www/gs3.3.16/plugins/i18n_navigation/frontend.class.php(176): I18nNavigationFrontend::getMenuImpl(Array, 'philosophie', NULL, 100, 5)

#1 /var/www/gs3.3.16/plugins/i18n_navigation/frontend.class.php(259): I18nNavigationFrontend::getMenu('philosophie', 0, 99, 5)

#2 /var/www/gs3.3.16/plugins/i18n_navigation.php(163): I18nNavigationFrontend::outputMenu('philosophie', 0, 99, 5, NULL)

#3 /var/kunden/htdocs/selbst/df8oe/theme/andreas00/template.php(26):get_i18n_navigation(Object(SimpleXMLExtended), 0, 99, 5)

#4 /var/www/gs3.3.16/index.php(134): include('/var/customers/htd...')

#5 {main} thrown in /var/www/gs3.3.16/plugins/i18n_navigation/frontend.class.php on line 219

Pages run on php 7.4 but show error message when I enable debug mode:

Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/gs3.3.16/plugins/i18n_navigation/frontend.class.php on line 219

Any ideas how to fix that?
Reply
#2
Hi,

I really hope that Mvlcek reads this thread and upgrades his plugins to php8
His plugins are pure gold for the GS cms.
Otherwise someone of us has to dig in the code and do the upgrades.
Reply
#3
(2021-02-05, 00:12:12)df8oe Wrote: Warning: count(): Parameter must be an array or an object that implements Countable in /var/www/gs3.3.16/plugins/i18n_navigation/frontend.class.php on line 219

Any ideas how to fix that?

Well-known issue, I thought (but can't find it in the forum now). Anyway, change line 219 in that file to:
PHP Code:
'haschildren' => $showChildren count((array)$children) > self::hasChildren($childurl$show
--
Nick.
Reply
#4
That fixes the problem but I think it does not sove it. It is buried now in the deep of the code and possibly will rise again in a much mire difficult way. Better is to test if the variable is an array than to cast it... https://www.php.net/manual/de/function.is-array.php
It would be great if Mvlcek reviews his code - he knows it better than anyone else... Getsimple is not dead and i18n is not, too. It is running on many websites!

Thanks for the workaround - I will add a "fixme" comment to the code there, too Wink
Reply
#5
Backend now works since days without problems - everything is accessible as before. Now I tried to use admin part and there are some errors. get_magic_quotes was the simplest - but there are more. Has anyone tested php8 compatibility of the whole basic getsimple package 3.3.16?
Reply
#6
Hi df8oe,

Thanks for starting about GS compatibility with php8
this is really appreciated.

Let's start a project to upgrade GS where needed to php8
GS is more than worth it and you guys all know that !

I have quickly setup a GS test site with php set to version 8.0 on the host

http://php8.showme.zone/
Reply
#7
OK - I stepped somelike forward.

admin/inc/basic.php:
put a comment sign on lines 689, 691, 692, 693
line 1194 $str must be casted to (int)

admin/changedata.php:
I found syntax I do not understand in lines 52 and 60. There is count($translit>0) - what I do not understand. I replaced it on both lines with count($translit)>0 - and now modifying pages works again.

admin/upload.php:
line 235 $dirsSorted must be casted to (array)



Also creating a new page, adding it to the menu, and deleting it works again. I cannot say if there are more issues - it would be nice if someone checks functions, too Wink
Reply
#8
I cannot reproduce any more issues at the moment. This would state that GS is already at a *very high quality level*! Other Open Source software I am using (drupal 7.x, dokuwiki...) is miles after GS.

I like GS and I am using it on many domains. I will contribute modifications via GitHub. And I am testing actively if there are more issues. My server is running on Arch Linux, which always represents the bleeding edge of software without version jumps...
Reply
#9
Get Simple under php 8.0.2 with default theme

When adding / changing and saving component under "Edit Components"


PHP Code:
Fatal errorUncaught ErrorCall to undefined function get_magic_quotes_gpc() in C:\htdocs\testsite\admin\inc\basic.php:689 Stack trace#0 C:\htdocs\testsite\admin\components.php(56): safe_slash_html('testing') #1 {main} thrown in C:\htdocs\testsite\admin\inc\basic.php on line 689 


When adding new post / editing post and saving is not possible, it ends with an error :


PHP Code:
Fatal errorUncaught TypeErrorcount(): Argument #1 ($var) must be of type Countable|array, bool given in C:\htdocs\testsite\admin\changedata.php:52 Stack trace: #0 {main} thrown in C:\htdocs\testsite\admin\changedata.php on line 52 


Dear Get Simple developers, is there any update planned in the near future to be compatible with php8?
Reply
#10
Quote:Dear Get Simple developers, is there any update planned in the near future to be compatible with php8?

Yes there will be.
We need more people to post incompatible issues with php8
to speed up adapting Get Simple.

Please realize that it is not necessary to use php8 already as something
that is absolutely needed. There is nothing wrong with php7.
So in the mean time it is safe to use GS with php7.
Reply
#11
I have a plugins test repo

https://github.com/GetSimpleCMS/Plugins/...er/plugins

I will update it and we can use it for patching plugins, its dirty but better we have a diff mechanism than random forum posts

Also you should definitely be running 3.4 on php7+
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply




Users browsing this thread: 1 Guest(s)