You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When saving any element that is supposed to have an URL which uses a Site that does not have a base URL, the following exception is thrown: TypeError: Return value of craft\models\Site::getBaseUrl() must be of the type string, null returned
Steps to reproduce
Have a Craft 3.1 install with more than one Site
Edit any of the Sites in CP settings and untick the This site has its own base URL, so that it does not have a base URL.
Create a new Section and fill out the Entry URI format and Template for the Site that you unticked the base URL setting for.
Go and create a new Entry for that Section and you should be presented with the following error:
An Error occurred while handling another error:
TypeError: Return value of craft\models\Site::getBaseUrl() must be of the type string, null returned in /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/models/Site.php:105
Stack trace:
#0 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/helpers/UrlHelper.php(333): craft\models\Site->getBaseUrl()
#1 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/helpers/UrlHelper.php(514): craft\helpers\UrlHelper::baseSiteUrl()
#2 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/helpers/UrlHelper.php(229): craft\helpers\UrlHelper::_createUrl('', '', NULL, false)
#3 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(237): craft\helpers\UrlHelper::siteUrl()
#4 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/web/assets/cp/CpAsset.php(91): craft\web\assets\cp\CpAsset->_craftData()
#5 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/web/View.php(266): craft\web\assets\cp\CpAsset->registerAssetFiles(Object(craft\web\View))
#6 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/web/View.php(1482): yii\web\View->registerAssetFiles('craft\\web\\asset...')
#7 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/web/View.php(264): craft\web\View->registerAssetFiles('craft\\web\\asset...')
#8 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/web/View.php(1482): yii\web\View->registerAssetFiles('Solspace\\Calend...')
#9 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/web/View.php(162): craft\web\View->registerAssetFiles('Solspace\\Calend...')
#10 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/web/View.php(876): yii\web\View->endBody()
#11 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/views/errorHandler/exception.php(526): craft\web\View->endBody()
#12 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/base/View.php(336): require('/Users/gustavs/...')
#13 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/base/View.php(254): yii\base\View->renderPhpFile('/Users/gustavs/...', Array)
#14 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/web/ErrorHandler.php(266): yii\base\View->renderFile('/Users/gustavs/...', Array, Object(craft\web\ErrorHandler))
#15 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/web/ErrorHandler.php(126): yii\web\ErrorHandler->renderFile('@yii/views/erro...', Array)
#16 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/web/ErrorHandler.php(132): yii\web\ErrorHandler->renderException(Object(TypeError))
#17 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/yiisoft/yii2/base/ErrorHandler.php(111): craft\web\ErrorHandler->renderException(Object(TypeError))
#18 /Users/gustavs/dev/php/solspace/installs/craft31/vendor/craftcms/cms/src/web/ErrorHandler.php(63): yii\base\ErrorHandler->handleException(Object(TypeError))
#19 [internal function]: craft\web\ErrorHandler->handleException(Object(TypeError))
#20 {main}
Additional info
Craft version: 3.1.0-beta.7
PHP version: 7.2.12
Database driver & version: mysql-8.0.12
Plugins & versions: Solspace Calendar 2.0.12
The text was updated successfully, but these errors were encountered:
Description
When saving any element that is supposed to have an URL which uses a Site that does not have a base URL, the following exception is thrown:
TypeError: Return value of craft\models\Site::getBaseUrl() must be of the type string, null returned
Steps to reproduce
Site
Sites
in CP settings and untick theThis site has its own base URL
, so that it does not have a base URL.Section
and fill out theEntry URI format
andTemplate
for theSite
that you unticked the base URL setting for.Entry
for thatSection
and you should be presented with the following error:Additional info
The text was updated successfully, but these errors were encountered: