Patch bug53199.patch for PHAR related Bug #53199
Patch version 2010-11-18 07:47 UTC
Return to Bug #53199 |
Download this patch
Patch Revisions:
Developer: cataphract@php.net
Index: Zend/zend_multibyte.c
===================================================================
--- Zend/zend_multibyte.c (revision 305485)
+++ Zend/zend_multibyte.c (working copy)
@@ -1128,7 +1128,25 @@
const unsigned char *p;
int wchar_size = 2;
int le = 0;
+ const unsigned char halt_upper[] = "__HALT_COMPILER();",
+ halt_lower[] = "__halt_compiler();";
+ int position = 0;
+ p = script;
+ while ((p-script) < script) {
+ if (*p == halt_upper[position] || *p == halt_lower[position]) {
+ position++;
+ } else {
+ position = 0;
+ }
+ if (position == sizeof(halt_upper) - 1) {
+ /* assume it's not UTF-16, UTF-32. To be thorough, we'd have to look for __halt_compiler(); in
+ * UTF-16 and 32, BE and LE and compare the offsets, but let's say this is a fair trade off */
+ return NULL;
+ }
+ p++;
+ }
+
/* utf-16 or utf-32? */
p = script;
while ((p-script) < script_size) {
|