diff options
Diffstat (limited to 'ext/ereg')
| -rw-r--r-- | ext/ereg/config0.m4 | 2 | ||||
| -rw-r--r-- | ext/ereg/regex.patch | 72 | ||||
| -rw-r--r-- | ext/ereg/tests/split_variation_004.phpt | 6 | ||||
| -rw-r--r-- | ext/ereg/tests/spliti_variation_004.phpt | 6 |
4 files changed, 73 insertions, 13 deletions
diff --git a/ext/ereg/config0.m4 b/ext/ereg/config0.m4 index f4f8190932..caec39d285 100644 --- a/ext/ereg/config0.m4 +++ b/ext/ereg/config0.m4 @@ -5,7 +5,7 @@ dnl dnl Check for regex library type dnl PHP_ARG_WITH(regex,, -[ --with-regex=TYPE regex library type: system, php. [TYPE=php] +[ --with-regex=TYPE Regex library type: system, php. [TYPE=php] WARNING: Do NOT use unless you know what you are doing!], php, no) case $PHP_REGEX in diff --git a/ext/ereg/regex.patch b/ext/ereg/regex.patch new file mode 100644 index 0000000000..864e6bb6d8 --- /dev/null +++ b/ext/ereg/regex.patch @@ -0,0 +1,72 @@ +diff -u regex.orig/regerror.c regex/regerror.c +--- regex.orig/regerror.c 2011-08-09 19:49:30.000000000 +0800 ++++ regex/regerror.c 2011-08-12 10:45:57.000000000 +0800 +@@ -8,6 +8,7 @@ + #include "regex.h" + #include "utils.h" + #include "regerror.ih" ++#include "php.h" + + /* + = #define REG_OKAY 0 +@@ -74,17 +75,19 @@ + char convbuf[50]; + + if (errcode == REG_ATOI) +- s = regatoi(preg, convbuf); ++ s = regatoi(preg, convbuf, sizeof(convbuf)); + else { + for (r = rerrs; r->code >= 0; r++) + if (r->code == target) + break; + + if (errcode®_ITOA) { +- if (r->code >= 0) +- (void) strcpy(convbuf, r->name); +- else +- sprintf(convbuf, "REG_0x%x", target); ++ if (r->code >= 0) { ++ (void) strncpy(convbuf, r->name, sizeof(convbuf) - 1); ++ convbuf[sizeof(convbuf) - 1] = '\0'; ++ } else { ++ snprintf(convbuf, sizeof(convbuf), "REG_0x%x", target); ++ } + assert(strlen(convbuf) < sizeof(convbuf)); + s = convbuf; + } else +@@ -106,12 +109,13 @@ + + /* + - regatoi - internal routine to implement REG_ATOI +- == static char *regatoi(const regex_t *preg, char *localbuf); ++ == static char *regatoi(const regex_t *preg, char *localbuf, int bufsize); + */ + static char * +-regatoi(preg, localbuf) ++regatoi(preg, localbuf, bufsize) + const regex_t *preg; + char *localbuf; ++int bufsize; + { + register const struct rerr *r; + +@@ -121,6 +125,6 @@ + if (r->code < 0) + return("0"); + +- sprintf(localbuf, "%d", r->code); ++ snprintf(localbuf, bufsize, "%d", r->code); + return(localbuf); + } +diff -u regex.orig/regerror.ih regex/regerror.ih +--- regex.orig/regerror.ih 2011-08-09 19:49:00.000000000 +0800 ++++ regex/regerror.ih 2011-08-09 19:41:07.000000000 +0800 +@@ -4,7 +4,7 @@ + #endif + + /* === regerror.c === */ +-static char *regatoi(const regex_t *preg, char *localbuf); ++static char *regatoi(const regex_t *preg, char *localbuf, int bufsize); + + #ifdef __cplusplus + } diff --git a/ext/ereg/tests/split_variation_004.phpt b/ext/ereg/tests/split_variation_004.phpt index 1fa71edd38..d3d2de84a3 100644 --- a/ext/ereg/tests/split_variation_004.phpt +++ b/ext/ereg/tests/split_variation_004.phpt @@ -18,7 +18,6 @@ $pattern = '[[:space:]]'; $string = '1 2 3 4 5'; var_dump(split($pattern, $string, 0)); var_dump(split($pattern, $string, -10)); -var_dump(split($pattern, $string, 10E20)); echo "Done"; @@ -35,9 +34,4 @@ array(1) { [0]=> string(9) "1 2 3 4 5" } -Error: 8192 - Function split() is deprecated, %s(18) -array(1) { - [0]=> - string(9) "1 2 3 4 5" -} Done diff --git a/ext/ereg/tests/spliti_variation_004.phpt b/ext/ereg/tests/spliti_variation_004.phpt index b6bf227ba0..d9afa13892 100644 --- a/ext/ereg/tests/spliti_variation_004.phpt +++ b/ext/ereg/tests/spliti_variation_004.phpt @@ -18,7 +18,6 @@ $pattern = '[[:space:]]'; $string = '1 2 3 4 5'; var_dump(spliti($pattern, $string, 0)); var_dump(spliti($pattern, $string, -10)); -var_dump(spliti($pattern, $string, 10E20)); echo "Done"; @@ -35,9 +34,4 @@ array(1) { [0]=> string(9) "1 2 3 4 5" } -Error: 8192 - Function spliti() is deprecated, %s(18) -array(1) { - [0]=> - string(9) "1 2 3 4 5" -} Done |
