Magento – Magento 2.3 Web Setup Wizard Fatal Error compact()

magento2.3

Im working on a fresh install of Magento 2.3 and wanting to install an extension from market place.

When I try to do it via the web setup wizard I just get this error:

Fatal error: Uncaught Exception: Notice: compact(): Undefined
variable: extras in
/home/darkpeak/public_html/vendor/zendframework/zend-view/src/Helper/HeadLink.php
on line 413 in
/home/darkpeak/public_html/vendor/magento/framework/App/ErrorHandler.php:61
Stack trace: #0 [internal function]:
Magento\Framework\App\ErrorHandler->handler(8, 'compact(): Unde…',
'/home/darkpeak/…', 413, Array) #1
/home/darkpeak/public_html/vendor/zendframework/zend-view/src/Helper/HeadLink.php(413):
compact('rel', 'type', 'href', 'media', 'conditionalStyl…',
'extras') #2
/home/darkpeak/public_html/vendor/zendframework/zend-view/src/Helper/HeadLink.php(178):
Zend\View\Helper\HeadLink->createDataStylesheet(Array) #3
/home/darkpeak/public_html/setup/view/layout/layout.phtml(16):
Zend\View\Helper\HeadLink->__call('appendStyleshee…', Array) #4
/home/darkpeak/public_html/vendor/zendframework/zend-view/src/Renderer/PhpRenderer.php(506):
include('/home/darkpeak/…') #5
/home/darkpeak/public_html/vendor/zendframework/zend-view/src/View.php(207)
in
/home/darkpeak/public_html/vendor/magento/framework/App/ErrorHandler.php
on line 61

Can anyone help?

Best Answer

Currently Magento 2.3 does not support 7.3, and 7.3 is in its early release so it might have an issue, to solve this problem you can use the following workaround for now(Need to remove in next release or updates)

Replace this:

$attributes = compact('rel', 'type', 'href', 'media', 'conditionalStylesheet', 'extras');

With this:

$attributes = array('rel' => $rel, 'type' => $type, 'href' => $href, 'media' => $media, 'conditionalStylesheet' => $conditionalStylesheet, 'extras' => isset($extras)? $extras: '');

As per PHP document compact is now returning an error if the variable is undefined, here an $extra is undefined, compact() is a function in PHP that creates an array of values from a list of variable names. If an undefined variable is specified, the resulting array will not contain an index for that variable. This could cause some unexpected behavior due to missing indexes and some scenarios that are difficult to debug.

Starting in PHP 7.3, a notice will be triggered when an undefined variable is passed to compact() to help with identify such situations.

For more detail on this check this

Related Topic