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);
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;
}
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;
}
/* }}} */
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);
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;
}
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;
}
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;
}
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];
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;
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)
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
}
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) {
}
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 */
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;
}
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;
}
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;
}
/* {{{ 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)
/* 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;