From: Marcus Boerger Date: Tue, 12 Nov 2002 13:16:13 +0000 (+0000) Subject: php_error() => php_error_docref() X-Git-Tag: php-4.3.0RC1~83 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=c53e21ef05ccacab5ab032eac21698b850607a74;p=php php_error() => php_error_docref() --- diff --git a/ext/ming/ming.c b/ext/ming/ming.c index bcf81cd1ae..0fe88bec3d 100644 --- a/ext/ming/ming.c +++ b/ext/ming/ming.c @@ -136,7 +136,7 @@ static void *SWFgetProperty(zval *id, char *name, int namelen, int proptype TSRM if (id) { if (zend_hash_find(Z_OBJPROP_P(id), name, namelen+1, (void **)&tmp) == FAILURE) { - php_error(E_WARNING, "unable to find property %s", name); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find property %s", name); return NULL; } id_to_find = Z_LVAL_PP(tmp); @@ -147,7 +147,7 @@ static void *SWFgetProperty(zval *id, char *name, int namelen, int proptype TSRM property = zend_list_find(id_to_find, &type); if (!property || type != proptype) { - php_error(E_WARNING, "unable to find identifier (%d)", id_to_find); + php_error_docref(NULL TSRMLS_CC, E_WARNING, "Unable to find identifier (%d)", id_to_find); return NULL; } @@ -179,7 +179,7 @@ static SWFCharacter getCharacter(zval *id TSRMLS_DC) else if (Z_OBJCE_P(id) == &bitmap_class_entry) return (SWFCharacter)getBitmap(id TSRMLS_CC); else - php_error(E_ERROR, "called object is not an SWFCharacter"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFCharacter"); return NULL; } /* }}} */ @@ -237,7 +237,7 @@ PHP_FUNCTION(swfaction_init) action = compileSWFActionCode(Z_STRVAL_PP(script)); if (!action) { - php_error(E_ERROR, "Couldn't compile actionscript."); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Couldn't compile actionscript"); } ret = zend_list_insert(action, le_swfactionp); @@ -256,7 +256,7 @@ static SWFAction getAction(zval *id TSRMLS_DC) void *action = SWFgetProperty(id, "action", 6, le_swfactionp TSRMLS_CC); if (!action) { - php_error(E_ERROR, "called object is not an SWFAction!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFAction"); } return (SWFAction)action; } @@ -333,7 +333,7 @@ static SWFBitmap getBitmap(zval *id TSRMLS_DC) void *bitmap = SWFgetProperty(id, "bitmap", 6, le_swfbitmapp TSRMLS_CC); if (!bitmap) { - php_error(E_ERROR, "called object is not an SWFBitmap!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFBitmap"); } return (SWFBitmap)bitmap; } @@ -395,7 +395,7 @@ static SWFButton getButton(zval *id TSRMLS_DC) void *button = SWFgetProperty(id, "button", 6, le_swfbuttonp TSRMLS_CC); if(!button) { - php_error(E_ERROR, "called object is not an SWFButton!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFButton"); } return (SWFButton)button; } @@ -543,7 +543,7 @@ PHP_FUNCTION(swfbutton_keypress) convert_to_string_ex(key); if (Z_STRLEN_PP(key) > 1) { - php_error(E_ERROR, "SWFBUTTON_KEYPRESS expects only one character!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Only one character expected"); } c = Z_STRVAL_PP(key)[0]; @@ -582,7 +582,7 @@ static SWFDisplayItem getDisplayItem(zval *id TSRMLS_DC) void *item = SWFgetProperty(id, "displayitem", 11, le_swfdisplayitemp TSRMLS_CC); if (!item) { - php_error(E_ERROR, "called object is not an SWFDisplayItem!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFDisplayItem"); } return (SWFDisplayItem)item; @@ -915,7 +915,7 @@ static zend_function_entry swffill_functions[] = { Returns a new SWFFill object */ PHP_FUNCTION(swffill_init) { - php_error(E_ERROR, "Instantiating SWFFill won't do any good- use SWFShape::addFill() instead!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Instantiating SWFFill won't do any good- use SWFShape::addFill() instead"); } static void destroy_SWFFill_resource(zend_rsrc_list_entry *resource TSRMLS_DC) @@ -934,7 +934,7 @@ static SWFFill getFill(zval *id TSRMLS_DC) void *fill = SWFgetProperty(id, "fill", 4, le_swffillp TSRMLS_CC); if (!fill) { - php_error(E_ERROR, "called object is not an SWFFill!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFill"); } return (SWFFill)fill; } @@ -1042,7 +1042,7 @@ static SWFFont getFont(zval *id TSRMLS_DC) void *font = SWFgetProperty(id, "font", 4, le_swffontp TSRMLS_CC); if (!font) { - php_error(E_ERROR, "called object is not an SWFFont!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFFont"); } return (SWFFont)font; } @@ -1170,7 +1170,7 @@ static SWFGradient getGradient(zval *id TSRMLS_DC) void *gradient = SWFgetProperty(id, "gradient", 8, le_swfgradientp TSRMLS_CC); if (!gradient) { - php_error(E_ERROR, "called object is not an SWFGradient!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFGradient"); } return (SWFGradient)gradient; } @@ -1245,7 +1245,7 @@ static SWFMorph getMorph(zval *id TSRMLS_DC) void *morph = SWFgetProperty(id, "morph", 5, le_swfmorphp TSRMLS_CC); if (!morph) { - php_error(E_ERROR, "called object is not an SWFMorph!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMorph"); } return (SWFMorph)morph; } @@ -1337,7 +1337,7 @@ static SWFMovie getMovie(zval *id TSRMLS_DC) void *movie = SWFgetProperty(id, "movie", 5, le_swfmoviep TSRMLS_CC); if (!movie) { - php_error(E_ERROR, "called object is not an SWFMovie!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFMovie"); } return (SWFMovie)movie; } @@ -1623,7 +1623,7 @@ static SWFShape getShape(zval *id TSRMLS_DC) void *shape = SWFgetProperty(id, "shape", 5, le_swfshapep TSRMLS_CC); if (!shape) { - php_error(E_ERROR, "called object is not an SWFShape!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFShape"); } return (SWFShape)shape; } @@ -1706,7 +1706,7 @@ PHP_FUNCTION(swfshape_addfill) } fill = SWFShape_addBitmapFill(getShape(getThis() TSRMLS_CC), getBitmap(*arg1 TSRMLS_CC), flags); } else { - php_error(E_ERROR, "argument to addfill not a bitmap nor a gradient"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Argument is not a bitmap nor a gradient"); } } else if (ZEND_NUM_ARGS() == 3 || ZEND_NUM_ARGS() == 4) { @@ -1737,7 +1737,7 @@ PHP_FUNCTION(swfshape_addfill) } if (!fill) { - php_error(E_ERROR, "Error adding fill to shape!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error adding fill to shape"); } /* return an SWFFill object */ @@ -2129,7 +2129,7 @@ static SWFMovieClip getSprite(zval *id TSRMLS_DC) void *sprite = SWFgetProperty(id, "sprite", 6, le_swfspritep TSRMLS_CC); if (!sprite) { - php_error(E_ERROR, "called object is not an SWFSprite!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFSprite"); } return (SWFMovieClip)sprite; } @@ -2265,7 +2265,7 @@ static SWFText getText(zval *id TSRMLS_DC) void *text = SWFgetProperty(id, "text", 4, le_swftextp TSRMLS_CC); if (!text) { - php_error(E_ERROR, "called object is not an SWFText!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFText"); } return (SWFText)text; } @@ -2474,7 +2474,7 @@ static SWFTextField getTextField(zval *id TSRMLS_DC) void *field = SWFgetProperty(id, "textfield", 9, le_swftextfieldp TSRMLS_CC); if (!field) { - php_error(E_ERROR, "called object is not an SWFTextField!"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Called object is not an SWFTextField"); } return (SWFTextField)field; } @@ -2707,19 +2707,20 @@ PHP_MINFO_FUNCTION(ming) /* {{{ todo PHP_MINIT_FUNCTION(ming) */ -#define ERROR_BUFSIZE 1024 - /* custom error handler propagates ming errors up to php */ static void php_ming_error(char *msg, ...) { + TSRMLS_FETCH(); + va_list args; - char buffer[ERROR_BUFSIZE]; + char *buffer; va_start(args, msg); - vsnprintf(buffer, ERROR_BUFSIZE, msg, args); + vspprintf(&buffer, 0, msg, args); va_end(args); - php_error(E_ERROR, buffer); + php_error_docref(NULL TSRMLS_CC, E_ERROR, buffer); + efree(buffer); } PHP_RINIT_FUNCTION(ming) @@ -2727,7 +2728,7 @@ PHP_RINIT_FUNCTION(ming) /* XXX - this didn't work so well last I tried.. */ if (Ming_init() != 0) { - php_error(E_ERROR, "Error initializing Ming module"); + php_error_docref(NULL TSRMLS_CC, E_ERROR, "Error initializing Ming module"); return FAILURE; } return SUCCESS;