From f4b831c61cac25db5250db4b5421a5cdf3933ef0 Mon Sep 17 00:00:00 2001 From: Michael Wallner Date: Wed, 7 Sep 2005 15:56:03 +0000 Subject: [PATCH] - fix PHP4 build in http_error_ex() - improve/fix debug builds on win32 - no specialities need for libmagic on win32 any more --- KnownIssues.txt | 7 ------- config.w32 | 9 ++++++--- http_api.c | 14 +++----------- php_http_std_defs.h | 2 ++ 4 files changed, 11 insertions(+), 21 deletions(-) diff --git a/KnownIssues.txt b/KnownIssues.txt index 87c6db4..e448c97 100644 --- a/KnownIssues.txt +++ b/KnownIssues.txt @@ -4,10 +4,3 @@ $Id$ HttpResponse class is only available for PHP >= 5.1 -HttpResponse::guessContentType() is not available on Windows at the time this -was written, unless you compile PHP or ext/http yourself[1]. Additionally -you'll need to fix the magic.mime file that's shipped with PHP by executing -`sed -e "s/\t!/\\\!/" magic.mime > magic.good` and then of course use the new -magic file. - -[1] Fetch http://dev.iworks.at/PATCHES/fileinfo/fileinfo-win32build.zip (84k) diff --git a/config.w32 b/config.w32 index a537fb9..303af9f 100644 --- a/config.w32 +++ b/config.w32 @@ -18,15 +18,18 @@ if (PHP_HTTP != "no") { ADD_SOURCES(configure_module_dirname + "/phpstr", "phpstr.c", "http"); AC_DEFINE("HAVE_HTTP", 1, "Have extended HTTP support"); + MHASH_LIB = PHP_DEBUG != "no" ? "libmhash-staticd.lib":"libmhash-static.lib"; if (CHECK_HEADER_ADD_INCLUDE('mhash.h', 'CFLAGS_HTTP') && - CHECK_LIB('libmhash.lib', 'http', PHP_HTTP)) { + (CHECK_LIB(MHASH_LIB, 'http', PHP_HTTP) || + CHECK_LIB('libmhash.lib', 'http', PHP_HTTP))) { AC_DEFINE('HTTP_HAVE_MHASH', 1 , "Have mhash library"); } else { WARNING("mhash etag generator not enabled; libraries and headers not found"); } + CURL_LIB = PHP_DEBUG != "no" ? "libcurld.lib":"libcurl.lib"; if (CHECK_HEADER_ADD_INCLUDE("curl/curl.h", "CFLAGS_HTTP") && - CHECK_LIB("libcurl.lib", "http", PHP_HTTP) && + CHECK_LIB(CURL_LIB, "http", PHP_HTTP) && CHECK_LIB("ssleay32.lib", "http", PHP_HTTP) && CHECK_LIB("libeay32.lib", "http", PHP_HTTP) && CHECK_LIB("zlib.lib", "http", PHP_HTTP) && @@ -39,10 +42,10 @@ if (PHP_HTTP != "no") { } MAGIC_LIB = PHP_DEBUG != "no" ? "libmagic-staticd.lib":"libmagic-static.lib"; - if (CHECK_HEADER_ADD_INCLUDE("magic.h", "CFLAGS_HTTP") && CHECK_LIB(MAGIC_LIB, "http", PHP_HTTP)) { AC_DEFINE("HTTP_HAVE_MAGIC", 1, "Have magic library"); + AC_DEFINE("USE_MAGIC_STATIC", "", ""); } else { WARNING("content type guessing not enabled; libraries and headers not found"); } diff --git a/http_api.c b/http_api.c index 4e6942a..cbc5a60 100644 --- a/http_api.c +++ b/http_api.c @@ -37,7 +37,7 @@ #include #ifdef HTTP_HAVE_MAGIC -# if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) +# if defined(PHP_WIN32) && !defined(USE_MAGIC_DLL) && !defined(USE_MAGIC_STATIC) # define USE_MAGIC_STATIC # endif # include @@ -167,19 +167,11 @@ STATUS _http_parse_key_list(const char *list, HashTable *items, char separator, void _http_error_ex(long type, long code, const char *format, ...) { va_list args; - zend_bool throw_exception = 0; TSRMLS_FETCH(); - - if (type == E_THROW) { - throw_exception = 1; - type = E_WARNING; - } else if (PG(error_handling) == EH_THROW) { - throw_exception = 1; - } - + va_start(args, format); #ifdef ZEND_ENGINE_2 - if (throw_exception) { + if ((type == E_THROW) || (PG(error_handling) == EH_THROW)) { char *message; vspprintf(&message, 0, format, args); diff --git a/php_http_std_defs.h b/php_http_std_defs.h index cfb9cee..abe8777 100644 --- a/php_http_std_defs.h +++ b/php_http_std_defs.h @@ -273,10 +273,12 @@ typedef int STATUS; #endif #define HE_THROW E_THROW #ifdef ZEND_ENGINE_2 +# define HE_THROE E_THROW # define HE_NOTICE (HTTP_G(only_exceptions) ? E_THROW : E_NOTICE) # define HE_WARNING (HTTP_G(only_exceptions) ? E_THROW : E_WARNING) # define HE_ERROR (HTTP_G(only_exceptions) ? E_THROW : E_ERROR) #else +# define HE_THROW E_WARNING # define HE_NOTICE E_NOTICE # define HE_WARNING E_WARNING # define HE_ERROR E_ERROR -- 2.30.2