File tree 2 files changed +24
-7
lines changed 2 files changed +24
-7
lines changed Original file line number Diff line number Diff line change @@ -95,6 +95,7 @@ static void spl_filesystem_object_destroy_object(zend_object *object) /* {{{ */
95
95
} else {
96
96
php_stream_pclose (intern -> u .file .stream );
97
97
}
98
+ intern -> u .file .stream = NULL ;
98
99
}
99
100
break ;
100
101
default :
@@ -127,13 +128,11 @@ static void spl_filesystem_object_free_storage(zend_object *object) /* {{{ */
127
128
}
128
129
break ;
129
130
case SPL_FS_FILE :
130
- if (intern -> u .file .stream ) {
131
- if (intern -> u .file .open_mode ) {
132
- efree (intern -> u .file .open_mode );
133
- }
134
- if (intern -> orig_path ) {
135
- efree (intern -> orig_path );
136
- }
131
+ if (intern -> u .file .open_mode ) {
132
+ efree (intern -> u .file .open_mode );
133
+ }
134
+ if (intern -> orig_path ) {
135
+ efree (intern -> orig_path );
137
136
}
138
137
spl_filesystem_file_free_line (intern );
139
138
break ;
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #77751: Writing to SplFileObject in ob_start gives segfault
3
+ --FILE--
4
+ <?php
5
+
6
+ echo "No crash. \n" ;
7
+
8
+ $ logfile = new SplTempFileObject ();
9
+ ob_start (function ($ buffer ) use ($ logfile ) {
10
+ $ logfile ->fwrite ($ buffer );
11
+ $ logfile ->fflush ();
12
+ return "" ;
13
+ });
14
+ echo "hmm \n" ;
15
+
16
+ ?>
17
+ --EXPECT--
18
+ No crash.
You can’t perform that action at this time.
0 commit comments