Skip to content

Return value type error #87

Closed
Closed

Description

Description

When the entry form is not filled correctly I get an error page instead of the error list.
I rebuild a simplified version and still get the same error.
It was working fine a few months ago.

This is my simplified code

{# Macro to help output errors: #}
{% macro errorList(errors) %}
	 {% if errors %}
		  {{ ul(errors, { class: 'errors' }) }}
	 {% endif %}
{% endmacro %}

{# Default value for the `entry` variable: #}
{% set guestEntry = guestEntry ?? null %}

<form method="post" action="" accept-charset="UTF-8">
	 {# Hidden inputs required for the form to work: #}
	 {{ csrfInput() }}
	 {{ actionInput('guest-entries/save') }}
	 {% set path = craft.app.request.fullUri %}
	 {{ redirectInput('/' ~ path) }}
	 {{ hiddenInput('sectionHandle', 'entrants') }}

	 {# Entry properties and custom fields: #}
	 <label for="title">Name</label>
	 {{ input('text', 'title', guestEntry ? guestEntry.title, { id: 'title' }) }}
	 {{ guestEntry ? _self.errorList(guestEntry.getErrors('title')) }}

	 <label for="email">Email</label>
	 {{ input('email', 'fields[email]', guestEntry ? guestEntry.email, { id: 'email' }) }}
	 {{ guestEntry ? _self.errorList(guestEntry.getErrors('email')) }}

	 <input id="privacy" type="hidden" name="fields[plainText]" value="1">

	 <button type="submit">Publish</button>
</form>

And this is the error

TypeError: craft\guestentries\controllers\SaveController::_returnError(): Return value must be of type yii\web\Response, null returned in /var/www/html/vendor/craftcms/guest-entries/src/controllers/SaveController.php:192
Stack trace:
#0 /var/www/html/vendor/craftcms/guest-entries/src/controllers/SaveController.php(142): craft\guestentries\controllers\SaveController->_returnError(Object(craft\guestentries\models\Settings), Object(craft\elements\Entry))
#1 [internal function]: craft\guestentries\controllers\SaveController->actionIndex()
#2 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#4 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('', Array)
#5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(341): yii\base\Module->runAction('guest-entries/s...', Array)
#6 /var/www/html/vendor/craftcms/cms/src/web/Application.php(642): craft\web\Application->runAction('guest-entries/s...', Array)
#7 /var/www/html/vendor/craftcms/cms/src/web/Application.php(303): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#8 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#9 /var/www/html/web/index.php(26): yii\base\Application->run()
#10 {main}

Additional info

  • Craft version: 4.8.9
  • PHP version: 8.0.30
  • Database driver & version: MariaDB 10.3.39
  • Plugins & versions: Guest Entries 4.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions