@@ -390,26 +390,56 @@ PHPAPI int php_printf(const char *format, ...)
390
390
/* {{{ php_verror */
391
391
PHPAPI void php_verror (const char * docref , const char * params , int type , const char * format , va_list args TSRMLS_DC )
392
392
{
393
- char * buffer = NULL , * docref_buf = NULL , * function , * p ;
393
+ char * buffer = NULL , * docref_buf = NULL , * ref = NULL , * target = NULL ;
394
+ char * docref_target = "" , * docref_root = "" ;
395
+ char * function , * p ;
394
396
395
397
vspprintf (& buffer , 0 , format , args );
396
398
if (buffer ) {
397
399
if (!docref ) {
398
400
function = get_active_function_name (TSRMLS_C );
399
401
if (function ) {
400
- spprintf (& docref_buf , 0 , "function.%s%s " , function , PG ( docref_ext ) );
402
+ spprintf (& docref_buf , 0 , "function.%s" , function );
401
403
if (docref_buf ) {
402
404
while ((p = strchr (docref_buf , '_' ))!= NULL ) * p = '-' ;
403
405
docref = docref_buf ;
404
406
}
405
407
}
406
408
}
407
409
if (docref ) {
408
- if (PG (html_errors ) && PG (docref_ext )) {
409
- php_error (type , "%s(%s) [<a href='%s%s'>%s</a>]: %s" , get_active_function_name (TSRMLS_C ), params , PG (docref_root ), docref , docref , buffer );
410
+ if (strncmp (docref , "http://" , 7 )) {
411
+ docref_root = PG (docref_root );
412
+ /* now check copy of extension */
413
+ ref = estrdup (docref );
414
+ if (ref ) {
415
+ if (docref_buf ) {
416
+ efree (docref_buf );
417
+ }
418
+ docref_buf = ref ;
419
+ p = strrchr (ref , '#' );
420
+ if (p ) {
421
+ target = estrdup (p );
422
+ if (target ) {
423
+ docref_target = target ;
424
+ * p = '\0' ;
425
+ }
426
+ }
427
+ if ((!p || target ) && PG (docref_ext ) && strlen (PG (docref_ext ))) {
428
+ spprintf (& docref_buf , 0 , "%s%s" , ref , PG (docref_ext ));
429
+ if (docref_buf ) {
430
+ efree (ref );
431
+ docref = docref_buf ;
432
+ }
433
+ }
434
+ }
435
+ }
436
+ if (PG (html_errors )) {
437
+ php_error (type , "%s(%s) [<a href='%s%s%s'>%s</a>]: %s" , get_active_function_name (TSRMLS_C ), params , docref_root , docref , docref , docref_target , buffer );
410
438
} else {
411
- php_error (type , "%s(%s) [%s%s]: %s" , get_active_function_name (TSRMLS_C ), params , PG ( docref_root ) , docref , buffer );
439
+ php_error (type , "%s(%s) [%s%s%s ]: %s" , get_active_function_name (TSRMLS_C ), params , docref_root , docref , docref_target , buffer );
412
440
}
441
+ if (target )
442
+ efree (target );
413
443
} else {
414
444
docref = get_active_function_name (TSRMLS_C );
415
445
if (!docref )
0 commit comments