---
title: "Required Fields"
url: https://daily.dev/posts/required-fields-n558lku4t
source_url: https://thedailywtf.com/articles/required-fields
type: article
source: "The Daily WTF"
published: 2026-06-16T11:39:15.070Z
updated: 2026-06-16T14:20:52.004Z
tags: ["php"]
reading_time: 2
upvotes: 0
comments: 1
language: en
---

> ## Documentation Index
> Fetch the complete documentation index at: https://daily.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Required Fields

**[The Daily WTF](https://daily.dev/sources/thedailywtf)** · 2 min read · 0 upvotes · 1 comments

## Summary

A PHP function that connects to an external system uses optional parameters with default empty strings for credentials, then throws exceptions if they're empty — making required fields syntactically optional. Worse, the error message for a missing password incorrectly says 'username is required', making debugging needlessly confusing. A classic example of misleading API ergonomics and copy-paste error message bugs.

## Full article

daily.dev links to this article rather than hosting it. Read it at the original source: <https://thedailywtf.com/articles/required-fields>

## Community discussion

Top comments from developers on daily.dev.

**@randy** · 1 upvotes

> Man... I got a form yesterday.
>
> - "Do/have you blah blah blah? *"
> - "If 'other' please explain... *"
>
> Like, wait, the normally optional "other, please explain" fields are _required_?! Huh?! And they did it like 3 or 4 times. Also, the site is connected with US Government, so... Maybe story checks out.

## Similar posts on daily.dev

- [Building multi-step login forms that work well with password managers](https://daily.dev/posts/building-multi-step-login-forms-that-work-well-with-password-managers-95oy1gg1f) · Lobsters · 3 upvotes · 0 comments
- [Two-faced](https://daily.dev/posts/two-faced-zmgryihop) · The Daily WTF · 0 upvotes · 0 comments

---

Tags: [#php](https://daily.dev/tags/php)

[View this post on daily.dev](https://daily.dev/posts/required-fields-n558lku4t)
