]> granicus.if.org Git - php/commitdiff
php_error -> php_error_docref
authorMarcus Boerger <helly@php.net>
Thu, 5 Dec 2002 21:53:25 +0000 (21:53 +0000)
committerMarcus Boerger <helly@php.net>
Thu, 5 Dec 2002 21:53:25 +0000 (21:53 +0000)
ext/bcmath/bcmath.c
ext/calendar/easter.c
ext/domxml/php_domxml.c
ext/xml/xml.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 8105df9e5f111588dc0ddc07ed646cb18f45b984..66000681064c781c59e1c4a4a5787e4c2974c559 100644 (file)
@@ -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 d147a0aff9fd439cf305f51ac361fbdafd27124f..4ba91fc07d95db62c5f227cc3b7b7aabbb6510a6 100644 (file)
@@ -1314,10 +1314,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, ...)
@@ -1326,6 +1328,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);
@@ -1353,7 +1356,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);
        
 }
 
@@ -1361,8 +1364,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);
@@ -1392,7 +1395,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;*/
                }
@@ -1400,7 +1403,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 c4eb437d97152cf37db2f4ac6278970e76d62065..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;
                }
                
@@ -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 e0bc8798a88d0e9a5f2756eda3f27c5ca31589af..0005dd32745925a2fc53358856bd4a26d5e0bccd 100644 (file)
@@ -375,7 +375,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);
@@ -681,7 +681,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;
        }
 
@@ -731,17 +731,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: {
@@ -1440,7 +1443,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':