mirror of
https://github.com/php/php-src.git
synced 2024-12-03 23:05:57 +08:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Fix #79756: finfo_file crash (FILEINFO_MIME)
This commit is contained in:
commit
dfac28f8d8
3
NEWS
3
NEWS
@ -10,6 +10,9 @@ PHP NEWS
|
||||
. Fixed bug #79740 (serialize() and unserialize() methods can not be called
|
||||
statically). (Nikita)
|
||||
|
||||
- Fileinfo:
|
||||
. Fixed bug #79756 (finfo_file crash (FILEINFO_MIME)). (cmb)
|
||||
|
||||
- FTP:
|
||||
. Fixed bug #55857 (ftp_size on large files). (cmb)
|
||||
|
||||
|
16
ext/fileinfo/tests/bug79756.phpt
Normal file
16
ext/fileinfo/tests/bug79756.phpt
Normal file
@ -0,0 +1,16 @@
|
||||
--TEST--
|
||||
Bug #79756 (finfo_file crash (FILEINFO_MIME))
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!extension_loaded('fileinfo')) die('skip fileinfo extension not available');
|
||||
?>
|
||||
--FILE--
|
||||
<?php
|
||||
$filename = __DIR__ . '/bug79756.xls';
|
||||
$finfo = finfo_open(FILEINFO_MIME);
|
||||
$mime = finfo_file($finfo, $filename);
|
||||
finfo_close($finfo);
|
||||
echo $mime;
|
||||
?>
|
||||
--EXPECT--
|
||||
application/vnd.ms-excel; charset=binary
|
BIN
ext/fileinfo/tests/bug79756.xls
Normal file
BIN
ext/fileinfo/tests/bug79756.xls
Normal file
Binary file not shown.
@ -139,11 +139,14 @@ PHPAPI char *php_ctime_r(const time_t *clock, char *buf)
|
||||
local_lock(CTIME_R);
|
||||
|
||||
tmp = ctime(clock);
|
||||
strcpy(buf, tmp);
|
||||
if (tmp) {
|
||||
strcpy(buf, tmp);
|
||||
tmp = buf;
|
||||
}
|
||||
|
||||
local_unlock(CTIME_R);
|
||||
|
||||
return buf;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endif
|
||||
@ -157,11 +160,14 @@ PHPAPI char *php_asctime_r(const struct tm *tm, char *buf)
|
||||
local_lock(ASCTIME_R);
|
||||
|
||||
tmp = asctime(tm);
|
||||
strcpy(buf, tmp);
|
||||
if (tmp) {
|
||||
strcpy(buf, tmp);
|
||||
tmp = buf;
|
||||
}
|
||||
|
||||
local_unlock(ASCTIME_R);
|
||||
|
||||
return buf;
|
||||
return tmp;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user