Dear Board!
I'm getting php errors when I try to use php 7 with the latest version of cmsimple_xh (1.6.9) and commentary module Twocents (1.0beta2). This is probably also true for other modules.
It looks like this issue is related to cmsimple_xh and not to the module.
Can anybody please reproduce the failure?
Christoph, is php 7 fully supported with latest cmsimple & latest approved modules?
Many thanks, Christian
Setup:
<h1>Gästebuch</h1>
<p>#CMSimple $output.=twocents();#</p>
Error messages:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function twocents(), 0 passed in <path>/cmsimple/functions.php(184) : eval()'d code on line 1 and exactly 1 expected in <path>/plugins/twocents/index.php:44
Stack trace:
#0 <path>/cmsimple/functions.php(184) : eval()'d code(1): twocents()
#1 <path>/cmsimple/functions.php(184): eval()
#2 <path>/cmsimple/functions.php(343): evaluate_cmsimple_scripting('<h1>G\xC3\xA4stebuch<...', true)
#3 <path>/cmsimple/cms.php(1333): evaluate_scripting('<h1>G\xC3\xA4stebuch<...')
#4 <path>/index.php(12): include('/var in <path>/plugins/twocents/index.php on line 44
php 7 + cms 1.6.9 + Twocents 1.0beta2 (and other modules?) not working
Re: php 7 + cms 1.6.9 + Twocents 1.0beta2 (and other modules?) not working
Thanks for reporting this issue. Quickfix for your case: change this line to:chrinux wrote:Fatal error: Uncaught ArgumentCountError: Too few arguments to function twocents(), 0 passed in <path>/cmsimple/functions.php(184) : eval()'d code on line 1 and exactly 1 expected in <path>/plugins/twocents/index.php:44
Code: Select all
function twocents($topicname = '')
There is at least one known issue regarding the core. There may be more issues regarding plugins. The fatal error you reported isn't a PHP 7.0 issue, though, but rather happens only with PHP 7.1.chrinux wrote:Christoph, is php 7 fully supported with latest cmsimple & latest approved modules?
Christoph M. Becker – Plugins for CMSimple_XH
Re: php 7 + cms 1.6.9 + Twocents 1.0beta2 (and other modules?) not working
Hi Christoph,
many thanks for your fast reply!
First of all I could have avoided the failure by reading your manual:
If you call
<h1>Gästebuch</h1>
<p>#CMSimple $output.=twocents('guestbook');#</p>
the plugin works in php 7. This is also true for an other very old plugin:
<p>#CMSimple $output.= GBlist('guestbook');#</p> (returns a lot different error due to missing php functions, though)
It seems the big difference in php 7 is it's intolerance to missing function input parameters even though they may be validated later in the code.
So e.g. this works in php 5:
<p>#CMSimple $output.=twocents();#</p> because 'guestbook' is set in the code as a default. But it does not work in php 7.
In php 7 this would also solve the issue:
Change:
function gblist($gb_filename){...}
into
function gblist($gb_filename = "guestbook"){...}
Anyways, many thanks for your great cms!
Christian
many thanks for your fast reply!
First of all I could have avoided the failure by reading your manual:
If you call
<h1>Gästebuch</h1>
<p>#CMSimple $output.=twocents('guestbook');#</p>
the plugin works in php 7. This is also true for an other very old plugin:
<p>#CMSimple $output.= GBlist('guestbook');#</p> (returns a lot different error due to missing php functions, though)
It seems the big difference in php 7 is it's intolerance to missing function input parameters even though they may be validated later in the code.
So e.g. this works in php 5:
<p>#CMSimple $output.=twocents();#</p> because 'guestbook' is set in the code as a default. But it does not work in php 7.
In php 7 this would also solve the issue:
Change:
function gblist($gb_filename){...}
into
function gblist($gb_filename = "guestbook"){...}
Anyways, many thanks for your great cms!
Christian
Re: php 7 + cms 1.6.9 + Twocents 1.0beta2 (and other modules?) not working
It is because missing argument raise an exception instead of a warning as of PHP 7.1.0. I still think that this shouldn't have been changed in a minor version, but well.chrinux wrote:It seems the big difference in php 7 is it's intolerance to missing function input parameters even though they may be validated later in the code.
You're welcome! It's not my CMS, though.chrinux wrote:Anyways, many thanks for your great cms!
Christoph M. Becker – Plugins for CMSimple_XH
Re: php 7 + cms 1.6.9 + Twocents 1.0beta2 (and other modules?) not working
I finally had a closer look at this issue. Indeed, it is not a bug in Twocents_XH, since the $topicname parameter is mandatory.
However, I wonder whether we should handle this case generally in the core of CMSimple_XH. We already took countermeasures regarding the changed handling of parse errors in eval'd code. OTOH, a missing argument in a function call from within the template will also result in a fatal PHP error.
I presume that switching to PHP 7.1 will break a lot of CMSimple(_XH) sites.
However, I wonder whether we should handle this case generally in the core of CMSimple_XH. We already took countermeasures regarding the changed handling of parse errors in eval'd code. OTOH, a missing argument in a function call from within the template will also result in a fatal PHP error.
I presume that switching to PHP 7.1 will break a lot of CMSimple(_XH) sites.
Christoph M. Becker – Plugins for CMSimple_XH