Following Error : New PHP
Posted: Thu Mar 06, 2025 7:37 am
Hello, I have the following error :
Fatal error: Uncaught Error: Call to undefined function each() in /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/MenuManager.module.php:111 Stack trace: #0 /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/action.default.php(183): MenuManager->GetChildNodes(Object(cms_content_tree), Array, Object(CmsApp), 1, 0, Array, 1, Array, 1) #1 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/classes/class.CMSModule.php(1407): include('/home/httpd/vho...') #2 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/classes/class.CMSModule.php(1483): CMSModule->DoAction('default', 'm87d21', Array, '15') #3 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/functions/module.functions.php(106): CMSModule->DoActionBase('default', 'm87d21', Array, '15', Object(CMS_Smarty_Template)) #4 /home/httpd/vhosts/haldi.ch/httpdocs/cms/assets/plugins/function.menu.php(22): cms_module_plugin(Array, Object(CMS_Smarty_Template)) #5 /home/httpd/vhosts/haldi.ch/httpdocs/cms/tmp/templates_c/d99cf3aa25268e7ae5585236412acde3dfbfebc9_0.tpl_body.10.php(49): smarty_cms_function_menu(Array, Object(CMS_Smarty_Template)) #6 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_template_resource_base.php(123): content_6740b431596ce2_39799855(Object(CMS_Smarty_Template)) #7 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(CMS_Smarty_Template)) #8 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(CMS_Smarty_Template)) #9 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render(false, 0) #10 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute(Object(CMS_Smarty_Template), 'p15', NULL, NULL, 0) #11 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/classes/internal/class.CMS_Smarty_Template.php(20): Smarty_Internal_TemplateBase->fetch(NULL, 'p15', NULL, NULL) #12 /home/httpd/vhosts/haldi.ch/httpdocs/cms/index.php(160): CMS_Smarty_Template->fetch() #13 {main} thrown in /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/MenuManager.module.php on line 111
GPT : tell me that I encounter (Call to undefined function each()) indicates that the PHP function each() is used in the code, but it has been removed as of PHP 7.2.
I changed in MenuManager.module.php Line 111 from each() to foreach() but didn't help. Now I get this error:
Parse error: syntax error, unexpected token "foreach" in /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/MenuManager.module.php on line 111
Solution from GPT.
I'm not a guru in PHP. could some body help me ?
Fatal error: Uncaught Error: Call to undefined function each() in /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/MenuManager.module.php:111 Stack trace: #0 /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/action.default.php(183): MenuManager->GetChildNodes(Object(cms_content_tree), Array, Object(CmsApp), 1, 0, Array, 1, Array, 1) #1 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/classes/class.CMSModule.php(1407): include('/home/httpd/vho...') #2 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/classes/class.CMSModule.php(1483): CMSModule->DoAction('default', 'm87d21', Array, '15') #3 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/functions/module.functions.php(106): CMSModule->DoActionBase('default', 'm87d21', Array, '15', Object(CMS_Smarty_Template)) #4 /home/httpd/vhosts/haldi.ch/httpdocs/cms/assets/plugins/function.menu.php(22): cms_module_plugin(Array, Object(CMS_Smarty_Template)) #5 /home/httpd/vhosts/haldi.ch/httpdocs/cms/tmp/templates_c/d99cf3aa25268e7ae5585236412acde3dfbfebc9_0.tpl_body.10.php(49): smarty_cms_function_menu(Array, Object(CMS_Smarty_Template)) #6 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_template_resource_base.php(123): content_6740b431596ce2_39799855(Object(CMS_Smarty_Template)) #7 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_template_compiled.php(114): Smarty_Template_Resource_Base->getRenderedTemplateCode(Object(CMS_Smarty_Template)) #8 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_internal_template.php(217): Smarty_Template_Compiled->render(Object(CMS_Smarty_Template)) #9 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_internal_templatebase.php(238): Smarty_Internal_Template->render(false, 0) #10 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/smarty/sysplugins/smarty_internal_templatebase.php(116): Smarty_Internal_TemplateBase->_execute(Object(CMS_Smarty_Template), 'p15', NULL, NULL, 0) #11 /home/httpd/vhosts/haldi.ch/httpdocs/cms/lib/classes/internal/class.CMS_Smarty_Template.php(20): Smarty_Internal_TemplateBase->fetch(NULL, 'p15', NULL, NULL) #12 /home/httpd/vhosts/haldi.ch/httpdocs/cms/index.php(160): CMS_Smarty_Template->fetch() #13 {main} thrown in /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/MenuManager.module.php on line 111
GPT : tell me that I encounter (Call to undefined function each()) indicates that the PHP function each() is used in the code, but it has been removed as of PHP 7.2.
I changed in MenuManager.module.php Line 111 from each() to foreach() but didn't help. Now I get this error:
Parse error: syntax error, unexpected token "foreach" in /home/httpd/vhosts/haldi.ch/httpdocs/cms/modules/MenuManager/MenuManager.module.php on line 111
Solution from GPT.
I'm not a guru in PHP. could some body help me ?