]> granicus.if.org Git - php/commitdiff
Remove support for EBCDIC
authorNikita Popov <nikita.ppv@gmail.com>
Wed, 15 Apr 2020 09:51:06 +0000 (11:51 +0200)
committerNikita Popov <nikita.ppv@gmail.com>
Mon, 20 Apr 2020 14:39:39 +0000 (16:39 +0200)
Closes GH-5390.

UPGRADING
build/php.m4
ext/standard/url.c

index d412875c31b099cddd05007be0d373e6b11589a5..b6cc20547143f31c5f5232ac4957eae3ae66daab 100644 (file)
--- a/UPGRADING
+++ b/UPGRADING
@@ -601,6 +601,9 @@ PHP 8.0 UPGRADE NOTES
 13. Other Changes
 ========================================
 
+- EBCDIC targets are no longer supported, though it's unlikely that they were
+  still working in the first place.
+
 ========================================
 14. Performance Improvements
 ========================================
index 8cdfb4da518c108b7071649bf4bba889013b0bc0..c43340315fa4ab60856bee7782bba9deba130399 100644 (file)
@@ -1384,7 +1384,7 @@ int main(void) {
   ac_cv_ebcdic=no
 ])])
   if test "$ac_cv_ebcdic" = "yes"; then
-    AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC])
+    AC_MSG_ERROR([PHP does not support EBCDIC targets])
   fi
 ])
 
index 0d05ec98c1018e95c5c5d51a14b5b53d011e32d3..1b6dbaa6d80422007f4e353fc0448ff343c2e481 100644 (file)
 
 #include "url.h"
 #include "file.h"
-#ifdef _OSD_POSIX
-# ifndef CHARSET_EBCDIC
-#  define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
-# endif
-# include "ebcdic.h"
-#endif /*_OSD_POSIX*/
 
 /* {{{ free_url
  */
@@ -469,7 +463,6 @@ PHPAPI zend_string *php_url_encode(char const *s, size_t len)
 
                if (c == ' ') {
                        *to++ = '+';
-#ifndef CHARSET_EBCDIC
                } else if ((c < '0' && c != '-' && c != '.') ||
                                   (c < 'A' && c > '9') ||
                                   (c > 'Z' && c < 'a' && c != '_') ||
@@ -478,14 +471,6 @@ PHPAPI zend_string *php_url_encode(char const *s, size_t len)
                        to[1] = hexchars[c >> 4];
                        to[2] = hexchars[c & 15];
                        to += 3;
-#else /*CHARSET_EBCDIC*/
-               } else if (!isalnum(c) && strchr("_-.", c) == NULL) {
-                       /* Allow only alphanumeric chars and '_', '-', '.'; escape the rest */
-                       to[0] = '%';
-                       to[1] = hexchars[os_toascii[c] >> 4];
-                       to[2] = hexchars[os_toascii[c] & 15];
-                       to += 3;
-#endif /*CHARSET_EBCDIC*/
                } else {
                        *to++ = c;
                }
@@ -542,11 +527,7 @@ PHPAPI size_t php_url_decode(char *str, size_t len)
                }
                else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1))
                                 && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
                        *dest = (char) php_htoi(data + 1);
-#else
-                       *dest = os_toebcdic[(unsigned char) php_htoi(data + 1)];
-#endif
                        data += 2;
                        len -= 2;
                } else {
@@ -574,7 +555,6 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len)
                char c = s[x];
 
                ret[y] = c;
-#ifndef CHARSET_EBCDIC
                if ((c < '0' && c != '-' &&  c != '.') ||
                        (c < 'A' && c > '9') ||
                        (c > 'Z' && c < 'a' && c != '_') ||
@@ -582,12 +562,6 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len)
                        ret[y++] = '%';
                        ret[y++] = hexchars[(unsigned char) c >> 4];
                        ret[y] = hexchars[(unsigned char) c & 15];
-#else /*CHARSET_EBCDIC*/
-               if (!isalnum(c) && strchr("_-.~", c) != NULL) {
-                       ret[y++] = '%';
-                       ret[y++] = hexchars[os_toascii[(unsigned char) c] >> 4];
-                       ret[y] = hexchars[os_toascii[(unsigned char) c] & 15];
-#endif /*CHARSET_EBCDIC*/
                }
        }
        ret[y] = '\0';
@@ -638,11 +612,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
        while (len--) {
                if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1))
                        && isxdigit((int) *(data + 2))) {
-#ifndef CHARSET_EBCDIC
                        *dest = (char) php_htoi(data + 1);
-#else
-                       *dest = os_toebcdic[(unsigned char) php_htoi(data + 1)];
-#endif
                        data += 2;
                        len -= 2;
                } else {