]> granicus.if.org Git - php/commitdiff
MFH
authorMarcus Boerger <helly@php.net>
Thu, 5 Dec 2002 22:15:37 +0000 (22:15 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 5 Dec 2002 22:15:37 +0000 (22:15 +0000)
ext/bcmath/bcmath.c
ext/calendar/easter.c
ext/domxml/php_domxml.c
ext/xml/xml.c
main/SAPI.c
main/main.c

index 556460ccda2a573916c1d00438d949be7c14bd76..2a8b346c8921cab82bba14bee8586518883f7303 100644 (file)
@@ -278,7 +278,7 @@ PHP_FUNCTION(bcdiv)
                        Z_TYPE_P(return_value) = IS_STRING;
                        break;
                case -1: /* division by zero */
-                       php_error(E_WARNING, "%s(): Division by zero", get_active_function_name(TSRMLS_C));
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
                        break;
        }
        bc_free_num(&first);
@@ -319,7 +319,7 @@ PHP_FUNCTION(bcmod)
                        Z_TYPE_P(return_value) = IS_STRING;
                        break;
                case -1:
-                       php_error(E_WARNING, "%s(): Division by zero", get_active_function_name(TSRMLS_C));
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Division by zero");
                        break;
        }
        bc_free_num(&first);
@@ -405,7 +405,7 @@ PHP_FUNCTION(bcsqrt)
                Z_STRLEN_P(return_value) = strlen(Z_STRVAL_P(return_value));
                Z_TYPE_P(return_value) = IS_STRING;
        } else {
-               php_error(E_WARNING, "%s(): Square root of negative number", get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Square root of negative number");
        }
        bc_free_num(&result);
        return;
index e2829f9080ca3a69f2bd2aa78f67e38097f1b6cf..66000681064c781c59e1c4a4a5787e4c2974c559 100644 (file)
@@ -14,7 +14,7 @@
    +----------------------------------------------------------------------+
    | Authors: Shane Caraveo             <shane@caraveo.com>               | 
    |          Colin Viebrock            <colin@easydns.com>               |
-   |          Hartmut Holzgraefe        <hartmut@six.de>                  |
+   |          Hartmut Holzgraefe        <hholzgra@php.net>                |
    +----------------------------------------------------------------------+
  */
 /* $Id: */
@@ -48,7 +48,7 @@ static void _cal_easter(INTERNAL_FUNCTION_PARAMETERS, int gm)
        }
  
        if (gm && (year<1970 || year>2037)) {                           /* out of range for timestamps */
-               php_error(E_WARNING, "%s(): This function is only valid for years between 1970 and 2037 inclusive", get_active_function_name(TSRMLS_C));
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "This function is only valid for years between 1970 and 2037 inclusive");
                RETURN_FALSE;
        }
 
index d6c73d4c98431f0f8ee3a76ee9a96cc7229013a8..7b34bf7d4947a04e349a2b5cefa8b707599f0cee 100644 (file)
@@ -1309,10 +1309,12 @@ static void domxml_error(void *ctx, const char *msg, ...)
 {
        char buf[1024];
        va_list ap;
+       TSRMLS_FETCH();
+
        va_start(ap, msg);
        vsnprintf(buf, 1024, msg, ap);
        va_end(ap);
-       php_error(E_WARNING, buf);
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, buf);
 }
 
 static void domxml_error_ext(void *ctx, const char *msg, ...)
@@ -1321,6 +1323,7 @@ static void domxml_error_ext(void *ctx, const char *msg, ...)
        xmlParserInputPtr input = NULL;
        char buf[1024];
        va_list ap;
+       TSRMLS_FETCH();
 
        va_start(ap, msg);
        vsnprintf(buf, 1024, msg, ap);
@@ -1348,7 +1351,7 @@ static void domxml_error_ext(void *ctx, const char *msg, ...)
                }
                add_next_index_zval(ctxt->_private,errormessages);
        }
-       php_error(E_WARNING, buf);
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, buf);
        
 }
 
@@ -1356,8 +1359,8 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
 {
        domxml_ErrorCtxt *ctxt ;
        char buf[1024];
-
        va_list ap;
+       TSRMLS_FETCH();
 
        va_start(ap, msg);
        vsnprintf(buf, 1024, msg, ap);
@@ -1387,7 +1390,7 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
                
                if (ctxt->valid->node != NULL)
                {
-                       /*php_error(E_WARNING,"nodename %s",(char *) ctxt->valid->name);
+                       /*php_error_docref(NULL TSRMLS_CC, E_WARNING,"nodename %s",(char *) ctxt->valid->name);
 
                        node = *ctxt->node;*/
                }
@@ -1395,7 +1398,7 @@ static void domxml_error_validate(void *ctx, const char *msg, ...)
                add_next_index_zval(ctxt->errors,errormessages);
        }
 
