Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught SmartyException: undefined extension class 'Smarty_Internal_Runtime_GetVariable' #848

Closed
ArchyAzur opened this issue Jan 18, 2023 · 4 comments

Comments

@ArchyAzur
Copy link

Hello,

I get this error when using smarty with my prestashop template :

Fatal error: Uncaught SmartyException: undefined extension class 'Smarty_Internal_Runtime_GetVariable' in /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/vendor/smarty/smarty/libs/sysplugins/smarty_internal_undefined.php:62 Stack trace: #0 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/vendor/smarty/smarty/libs/sysplugins/smarty_internal_extension_handler.php(133): Smarty_Internal_Undefined->__call('_getVariable', Array) #1 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/vendor/smarty/smarty/libs/sysplugins/smarty_internal_data.php(270): Smarty_Internal_Extension_Handler->_callExternalMethod(Object(SmartyDev), '_getVariable', Array) #2 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php(2280): Smarty_Internal_Data->__call('_getVariable', Array) #3 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php(968): APPageBuilder->hookdisplayHeader(Array) #4 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php(407): HookCore::coreCallHook(Object(APPageBuilder), 'hookDisplayHead...', Array) #5 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php(903): HookCore::callHookOn(Object(APPageBuilder), 'displayHeader', Array) #6 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/controller/FrontController.php(562): HookCore::exec('displayHeader') #7 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/controllers/front/PageNotFoundController.php(45): FrontControllerCore->initContent() #8 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/controller/Controller.php(319): PageNotFoundControllerCore->initContent() #9 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Dispatcher.php(503): ControllerCore->run() #10 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/index.php(28): DispatcherCore->dispatch() #11 {main} Next PrestaShop\PrestaShop\Core\Exception\CoreException: undefined extension class 'Smarty_Internal_Runtime_GetVariable' in /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php:420 Stack trace: #0 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php(903): HookCore::callHookOn(Object(APPageBuilder), 'displayHeader', Array) #1 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/controller/FrontController.php(562): HookCore::exec('displayHeader') #2 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/controllers/front/PageNotFoundController.php(45): FrontControllerCore->initContent() #3 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/controller/Controller.php(319): PageNotFoundControllerCore->initContent() #4 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Dispatcher.php(503): ControllerCore->run() #5 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/index.php(28): DispatcherCore->dispatch() #6 {main} thrown in /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php on line 420

I have changed the line code and it's now :

$page = $this->smarty->smarty->_getVariable('page')->value;

But it's still in error ...

It was before :

$page = $this->smarty->smarty->getVariable('page')->value;

I need help please.

Regards,
Vincent

@wisskid
Copy link
Member

wisskid commented Jan 18, 2023

Try getTemplateVars as documented here

@wisskid
Copy link
Member

wisskid commented Jan 18, 2023

Also, it seems that you have one extra ->smarty-> in your code. So, instead of
$page = $this->smarty->smarty->getVariable('page')->value; try
$page = $this->smarty->getTemplateVars('page');

@ArchyAzur
Copy link
Author

ArchyAzur commented Jan 18, 2023

Thx !

It seems working but now I get :

Warning: Undefined property: APPageBuilder::$allow_push in /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php on line 2754

Fatal error: Uncaught TypeError: implode(): Argument #2 ($array) must be of type ?array, string given in /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php:1720 Stack trace: #0 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php(1720): implode(Array, ',') #1 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php(1674): APPageBuilder::getAttributesList(Array) #2 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/shortcodes/ApProductList.php(391): APPageBuilder->getProductsFont(Array) #3 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/shortcodes.php(511): ApProductList->prepareFontContent(Array, Object(APPageBuilder)) #4 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApShortCodesBuilder.php(77): ApShortCodeBase->fontContent(Array, '', 'ApProductList', 1) #5 [internal function]: ApShortCodesBuilder::doShortcodeTag(Array) #6 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApShortCodesBuilder.php(55): preg_replace_callback('/\[(\[?)(ApAcco...', Array, '[ApProductList ...') #7 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/shortcodes.php(384): ApShortCodesBuilder::doShortcode('[ApProductList ...') #8 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApShortCodesBuilder.php(77): ApShortCodeBase->fontContent(Array, '[ApProductList ...', 'ApColumn', 1) #9 [internal function]: ApShortCodesBuilder::doShortcodeTag(Array) #10 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApShortCodesBuilder.php(55): preg_replace_callback('/\[(\[?)(ApAcco...', Array, '[ApColumn form_...') #11 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/shortcodes.php(384): ApShortCodesBuilder::doShortcode('[ApColumn form_...') #12 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApShortCodesBuilder.php(77): ApShortCodeBase->fontContent(Array, '[ApColumn form_...', 'ApRow', 1) #13 [internal function]: ApShortCodesBuilder::doShortcodeTag(Array) #14 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApShortCodesBuilder.php(55): preg_replace_callback('/\[(\[?)(ApAcco...', Array, '[ApRow form_id=...') #15 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApShortCodesBuilder.php(366): ApShortCodesBuilder::doShortcode('[ApRow form_id=...') #16 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/classes/ApPageBuilderModel.php(171): ApShortCodesBuilder->parse('[ApRow form_id=...') #17 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php(2587): ApPageBuilderModel->parseData('displayHome', '[ApRow form_id=...', Array) #18 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php(2560): APPageBuilder->getWidgetVariables('displayHome', NULL) #19 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php(979): APPageBuilder->renderWidget('displayHome', Array) #20 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Hook.php(923): HookCore::coreRenderWidget(Object(APPageBuilder), 'displayHome', Array) #21 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/controllers/front/IndexController.php(40): HookCore::exec('displayHome') #22 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/controller/Controller.php(319): IndexControllerCore->initContent() #23 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/classes/Dispatcher.php(503): ControllerCore->run() #24 /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/index.php(28): DispatcherCore->dispatch() #25 {main} thrown in /homepages/35/d948128591/htdocs/PrestaShop/Megasocial/modules/appagebuilder/appagebuilder.php on line 1720

But it's not a smarty problem :o.

The line is : WHERE pa.id_product IN (' . implode(array_map('intval', $products_id), ',') . ')

@wisskid
Copy link
Member

wisskid commented Jan 18, 2023

Correct. 🤓 Closing this.

@wisskid wisskid closed this as not planned Won't fix, can't repro, duplicate, stale Jan 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants