File tree Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Expand file tree Collapse file tree 2 files changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -385,8 +385,12 @@ static zend_object *spl_filesystem_object_clone(zend_object *old_object)
385
385
386
386
switch (source -> type ) {
387
387
case SPL_FS_INFO :
388
- intern -> path = zend_string_copy (source -> path );
389
- intern -> file_name = zend_string_copy (source -> file_name );
388
+ if (source -> path != NULL ) {
389
+ intern -> path = zend_string_copy (source -> path );
390
+ }
391
+ if (source -> file_name != NULL ) {
392
+ intern -> file_name = zend_string_copy (source -> file_name );
393
+ }
390
394
break ;
391
395
case SPL_FS_DIR :
392
396
spl_filesystem_dir_open (intern , source -> path );
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug GH-7809 (Cloning a faked SplFileInfo object may segfault)
3
+ --FILE--
4
+ <?php
5
+ class MySplFileInfo extends SplFileInfo {
6
+ public function __construct (string $ filename ) {}
7
+ }
8
+
9
+ $ sfi = new MySplFileInfo ("foo " );
10
+ clone $ sfi ;
11
+ ?>
12
+ --EXPECT--
You can’t perform that action at this time.
0 commit comments