From 727067f59cd52f7eb9f5929df190b8f0f227313d Mon Sep 17 00:00:00 2001 From: Marcus Boerger Date: Thu, 22 Aug 2002 18:38:44 +0000 Subject: [PATCH] php_error_docref... --- ext/gd/gd.c | 84 ++++++++++++++++++++++++------------------------- ext/gd/gd_ctx.c | 6 ++-- 2 files changed, 45 insertions(+), 45 deletions(-) diff --git a/ext/gd/gd.c b/ext/gd/gd.c index 33b58fdfdd..a8a3b69b12 100644 --- a/ext/gd/gd.c +++ b/ext/gd/gd.c @@ -517,9 +517,9 @@ PHP_FUNCTION(imageloadfont) php_stream_close(stream); efree(font); if (php_stream_eof(stream)) { - php_error(E_WARNING, "%s(): End of file while reading header", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "End of file while reading header"); } else { - php_error(E_WARNING, "%s(): Error while reading header", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading header"); } RETURN_FALSE; } @@ -535,7 +535,7 @@ PHP_FUNCTION(imageloadfont) body_size = font->w * font->h * font->nchars; } if (body_size != body_size_check) { - php_error(E_WARNING, "%s(): Error reading font", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error reading font"); efree(font); RETURN_FALSE; } @@ -549,9 +549,9 @@ PHP_FUNCTION(imageloadfont) efree(font->data); efree(font); if (php_stream_eof(stream)) { - php_error(E_WARNING, "%s(): End of file while reading body", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "End of file while reading body"); } else { - php_error(E_WARNING, "%s(): Error while reading body", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Error while reading body"); } RETURN_FALSE; } @@ -1062,7 +1062,7 @@ gdImagePtr _php_image_create_from_string(zval **data, char *tn, gdImagePtr (*ioc im = (*ioctx_func_p)(io_ctx); if (!im) { - php_error(E_WARNING, "%s(): Passed data is not in '%s' format", get_active_function_name(TSRMLS_C), tn); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Passed data is not in '%s' format", tn); return NULL; } @@ -1093,7 +1093,7 @@ PHP_FUNCTION(imagecreatefromstring) #ifdef HAVE_GD_JPG im = _php_image_create_from_string (data, "JPEG", gdImageCreateFromJpegCtx TSRMLS_CC); #else - php_error(E_WARNING, "%s(): No JPEG support in this PHP build", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No JPEG support in this PHP build"); RETURN_FALSE; #endif break; @@ -1102,7 +1102,7 @@ PHP_FUNCTION(imagecreatefromstring) #ifdef HAVE_GD_PNG im = _php_image_create_from_string (data, "PNG", gdImageCreateFromPngCtx TSRMLS_CC); #else - php_error(E_WARNING, "%s(): No PNG support in this PHP build", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No PNG support in this PHP build"); RETURN_FALSE; #endif break; @@ -1111,7 +1111,7 @@ PHP_FUNCTION(imagecreatefromstring) #ifdef HAVE_GD_GIF_READ im = _php_image_create_from_string (data, "GIF", gdImageCreateFromGifCtx TSRMLS_CC); #else - php_error(E_WARNING, "%s(): No GIF support in this PHP build", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No GIF support in this PHP build"); RETURN_FALSE; #endif break; @@ -1120,7 +1120,7 @@ PHP_FUNCTION(imagecreatefromstring) #ifdef HAVE_GD_WBMP im = _php_image_create_from_string (data, "WBMP", gdImageCreateFromWBMPCtx TSRMLS_CC); #else - php_error(E_WARNING, "%s(): No WBMP support in this PHP build", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No WBMP support in this PHP build"); RETURN_FALSE; #endif break; @@ -1129,18 +1129,18 @@ PHP_FUNCTION(imagecreatefromstring) #ifdef HAVE_GD_GD2 im = _php_image_create_from_string (data, "GD2", gdImageCreateFromGd2Ctx TSRMLS_CC); #else - php_error(E_WARNING, "%s(): No GD2 support in this PHP build", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No GD2 support in this PHP build"); RETURN_FALSE; #endif break; default: - php_error(E_WARNING, "%s(): Data is not in a recognized format.", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Data is not in a recognized format."); RETURN_FALSE; } if (!im) { - php_error(E_WARNING, "%s(): Couldn't create GD Image Stream out of Data", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't create GD Image Stream out of Data"); RETURN_FALSE; } @@ -1200,13 +1200,13 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, buff_size = php_stream_copy_to_mem(stream, &buff, PHP_STREAM_COPY_ALL, 1); if(!buff_size) { - php_error(E_WARNING,"%s(): Cannot read image data", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot read image data"); goto out_err; } io_ctx = gdNewDynamicCtx(buff_size, buff); if(!io_ctx) { - php_error(E_WARNING,"%s(): Cannot allocate GD IO context", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING,"Cannot allocate GD IO context"); goto out_err; } if (image_type == PHP_GDIMG_TYPE_GD2PART) { @@ -1239,7 +1239,7 @@ static void _php_image_create_from(INTERNAL_FUNCTION_PARAMETERS, int image_type, return; } - php_error(E_WARNING, "%s(): '%s' is not a valid %s file", get_active_function_name(TSRMLS_C), fn, tn); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "'%s' is not a valid %s file", fn, tn); out_err: php_stream_close(stream); RETURN_FALSE; @@ -1296,7 +1296,7 @@ PHP_FUNCTION(imagecreatefromxpm) _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XPM, "XPM", gdImageCreateFromXpm, NULL); #else */ - php_error(E_WARNING, "%s(): No XPM support in this PHP build", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "No XPM support in this PHP build"); RETURN_FALSE; /* #endif @@ -1371,20 +1371,20 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) { if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) { - php_error(E_WARNING, "%s(): Invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filename '%s'", fn); RETURN_FALSE; } fp = VCWD_FOPEN(fn, "wb"); if (!fp) { - php_error(E_WARNING, "%s(): Unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' for writing", fn); RETURN_FALSE; } switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s(): Invalid threshold value '%d'. It must be between 0 and 255", get_active_function_name(TSRMLS_C), q); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, fp, q); @@ -1408,14 +1408,14 @@ static void _php_image_output(INTERNAL_FUNCTION_PARAMETERS, int image_type, char tmp = tmpfile(); if (tmp == NULL) { - php_error(E_WARNING, "%s(): Unable to open temporary file", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open temporary file"); RETURN_FALSE; } switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s(): Invalid threshold value '%d'. It must be between 0 and 255", get_active_function_name(TSRMLS_C), q); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, tmp, q); @@ -1605,7 +1605,7 @@ PHP_FUNCTION(imagecolorat) if (im->tpixels && gdImageBoundsSafe(im, Z_LVAL_PP(x), Z_LVAL_PP(y))) { RETURN_LONG(gdImageTrueColorPixel(im, Z_LVAL_PP(x), Z_LVAL_PP(y))); } else { - php_error(E_NOTICE, "%s(): %ld,%ld is out of bounds", get_active_function_name(TSRMLS_C), Z_LVAL_PP(x), Z_LVAL_PP(y)); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", Z_LVAL_PP(x), Z_LVAL_PP(y)); RETURN_FALSE; } } else { @@ -1617,7 +1617,7 @@ PHP_FUNCTION(imagecolorat) RETURN_LONG(im->pixels[Z_LVAL_PP(x)][Z_LVAL_PP(y)]); #endif } else { - php_error(E_NOTICE, "%s(): %ld,%ld is out of bounds", get_active_function_name(TSRMLS_C), Z_LVAL_PP(x), Z_LVAL_PP(y)); + php_error_docref(NULL TSRMLS_CC, E_NOTICE, "%ld,%ld is out of bounds", Z_LVAL_PP(x), Z_LVAL_PP(y)); RETURN_FALSE; } #if HAVE_LIBGD20 @@ -2199,18 +2199,18 @@ static void php_imagepolygon(INTERNAL_FUNCTION_PARAMETERS, int filled) col = Z_LVAL_PP(COL); if (Z_TYPE_PP(POINTS) != IS_ARRAY) { - php_error(E_WARNING, "%s(): 2nd argument to imagepolygon not an array", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "2nd argument to imagepolygon not an array"); RETURN_FALSE; } nelem = zend_hash_num_elements(Z_ARRVAL_PP(POINTS)); if (nelem < 6) { - php_error(E_WARNING, "%s(): You must have at least 3 points in your array", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "You must have at least 3 points in your array"); RETURN_FALSE; } if (nelem < npoints * 2) { - php_error(E_WARNING, "%s(): Trying to use %d points in array with only %d points", get_active_function_name(TSRMLS_C), npoints, nelem/2); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Trying to use %d points in array with only %d points", npoints, nelem/2); RETURN_FALSE; } @@ -2806,7 +2806,7 @@ static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int if (error) { - php_error(E_WARNING, "%s(): %s", get_active_function_name(TSRMLS_C), error); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s", error); RETURN_FALSE; } @@ -2863,23 +2863,23 @@ PHP_FUNCTION(imagepsloadfont) if (f_ind < 0) { switch (f_ind) { case -1: - php_error(E_WARNING, "%s(): Couldn't find the font file", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find the font file"); RETURN_FALSE; break; case -2: case -3: - php_error(E_WARNING, "%s(): Memory allocation fault in t1lib", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Memory allocation fault in t1lib"); RETURN_FALSE; break; default: - php_error(E_WARNING, "%s(): An unknown error occurred in t1lib", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "An unknown error occurred in t1lib"); RETURN_FALSE; break; } } if (T1_LoadFont(f_ind)) { - php_error(E_WARNING, "%s(): Couldn't load the font", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't load the font"); RETURN_FALSE; } @@ -2979,14 +2979,14 @@ PHP_FUNCTION(imagepsencodefont) ZEND_FETCH_RESOURCE(f_ind, int *, fnt, -1, "Type 1 font", le_ps_font); if ((enc_vector = T1_LoadEncoding(Z_STRVAL_PP(enc))) == NULL) { - php_error(E_WARNING, "%s(): Couldn't load encoding vector from %s", get_active_function_name(TSRMLS_C), Z_STRVAL_PP(enc)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't load encoding vector from %s", Z_STRVAL_PP(enc)); RETURN_FALSE; } T1_DeleteAllSizes(*f_ind); if (T1_ReencodeFont(*f_ind, enc_vector)) { T1_DeleteEncoding(enc_vector); - php_error(E_WARNING, "%s(): Couldn't reencode font", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't reencode font"); RETURN_FALSE; } zend_list_insert(enc_vector, le_ps_enc); @@ -3121,7 +3121,7 @@ PHP_FUNCTION(imagepstext) T1_AASetLevel(T1_AA_HIGH); break; default: - php_error(E_WARNING, "%s(): Invalid value %d as number of steps for antialiasing", get_active_function_name(TSRMLS_C), aa_steps); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid value %d as number of steps for antialiasing", aa_steps); RETURN_FALSE; } @@ -3150,7 +3150,7 @@ PHP_FUNCTION(imagepstext) } if (T1_errno) { - php_error(E_WARNING, "%s(): libt1 returned error %d", get_active_function_name(TSRMLS_C), T1_errno); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "libt1 returned error %d", T1_errno); RETURN_FALSE; } @@ -3170,7 +3170,7 @@ PHP_FUNCTION(imagepstext) } if (array_init(return_value) == FAILURE) { - php_error(E_WARNING, "%s(): Couldn't initialize array for returning bounding box", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't initialize array for returning bounding box"); RETURN_FALSE; } @@ -3470,7 +3470,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) #endif /* HAVE_GD_PNG */ default: - php_error(E_WARNING, "%s(): Format not supported", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Format not supported"); RETURN_FALSE; break; } @@ -3507,7 +3507,7 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) im_tmp = gdImageCreate (dest_width, dest_height); if (im_tmp == NULL ) { - php_error(E_WARNING, "%s(): Unable to allocate temporary buffer", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate temporary buffer"); RETURN_FALSE; } @@ -3519,18 +3519,18 @@ static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) im_dest = gdImageCreate(dest_width, dest_height); if (im_dest == NULL) { - php_error(E_WARNING, "%s(): Unable to allocate destination buffer", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate destination buffer"); RETURN_FALSE; } white = gdImageColorAllocate(im_dest, 255, 255, 255); if (white == -1) { - php_error(E_WARNING, "%s(): Unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate the colors for the destination buffer"); RETURN_FALSE; } black = gdImageColorAllocate(im_dest, 0, 0, 0); if (black == -1) { - php_error(E_WARNING, "%s(): Unable to allocate the colors for the destination buffer", get_active_function_name(TSRMLS_C)); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to allocate the colors for the destination buffer"); RETURN_FALSE; } diff --git a/ext/gd/gd_ctx.c b/ext/gd/gd_ctx.c index 6c5f64b3d1..3e6b17dead 100644 --- a/ext/gd/gd_ctx.c +++ b/ext/gd/gd_ctx.c @@ -52,13 +52,13 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, if ((argc == 2) || (argc == 3 && Z_STRLEN_PP(file))) { if (!fn || fn == empty_string || php_check_open_basedir(fn TSRMLS_CC)) { - php_error(E_WARNING, "%s(): Invalid filename '%s'", get_active_function_name(TSRMLS_C), fn); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid filename '%s'", fn); RETURN_FALSE; } fp = VCWD_FOPEN(fn, "wb"); if (!fp) { - php_error(E_WARNING, "%s(): Unable to open '%s' for writing", get_active_function_name(TSRMLS_C), fn); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to open '%s' for writing", fn); RETURN_FALSE; } @@ -79,7 +79,7 @@ static void _php_image_output_ctx(INTERNAL_FUNCTION_PARAMETERS, int image_type, switch(image_type) { case PHP_GDIMG_CONVERT_WBM: if(q<0||q>255) { - php_error(E_WARNING, "%s(): Invalid threshold value '%d'. It must be between 0 and 255",get_active_function_name(TSRMLS_C), q); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid threshold value '%d'. It must be between 0 and 255", q); } case PHP_GDIMG_TYPE_JPG: (*func_p)(im, ctx, q); -- 2.50.1