Hello,

I have a few questions about error reporting in extensions for 5.3.1.

I need to convert any IS_OBJECT zval to char* without issuing an error;
failed conversions must throw.

I've tried this inside a PHP_METHOD:

zend_error_handling error_handling;
zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC);

switch (Z_TYPE_P(arg)) {
case IS_OBJECT: {
    zval tmp(*arg);
    zval_copy_ctor(&tmp);
    convert_to_string(&tmp);
    ...
}
...
}

That has the desired effect of throwing an instance of Exception
(Object of class Whatever could not be converted to string), but for
some reason also causes an E_NOTICE (same message), with a wrong line
number.  The number is 0 in 5.3.1 and numberoflines + 1 in 5.2.11 with
php_set_error_handling(EH_THROW, zend_exception_get_default(TSRMLS_C) 
TSRMLS_CC);
the one reported by the exception is correct (I'm mentioning this in
hope that maybe it can help diagnose my problem).

I need to get rid of the E_NOTICE.  What should I do instead of or
in addition to the convert_to_string? I don't want to duplicate the
standard error message, and I'd like to leave the details of what
exactly is an object convertible to string and how is that conversion
performed to the ZE.

-- 
Roman Neuhauser

Reply via email to