Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

500 error when saving an address book with an empty description

未关闭 适合新手
#308 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
88/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
php, symfony
领域
backend

调研方向

阅读 AddressBookType 中的 description 字段和 src/Entity/AddressBook.php 中的 setDescription 方法;将其与 CalendarInstance::setDescription 进行比较。复现描述为空时的保存操作,并检查现有的通讯录编辑测试。完成标准是保存空描述时不再返回 500 错误。

由索引模型根据 Issue 内容生成。

描述

Version: v5.5.0 (ghcr.io/tchapi/davis-standalone:5.5.0), MariaDB 11.8

Steps to reproduce

  1. In the dashboard, open a user's address book (e.g. the default one) for editing.
  2. Leave Description empty, change Display name.
  3. Click Save.

Expected: the address book is saved.

Actual: "500 Internal Server Error". Log:

request.CRITICAL: Uncaught PHP Exception Symfony\Component\PropertyAccess\Exception\InvalidTypeException: "Expected argument of type "string", "null" given at property path "description"." at PropertyAccessor.php line 198
[previous exception] TypeError: App\Entity\AddressBook::setDescription(): Argument #1 ($description) must be of type string, null given, called in /var/www/davis/vendor/symfony/property-access/PropertyAccessor.php on line 533 at /var/www/davis/src/Entity/AddressBook.php:115

Cause: in AddressBookType the description field is required => false, so an empty textarea is submitted as null, but AddressBook::setDescription(string $description) doesn't accept null. CalendarInstance::setDescription(?string $description) is already nullable, so calendars are not affected. The same signature is still present on main.

Workaround: enter any text in Description.

Possible fix: make the setter nullable (?string) like in CalendarInstance, or add 'empty_data' => '' to the description field in AddressBookType.

主要语言
PHP
星标
756
派生
46
平均合并
2 天 5 小时
30 天内合并 PR
20

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

tchapi/davis 的其他 Issue

查看 tchapi/davis 的全部 Issue

相似的 Issue

更多 PHP Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。