@@ -1347,6 +1347,9 @@ ZEND_API ZEND_COLD void zend_error_zstr_at(
13471347 EG (num_errors )++ ;
13481348 EG (errors ) = erealloc (EG (errors ), sizeof (zend_error_info * ) * EG (num_errors ));
13491349 EG (errors )[EG (num_errors )- 1 ] = info ;
1350+ if (EG (record_errors_without_emitting )) {
1351+ return ;
1352+ }
13501353 }
13511354
13521355 /* Report about uncaught exception in case of fatal errors */
@@ -1600,14 +1603,34 @@ ZEND_API ZEND_COLD void zend_error_zstr(int type, zend_string *message) {
16001603 zend_error_zstr_at (type , filename , lineno , message );
16011604}
16021605
1603- ZEND_API void zend_begin_record_errors ( void )
1606+ static zend_always_inline void zend_begin_record_errors_ex ( bool no_emmitting )
16041607{
16051608 ZEND_ASSERT (!EG (record_errors ) && "Error recording already enabled" );
16061609 EG (record_errors ) = true;
1610+ EG (record_errors_without_emitting ) = no_emmitting ;
16071611 EG (num_errors ) = 0 ;
16081612 EG (errors ) = NULL ;
16091613}
16101614
1615+ ZEND_API void zend_begin_record_errors (void )
1616+ {
1617+ zend_begin_record_errors_ex (false);
1618+ }
1619+
1620+ ZEND_API void zend_begin_record_errors_without_emitting (void )
1621+ {
1622+ zend_begin_record_errors_ex (true);
1623+ }
1624+
1625+ ZEND_API void zend_emit_recorded_errors (void )
1626+ {
1627+ EG (record_errors ) = false;
1628+ for (uint32_t i = 0 ; i < EG (num_errors ); i ++ ) {
1629+ zend_error_info * error = EG (errors )[i ];
1630+ zend_error_zstr_at (error -> type , error -> filename , error -> lineno , error -> message );
1631+ }
1632+ }
1633+
16111634ZEND_API void zend_free_recorded_errors (void )
16121635{
16131636 if (!EG (num_errors )) {
0 commit comments