note 106188 added to function.htmlspecialchars
| From: | steve at mcdragonsoftware dot com | Date: | Tue, 18 Oct 2011 04:13:25 +0000 |
| Subject: | note 106188 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-183943@lists.php.net to get a copy of this message | ||
I am working with xml and zip functions to create an xlsx document from a template. Just as I
thought I had it finished it stopped working. After a bit of hunting I discovered my zip file began
with php notices about undefined constant. I have no idea why my installation can't remember
what ENT_XML1 is, it used to know it (or so I thought)
To save anyone else this headache I recommend adding the code at the top of your scripts to verify
that these constants are registered. Something like:
defined( "ENT_XML1") or define( "ENT_XML1", 16 );
for each constant you use. Again, I don't know why this problem suddenly came up, but better
safe than "Excel cannot open the file....... format... extension... corrupted... blah blah
blah".
cheers :)
here's a list of the constant values (since they are not on this page) as taken from html.h for
php5
#define ENT_HTML_QUOTE_NONE 0
#define ENT_HTML_QUOTE_SINGLE 1
#define ENT_HTML_QUOTE_DOUBLE 2
#define ENT_HTML_IGNORE_ERRORS 4
#define ENT_HTML_SUBSTITUTE_ERRORS 8
#define ENT_HTML_DOC_TYPE_MASK (16|32)
#define ENT_HTML_DOC_HTML401 0
#define ENT_HTML_DOC_XML1 16
#define ENT_HTML_DOC_XHTML 32
#define ENT_HTML_DOC_HTML5 (16|32)
/* reserve bit 6 */
#define ENT_HTML_SUBSTITUTE_DISALLOWED_CHARS 128
#define ENT_COMPAT ENT_HTML_QUOTE_DOUBLE
#define ENT_QUOTES (ENT_HTML_QUOTE_DOUBLE | ENT_HTML_QUOTE_SINGLE)
#define ENT_NOQUOTES ENT_HTML_QUOTE_NONE
#define ENT_IGNORE ENT_HTML_IGNORE_ERRORS
#define ENT_SUBSTITUTE ENT_HTML_SUBSTITUTE_ERRORS
#define ENT_HTML401 0
#define ENT_XML1 16
#define ENT_XHTML 32
#define ENT_HTML5 (16|32)
#define ENT_DISALLOWED 128
----
Server IP: 64.71.164.2
Probable Submitter: 97.123.208.62
----
Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars.php
Edit -- https://master.php.net/note/edit/106188
Del: integrated -- https://master.php.net/note/delete/106188/integrated
Del: useless -- https://master.php.net/note/delete/106188/useless
Del: bad code -- https://master.php.net/note/delete/106188/bad+code
Del: spam -- https://master.php.net/note/delete/106188/spam
Del: non-english -- https://master.php.net/note/delete/106188/non-english
Del: in docs -- https://master.php.net/note/delete/106188/in+docs
Del: other reasons-- https://master.php.net/note/delete/106188
Reject -- https://master.php.net/note/reject/106188
Search -- https://master.php.net/manage/user-notes.php