Skip to content

Commit 661c0ac

Browse files
committed
Remove support for EBCDIC
Closes GH-5390.
1 parent 58f9c40 commit 661c0ac

File tree

3 files changed

+4
-31
lines changed

3 files changed

+4
-31
lines changed

UPGRADING

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -601,6 +601,9 @@ PHP 8.0 UPGRADE NOTES
601601
13. Other Changes
602602
========================================
603603

604+
- EBCDIC targets are no longer supported, though it's unlikely that they were
605+
still working in the first place.
606+
604607
========================================
605608
14. Performance Improvements
606609
========================================

build/php.m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ int main(void) {
13841384
ac_cv_ebcdic=no
13851385
])])
13861386
if test "$ac_cv_ebcdic" = "yes"; then
1387-
AC_DEFINE(CHARSET_EBCDIC,1, [Define if system uses EBCDIC])
1387+
AC_MSG_ERROR([PHP does not support EBCDIC targets])
13881388
fi
13891389
])
13901390

ext/standard/url.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,6 @@
2323

2424
#include "url.h"
2525
#include "file.h"
26-
#ifdef _OSD_POSIX
27-
# ifndef CHARSET_EBCDIC
28-
# define CHARSET_EBCDIC /* this machine uses EBCDIC, not ASCII! */
29-
# endif
30-
# include "ebcdic.h"
31-
#endif /*_OSD_POSIX*/
3226

3327
/* {{{ free_url
3428
*/
@@ -469,7 +463,6 @@ PHPAPI zend_string *php_url_encode(char const *s, size_t len)
469463

470464
if (c == ' ') {
471465
*to++ = '+';
472-
#ifndef CHARSET_EBCDIC
473466
} else if ((c < '0' && c != '-' && c != '.') ||
474467
(c < 'A' && c > '9') ||
475468
(c > 'Z' && c < 'a' && c != '_') ||
@@ -478,14 +471,6 @@ PHPAPI zend_string *php_url_encode(char const *s, size_t len)
478471
to[1] = hexchars[c >> 4];
479472
to[2] = hexchars[c & 15];
480473
to += 3;
481-
#else /*CHARSET_EBCDIC*/
482-
} else if (!isalnum(c) && strchr("_-.", c) == NULL) {
483-
/* Allow only alphanumeric chars and '_', '-', '.'; escape the rest */
484-
to[0] = '%';
485-
to[1] = hexchars[os_toascii[c] >> 4];
486-
to[2] = hexchars[os_toascii[c] & 15];
487-
to += 3;
488-
#endif /*CHARSET_EBCDIC*/
489474
} else {
490475
*to++ = c;
491476
}
@@ -542,11 +527,7 @@ PHPAPI size_t php_url_decode(char *str, size_t len)
542527
}
543528
else if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1))
544529
&& isxdigit((int) *(data + 2))) {
545-
#ifndef CHARSET_EBCDIC
546530
*dest = (char) php_htoi(data + 1);
547-
#else
548-
*dest = os_toebcdic[(unsigned char) php_htoi(data + 1)];
549-
#endif
550531
data += 2;
551532
len -= 2;
552533
} else {
@@ -574,20 +555,13 @@ PHPAPI zend_string *php_raw_url_encode(char const *s, size_t len)
574555
char c = s[x];
575556

576557
ret[y] = c;
577-
#ifndef CHARSET_EBCDIC
578558
if ((c < '0' && c != '-' && c != '.') ||
579559
(c < 'A' && c > '9') ||
580560
(c > 'Z' && c < 'a' && c != '_') ||
581561
(c > 'z' && c != '~')) {
582562
ret[y++] = '%';
583563
ret[y++] = hexchars[(unsigned char) c >> 4];
584564
ret[y] = hexchars[(unsigned char) c & 15];
585-
#else /*CHARSET_EBCDIC*/
586-
if (!isalnum(c) && strchr("_-.~", c) != NULL) {
587-
ret[y++] = '%';
588-
ret[y++] = hexchars[os_toascii[(unsigned char) c] >> 4];
589-
ret[y] = hexchars[os_toascii[(unsigned char) c] & 15];
590-
#endif /*CHARSET_EBCDIC*/
591565
}
592566
}
593567
ret[y] = '\0';
@@ -638,11 +612,7 @@ PHPAPI size_t php_raw_url_decode(char *str, size_t len)
638612
while (len--) {
639613
if (*data == '%' && len >= 2 && isxdigit((int) *(data + 1))
640614
&& isxdigit((int) *(data + 2))) {
641-
#ifndef CHARSET_EBCDIC
642615
*dest = (char) php_htoi(data + 1);
643-
#else
644-
*dest = os_toebcdic[(unsigned char) php_htoi(data + 1)];
645-
#endif
646616
data += 2;
647617
len -= 2;
648618
} else {

0 commit comments

Comments
 (0)