@@ -340,9 +340,15 @@ ZEND_METHOD(exception, __toString)
340
340
341
341
zend_call_function (& fci , NULL TSRMLS_CC );
342
342
343
- len = zend_spprintf (& str , 0 , "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s" ,
344
- Z_OBJCE_P (getThis ())-> name , Z_STRVAL_P (message ), Z_STRVAL_P (file ), Z_LVAL_P (line ),
345
- Z_STRLEN_P (trace ) ? Z_STRVAL_P (trace ) : "#0 {main}\n" );
343
+ if (Z_STRLEN_P (message ) > 0 ) {
344
+ len = zend_spprintf (& str , 0 , "exception '%s' with message '%s' in %s:%ld\nStack trace:\n%s" ,
345
+ Z_OBJCE_P (getThis ())-> name , Z_STRVAL_P (message ), Z_STRVAL_P (file ), Z_LVAL_P (line ),
346
+ Z_STRLEN_P (trace ) ? Z_STRVAL_P (trace ) : "#0 {main}\n" );
347
+ } else {
348
+ len = zend_spprintf (& str , 0 , "exception '%s' in %s:%ld\nStack trace:\n%s" ,
349
+ Z_OBJCE_P (getThis ())-> name , Z_STRVAL_P (file ), Z_LVAL_P (line ),
350
+ Z_STRLEN_P (trace ) ? Z_STRVAL_P (trace ) : "#0 {main}\n" );
351
+ }
346
352
347
353
/* We store the result in the private property string so we can access
348
354
* the result in uncaught exception handlers without memleaks. */
@@ -385,7 +391,7 @@ static void zend_register_default_exception(TSRMLS_D)
385
391
memcpy (& default_exception_handlers , zend_get_std_object_handlers (), sizeof (zend_object_handlers ));
386
392
default_exception_handlers .clone_obj = NULL ;
387
393
388
- zend_declare_property_string (default_exception_ptr , "message" , sizeof ("message" )- 1 , "none " , ZEND_ACC_PROTECTED TSRMLS_CC );
394
+ zend_declare_property_string (default_exception_ptr , "message" , sizeof ("message" )- 1 , "" , ZEND_ACC_PROTECTED TSRMLS_CC );
389
395
zend_declare_property_string (default_exception_ptr , "string" , sizeof ("string" )- 1 , "" , ZEND_ACC_PRIVATE TSRMLS_CC );
390
396
zend_declare_property_long (default_exception_ptr , "code" , sizeof ("code" )- 1 , 0 , ZEND_ACC_PROTECTED TSRMLS_CC );
391
397
zend_declare_property_null (default_exception_ptr , "file" , sizeof ("file" )- 1 , ZEND_ACC_PROTECTED TSRMLS_CC );
0 commit comments