note 106188 deleted from function.htmlspecialchars by cmb

From: Date: Sun, 27 Oct 2019 09:10:28 +0000
Subject: note 106188 deleted from function.htmlspecialchars by cmb
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-212831@lists.php.net to get a copy of this message
Note Submitter: steve at mcdragonsoftware dot com ---- 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

« previous php.notes (#212831) next »