note 128571 added to reserved.variables.post

From: Date: Thu, 25 May 2023 18:45:34 +0000
Subject: note 128571 added to reserved.variables.post
Groups: php.notes 
Request: Send a blank email to php-notes+get-220526@lists.php.net to get a copy of this message
A word of warning for using the function empty() in conjunction with $_POST requests. "empty()" == true does not always mean that's there is no value in the particular $_POST-variable. For example, if the value "0" (zero) is transmitted, "empty()" will fail as it will report "true", though the var is not empty. So always use "isset()" to test if a var is set and then maybe something like a comparison against an empty string: if (isset($var) && ($var != "")) { .... } For more background, see here: https://www.tonmann.com/2021/12/12/a-reminder-to-myself-do-not-use-empty-in-php-in-conjunction-with-post-requests/ ---- Server IP: 45.112.84.4 Probable Submitter: 80.90.13.130 (proxied: 91.21.127.72) ---- Manual Page -- https://php.net/manual/en/reserved.variables.post.php Edit -- https://main.php.net/note/edit/128571 Del: integrated -- https://main.php.net/note/delete/128571/integrated Del: useless -- https://main.php.net/note/delete/128571/useless Del: bad code -- https://main.php.net/note/delete/128571/bad+code Del: spam -- https://main.php.net/note/delete/128571/spam Del: non-english -- https://main.php.net/note/delete/128571/non-english Del: in docs -- https://main.php.net/note/delete/128571/in+docs Del: other reasons-- https://main.php.net/note/delete/128571 Reject -- https://main.php.net/note/reject/128571 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220526) next »