-       php_error(E_WARNING, buf);
+       php_error_docref(NULL TSRMLS_CC, E_WARNING, buf);
        
 }
 
index e30898dcdf61d73a5da1efe01cfcd8ea1b0f6c4e..89c5de7812aeb73dabf23fd435a9755f2b2da0df 100644 (file)
@@ -381,14 +381,14 @@ static zval *xml_call_handler(xml_parser *parser, zval *handler, int argc, zval
                        zval **obj;
 
                        if (Z_TYPE_P(handler) == IS_STRING) {
-                               php_error(E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(handler));
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s()", Z_STRVAL_P(handler));
                        } else if (zend_hash_index_find(Z_ARRVAL_P(handler), 0, (void **) &obj) == SUCCESS &&
                                           zend_hash_index_find(Z_ARRVAL_P(handler), 1, (void **) &method) == SUCCESS &&
                                           Z_TYPE_PP(obj) == IS_OBJECT &&
                                           Z_TYPE_PP(method) == IS_STRING) {
-                               php_error(E_WARNING, "Unable to call handler %s::%s()", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method));
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler %s::%s()", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method));
                        } else 
-                               php_error(E_WARNING, "Unable to call handler");
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to call handler");
 
                        zval_dtor(retval);
                        efree(retval);
@@ -595,7 +595,9 @@ static void _xml_add_to_info(xml_parser *parser,char *name)
                MAKE_STD_ZVAL(values);
                
                if (array_init(values) == FAILURE) {
-                       php_error(E_ERROR, "Unable to initialize array");
+                       TSRMLS_FETCH();
+
+                       php_error_docref(NULL TSRMLS_CC, E_ERROR, "Unable to initialize array");
                        return;
                }
                
@@ -699,7 +701,7 @@ void _xml_startElementHandler(void *userData, const char *name, const char **att
                                zend_hash_add(Z_ARRVAL_P(tag),"attributes",sizeof("attributes"),&atr,sizeof(zval*),NULL);
                        } else {
                                zval_dtor(atr);
-                               efree(atr);
+                               FREE_ZVAL(atr);
                        }
 
                        zend_hash_next_index_insert(Z_ARRVAL_P(parser->data),&tag,sizeof(zval*),(void *) &parser->ctag);
@@ -1008,7 +1010,6 @@ PHP_FUNCTION(xml_parser_create)
        int argc;
        zval **encodingArg;
        XML_Char *encoding;
-       char thisfunc[] = "xml_parser_create";
        
        argc = ZEND_NUM_ARGS();
 
@@ -1031,8 +1032,7 @@ PHP_FUNCTION(xml_parser_create)
                                                Z_STRLEN_PP(encodingArg)) == 0) {
                        encoding = "US-ASCII";
                } else { /* UTF-16 not supported */
-                       php_error(E_WARNING, "%s: unsupported source encoding \"%s\"",
-                                          thisfunc, Z_STRVAL_PP(encodingArg));
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: unsupported source encoding \"%s\"", Z_STRVAL_PP(encodingArg));
                        RETURN_FALSE;
                }
        } else {
@@ -1059,7 +1059,6 @@ PHP_FUNCTION(xml_parser_create_ns)
        int argc;
        zval **encodingArg, **sepArg;
        XML_Char *encoding, *sep;
-       char thisfunc[] = "xml_parser_create";
        
        argc = ZEND_NUM_ARGS();
 
@@ -1082,8 +1081,7 @@ PHP_FUNCTION(xml_parser_create_ns)
                                                Z_STRLEN_PP(encodingArg)) == 0) {
                        encoding = "US-ASCII";
                } else { /* UTF-16 not supported */
-                       php_error(E_WARNING, "%s: unsupported source encoding \"%s\"",
-                                          thisfunc, Z_STRVAL_PP(encodingArg));
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s: unsupported source encoding \"%s\"", Z_STRVAL_PP(encodingArg));
                        RETURN_FALSE;
                }
        } else {
@@ -1122,7 +1120,7 @@ PHP_FUNCTION(xml_set_object)
        }
 
        if (Z_TYPE_PP(mythis) != IS_OBJECT) {
-               php_error(E_WARNING,"arg 2 has wrong type");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Argument 2 has wrong type");
                RETURN_FALSE;
        }
 
@@ -1493,7 +1491,6 @@ PHP_FUNCTION(xml_parser_set_option)
 {
        xml_parser *parser;
        zval **pind, **opt, **val;
-       char thisfunc[] = "xml_parser_set_option";
 
        if (ZEND_NUM_ARGS() != 3 || zend_get_parameters_ex(3, &pind, &opt, &val) == FAILURE) {
                WRONG_PARAM_COUNT;
@@ -1520,15 +1517,14 @@ PHP_FUNCTION(xml_parser_set_option)
                        convert_to_string_ex(val);
                        enc = xml_get_encoding(Z_STRVAL_PP(val));
                        if (enc == NULL) {
-                               php_error(E_WARNING, "%s: unsupported target encoding \"%s\"",
-                                                  thisfunc, Z_STRVAL_PP(val));
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported target encoding \"%s\"", Z_STRVAL_PP(val));
                                RETURN_FALSE;
                        }
                        parser->target_encoding = enc->name;
                        break;
                }
                default:
