note 90993 added to function.defined

From: Date: Wed, 20 May 2009 00:23:06 +0000
Subject: note 90993 added to function.defined
Groups: php.notes 
Request: Send a blank email to php-notes+get-155767@lists.php.net to get a copy of this message
You'd expect to be able to pass anything into defined(), and that it would just return TRUE or FALSE depending on whether the input is a valid constant. You'd be wrong. Invoking defined('::') will throw a fatal, unrecoverable error. This will happen for any string which contains '::' prefixed by an invalid class name. GO PHP! You've created a function designed to make a validating statement about its input, but which cannot be invoked safely without validating its input beforehand. ---- Server IP: 66.207.199.35 Probable Submitter: 66.119.178.158 ---- Manual Page -- http://www.php.net/manual/en/function.defined.php Edit -- https://master.php.net/note/edit/90993 Del: integrated -- https://master.php.net/note/delete/90993/integrated Del: useless -- https://master.php.net/note/delete/90993/useless Del: bad code -- https://master.php.net/note/delete/90993/bad+code Del: spam -- https://master.php.net/note/delete/90993/spam Del: non-english -- https://master.php.net/note/delete/90993/non-english Del: in docs -- https://master.php.net/note/delete/90993/in+docs Del: other reasons-- https://master.php.net/note/delete/90993 Reject -- https://master.php.net/note/reject/90993 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#155767) next »