File tree 2 files changed +26
-0
lines changed 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -627,6 +627,17 @@ PHP_METHOD(SoapHeader, __construct)
627
627
}
628
628
/* }}} */
629
629
630
+ static void soap_fault_dtor_properties (zval * obj )
631
+ {
632
+ zval_ptr_dtor (Z_FAULT_STRING_P (obj ));
633
+ zval_ptr_dtor (Z_FAULT_CODE_P (obj ));
634
+ zval_ptr_dtor (Z_FAULT_CODENS_P (obj ));
635
+ zval_ptr_dtor (Z_FAULT_ACTOR_P (obj ));
636
+ zval_ptr_dtor (Z_FAULT_DETAIL_P (obj ));
637
+ zval_ptr_dtor (Z_FAULT_NAME_P (obj ));
638
+ zval_ptr_dtor (Z_FAULT_HEADERFAULT_P (obj ));
639
+ }
640
+
630
641
/* {{{ SoapFault constructor */
631
642
PHP_METHOD (SoapFault , __construct )
632
643
{
@@ -646,6 +657,9 @@ PHP_METHOD(SoapFault, __construct)
646
657
Z_PARAM_ZVAL_OR_NULL (headerfault )
647
658
ZEND_PARSE_PARAMETERS_END ();
648
659
660
+ /* Delete previously set properties */
661
+ soap_fault_dtor_properties (ZEND_THIS );
662
+
649
663
if (code_str ) {
650
664
fault_code = ZSTR_VAL (code_str );
651
665
fault_code_len = ZSTR_LEN (code_str );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ GH-14586: SoapFault::__construct() leaks memory if called twice
3
+ --EXTENSIONS--
4
+ soap
5
+ --FILE--
6
+ <?php
7
+ $ sf = new SoapFault (null , "x " );
8
+ $ sf ->__construct (null , "x " );
9
+ ?>
10
+ DONE
11
+ --EXPECT--
12
+ DONE
You can’t perform that action at this time.
0 commit comments