-                       php_error(E_WARNING, "%s: unknown option", thisfunc);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option");
                        RETURN_FALSE;
                        break;
        }
@@ -1542,7 +1538,6 @@ PHP_FUNCTION(xml_parser_get_option)
 {
        xml_parser *parser;
        zval **pind, **opt;
-       char thisfunc[] = "xml_parser_get_option";
 
        if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &pind, &opt) == FAILURE) {
                WRONG_PARAM_COUNT;
@@ -1559,7 +1554,7 @@ PHP_FUNCTION(xml_parser_get_option)
                        RETURN_STRING(parser->target_encoding, 1);
                        break;
                default:
-                       php_error(E_WARNING, "%s: unknown option", thisfunc);
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unknown option");
                        RETURN_FALSE;
                        break;
        }
index 7e8bf9184577d0a83d5ec9b69d97d660a92c2fd0..023c06740909fafc6721c61f06b573ad920f81f7 100644 (file)
@@ -186,7 +186,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
        int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
 
        if (SG(request_info).content_length > SG(post_max_size)) {
-               php_error(E_WARNING, "POST Content-Length of %d bytes exceeds the limit of %d bytes",
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %d bytes exceeds the limit of %d bytes",
                                        SG(request_info).content_length, SG(post_max_size));
                return;
        }
@@ -199,7 +199,7 @@ SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
                }
                SG(read_post_bytes) += read_bytes;
                if (SG(read_post_bytes) > SG(post_max_size)) {
-                       php_error(E_WARNING, "Actual POST length does not match Content-Length, and exceeds %d bytes", SG(post_max_size));
+                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds %d bytes", SG(post_max_size));
                        return;
                }
                if (read_bytes < SAPI_POST_BLOCK_SIZE) {
index 1ea2a6494dc891d3583060b06c4b2298292f1467..0c18c8a909e6a459ec3179a3981eed4c4a655d9c 100644 (file)
@@ -374,7 +374,7 @@ PHPAPI int php_printf(const char *format, ...)
                ret = PHPWRITE(buffer, size);
                efree(buffer);
        } else {
-               php_error(E_ERROR, "Out of memory");
+               php_error_docref(NULL TSRMLS_CC, E_ERROR, "Out of memory");
                ret = 0;
        }
        va_end(args);
@@ -680,7 +680,7 @@ PHP_FUNCTION(set_time_limit)
        zval **new_timeout;
 
        if (PG(safe_mode)) {
-               php_error(E_WARNING, "Cannot set time limit in safe mode");
+               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Cannot set time limit in safe mode");
                RETURN_FALSE;
        }
 
@@ -730,17 +730,20 @@ static void php_message_handler_for_zend(long message, void *data)
                case ZMSG_FAILED_INCLUDE_FOPEN: {
                                TSRMLS_FETCH();
 
-                               php_error(E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed opening '%s' for inclusion (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
                        }
                        break;
                case ZMSG_FAILED_REQUIRE_FOPEN: {
                                TSRMLS_FETCH();
 
-                               php_error(E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
+                               php_error_docref(NULL TSRMLS_CC, E_COMPILE_ERROR, "Failed opening required '%s' (include_path='%s')", php_strip_url_passwd((char *) data), STR_PRINT(PG(include_path)));
                        }
                        break;
-               case ZMSG_FAILED_HIGHLIGHT_FOPEN:
-                       php_error(E_WARNING, "Failed opening '%s' for highlighting", php_strip_url_passwd((char *) data));
+               case ZMSG_FAILED_HIGHLIGHT_FOPEN: {
+                               TSRMLS_FETCH();
+
+                               php_error_docref(NULL TSRMLS_CC, E_WARNING, "Failed opening '%s' for highlighting", php_strip_url_passwd((char *) data));
+                       }
                        break;
                case ZMSG_MEMORY_LEAK_DETECTED:
                case ZMSG_MEMORY_LEAK_REPEATED: {
@@ -1320,7 +1323,7 @@ static int php_hash_environment(TSRMLS_D)
                                        INIT_PZVAL(PG(http_globals)[TRACK_VARS_ENV]);
                                        php_import_environment_variables(PG(http_globals)[TRACK_VARS_ENV] TSRMLS_CC);
                                } else {
-                                       php_error(E_WARNING, "Unsupported 'e' element (environment) used in gpc_order - use variables_order instead");
+                                       php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unsupported 'e' element (environment) used in gpc_order - use variables_order instead");
                                }
                                break;
                        case 's':