diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c index 85dc892ca4..3ef89196de 100644 --- a/ext/pdo_pgsql/pgsql_statement.c +++ b/ext/pdo_pgsql/pgsql_statement.c @@ -587,7 +587,7 @@ static int pgsql_stmt_get_column_meta(pdo_stmt_t *stmt, long colno, zval *return add_assoc_long(return_value, "pgsql:oid", S->cols[colno].pgsql_type); /* Fetch metadata from Postgres system catalogue */ - spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%ud", S->cols[colno].pgsql_type); + spprintf(&q, 0, "SELECT TYPNAME FROM PG_TYPE WHERE OID=%u", S->cols[colno].pgsql_type); res = PQexec(S->H->server, q); efree(q); diff --git a/ext/spl/tests/SplFileObject_rewind_error001.phpt b/ext/spl/tests/SplFileObject_rewind_error001.phpt index bdb3301e63..ac536a0a44 100644 --- a/ext/spl/tests/SplFileObject_rewind_error001.phpt +++ b/ext/spl/tests/SplFileObject_rewind_error001.phpt @@ -13,6 +13,10 @@ $fo = new SplFileObject('testdata.csv'); $fo->rewind( "invalid" ); +?> +--CLEAN-- + --EXPECTF-- Warning: SplFileObject::rewind() expects exactly 0 parameters, 1 given in %s on line %d diff --git a/ext/standard/config.m4 b/ext/standard/config.m4 index fba423b191..2af2209f2b 100644 --- a/ext/standard/config.m4 +++ b/ext/standard/config.m4 @@ -358,7 +358,29 @@ else AC_MSG_RESULT(no) fi -if test "$PHP_SAPI" = "cgi" || test "$PHP_SAPI" = "cli" || test "$PHP_SAPI" = "embed"; then +PHP_ENABLE_CHROOT_FUNC=no +case "$PHP_SAPI" in + embed) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + none) + for PROG in $PHP_BINARIES; do + case "$PROG" in + cgi|cli) + PHP_ENABLE_CHROOT_FUNC=yes + ;; + + *) + PHP_ENABLE_CHROOT_FUNC=no + break + ;; + esac + done + ;; +esac + +if test "$PHP_ENABLE_CHROOT_FUNC" = "yes"; then AC_DEFINE(ENABLE_CHROOT_FUNC, 1, [Whether to enable chroot() function]) fi diff --git a/ext/xml/tests/bug65236.phpt b/ext/xml/tests/bug65236.phpt new file mode 100644 index 0000000000..67b26d663f --- /dev/null +++ b/ext/xml/tests/bug65236.phpt @@ -0,0 +1,15 @@ +--TEST-- +Bug #65236 (heap corruption in xml parser) +--SKIPIF-- + +--FILE-- +", 1000), $a); + +echo "Done\n"; +?> +--EXPECTF-- +Warning: xml_parse_into_struct(): Maximum depth exceeded - Results truncated in %s on line %d +Done diff --git a/main/streams/streams.c b/main/streams/streams.c index 623aabff60..823b8859bf 100644 --- a/main/streams/streams.c +++ b/main/streams/streams.c @@ -2289,6 +2289,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ } else { if(vector_size*2 < vector_size) { /* overflow */ + php_stream_closedir(stream); efree(vector); return FAILURE; } @@ -2302,6 +2303,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ nfiles++; if(vector_size < 10 || nfiles == 0) { /* overflow */ + php_stream_closedir(stream); efree(vector); return FAILURE; } @@ -2310,7 +2312,7 @@ PHPAPI int _php_stream_scandir(char *dirname, char **namelist[], int flags, php_ *namelist = vector; - if (compare) { + if (nfiles > 0 && compare) { qsort(*namelist, nfiles, sizeof(char *), (int(*)(const void *, const void *))compare); } return nfiles; diff --git a/win32/time.h b/win32/time.h index f841a2b601..d5d86eb1ed 100644 --- a/win32/time.h +++ b/win32/time.h @@ -50,4 +50,6 @@ PHPAPI extern int setitimer(int which, const struct itimerval *value, PHPAPI int nanosleep( const struct timespec * rqtp, struct timespec * rmtp ); +PHPAPI int usleep(unsigned int useconds); + #endif