@@ -77,7 +77,7 @@ ZEND_API FILE *(*zend_fopen)(zend_string *filename, zend_string **opened_path);
77
77
ZEND_API zend_result (* zend_stream_open_function )(zend_file_handle * handle );
78
78
ZEND_API void (* zend_ticks_function )(int ticks );
79
79
ZEND_API void (* zend_interrupt_function )(zend_execute_data * execute_data );
80
- ZEND_API void (* zend_error_cb )(int type , const char * error_filename , const uint32_t error_lineno , zend_string * message );
80
+ ZEND_API void (* zend_error_cb )(int type , zend_string * error_filename , const uint32_t error_lineno , zend_string * message );
81
81
void (* zend_printf_to_smart_string )(smart_string * buf , const char * format , va_list ap );
82
82
void (* zend_printf_to_smart_str )(smart_str * buf , const char * format , va_list ap );
83
83
ZEND_API char * (* zend_getenv )(const char * name , size_t name_len );
@@ -1316,7 +1316,7 @@ ZEND_API zval *zend_get_configuration_directive(zend_string *name) /* {{{ */
1316
1316
} while (0)
1317
1317
1318
1318
static ZEND_COLD void zend_error_impl (
1319
- int orig_type , const char * error_filename , uint32_t error_lineno , zend_string * message )
1319
+ int orig_type , zend_string * error_filename , uint32_t error_lineno , zend_string * message )
1320
1320
{
1321
1321
zval params [4 ];
1322
1322
zval retval ;
@@ -1381,7 +1381,7 @@ static ZEND_COLD void zend_error_impl(
1381
1381
ZVAL_LONG (& params [0 ], type );
1382
1382
1383
1383
if (error_filename ) {
1384
- ZVAL_STRING (& params [2 ], error_filename );
1384
+ ZVAL_STR_COPY (& params [2 ], error_filename );
1385
1385
} else {
1386
1386
ZVAL_NULL (& params [2 ]);
1387
1387
}
@@ -1449,15 +1449,15 @@ static ZEND_COLD void zend_error_impl(
1449
1449
/* }}} */
1450
1450
1451
1451
static ZEND_COLD void zend_error_va_list (
1452
- int orig_type , const char * error_filename , uint32_t error_lineno ,
1452
+ int orig_type , zend_string * error_filename , uint32_t error_lineno ,
1453
1453
const char * format , va_list args )
1454
1454
{
1455
1455
zend_string * message = zend_vstrpprintf (0 , format , args );
1456
1456
zend_error_impl (orig_type , error_filename , error_lineno , message );
1457
1457
zend_string_release (message );
1458
1458
}
1459
1459
1460
- static ZEND_COLD void get_filename_lineno (int type , const char * * filename , uint32_t * lineno ) {
1460
+ static ZEND_COLD void get_filename_lineno (int type , zend_string * * filename , uint32_t * lineno ) {
1461
1461
/* Obtain relevant filename and lineno */
1462
1462
switch (type ) {
1463
1463
case E_CORE_ERROR :
@@ -1479,16 +1479,11 @@ static ZEND_COLD void get_filename_lineno(int type, const char **filename, uint3
1479
1479
case E_USER_DEPRECATED :
1480
1480
case E_RECOVERABLE_ERROR :
1481
1481
if (zend_is_compiling ()) {
1482
- * filename = ZSTR_VAL ( zend_get_compiled_filename () );
1482
+ * filename = zend_get_compiled_filename ();
1483
1483
* lineno = zend_get_compiled_lineno ();
1484
1484
} else if (zend_is_executing ()) {
1485
- * filename = zend_get_executed_filename ();
1486
- if ((* filename )[0 ] == '[' ) { /* [no active file] */
1487
- * filename = NULL ;
1488
- * lineno = 0 ;
1489
- } else {
1490
- * lineno = zend_get_executed_lineno ();
1491
- }
1485
+ * filename = zend_get_executed_filename_ex ();
1486
+ * lineno = zend_get_executed_lineno ();
1492
1487
} else {
1493
1488
* filename = NULL ;
1494
1489
* lineno = 0 ;
@@ -1500,12 +1495,12 @@ static ZEND_COLD void get_filename_lineno(int type, const char **filename, uint3
1500
1495
break ;
1501
1496
}
1502
1497
if (!* filename ) {
1503
- * filename = "Unknown" ;
1498
+ * filename = ZSTR_KNOWN ( ZEND_STR_UNKNOWN_CAPITALIZED ) ;
1504
1499
}
1505
1500
}
1506
1501
1507
1502
ZEND_API ZEND_COLD void zend_error_at (
1508
- int type , const char * filename , uint32_t lineno , const char * format , ...) {
1503
+ int type , zend_string * filename , uint32_t lineno , const char * format , ...) {
1509
1504
va_list args ;
1510
1505
1511
1506
if (!filename ) {
@@ -1519,7 +1514,7 @@ ZEND_API ZEND_COLD void zend_error_at(
1519
1514
}
1520
1515
1521
1516
ZEND_API ZEND_COLD void zend_error (int type , const char * format , ...) {
1522
- const char * filename ;
1517
+ zend_string * filename ;
1523
1518
uint32_t lineno ;
1524
1519
va_list args ;
1525
1520
@@ -1530,7 +1525,7 @@ ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) {
1530
1525
}
1531
1526
1532
1527
ZEND_API ZEND_COLD void zend_error_unchecked (int type , const char * format , ...) {
1533
- const char * filename ;
1528
+ zend_string * filename ;
1534
1529
uint32_t lineno ;
1535
1530
va_list args ;
1536
1531
@@ -1541,7 +1536,7 @@ ZEND_API ZEND_COLD void zend_error_unchecked(int type, const char *format, ...)
1541
1536
}
1542
1537
1543
1538
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn (
1544
- int type , const char * filename , uint32_t lineno , const char * format , ...)
1539
+ int type , zend_string * filename , uint32_t lineno , const char * format , ...)
1545
1540
{
1546
1541
va_list args ;
1547
1542
@@ -1559,7 +1554,7 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_at_noreturn(
1559
1554
1560
1555
ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn (int type , const char * format , ...)
1561
1556
{
1562
- const char * filename ;
1557
+ zend_string * filename ;
1563
1558
uint32_t lineno ;
1564
1559
va_list args ;
1565
1560
@@ -1572,7 +1567,7 @@ ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *
1572
1567
}
1573
1568
1574
1569
ZEND_API ZEND_COLD void zend_error_zstr (int type , zend_string * message ) {
1575
- const char * filename ;
1570
+ zend_string * filename ;
1576
1571
uint32_t lineno ;
1577
1572
get_filename_lineno (type , & filename , & lineno );
1578
1573
zend_error_impl (type , filename , lineno , message );
0 commit comments