mirror of
https://github.com/php/php-src.git
synced 2024-11-24 18:34:21 +08:00
Merge branch 'PHP-7.3' into PHP-7.4
* PHP-7.3: Deny cloning of fileinfo objects
This commit is contained in:
commit
9353f11bd2
@ -218,6 +218,7 @@ PHP_MINIT_FUNCTION(finfo)
|
||||
memcpy(&finfo_object_handlers, &std_object_handlers, sizeof(zend_object_handlers));
|
||||
finfo_object_handlers.offset = XtOffsetOf(finfo_object, zo);
|
||||
finfo_object_handlers.free_obj = finfo_objects_free;
|
||||
finfo_object_handlers.clone_obj = NULL;
|
||||
|
||||
le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, "file_info", module_number);
|
||||
|
||||
|
27
ext/fileinfo/tests/clone_serialize.phpt
Normal file
27
ext/fileinfo/tests/clone_serialize.phpt
Normal file
@ -0,0 +1,27 @@
|
||||
--TEST--
|
||||
Cloning and serializing finfo is not supported
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
$finfo = new finfo;
|
||||
var_dump($finfo->buffer("Test string"));
|
||||
try {
|
||||
$finfo2 = clone $finfo;
|
||||
var_dump($finfo2->buffer("Test string"));
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
try {
|
||||
$finfo3 = unserialize(serialize($finfo));
|
||||
var_dump($finfo3->buffer("Test string"));
|
||||
} catch (Error $e) {
|
||||
echo $e->getMessage(), "\n";
|
||||
}
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
string(%d) "%s"
|
||||
Trying to clone an uncloneable object of class finfo
|
||||
|
||||
Warning: finfo::buffer(): The invalid fileinfo object. in %s on line %d
|
||||
bool(false)
|
Loading…
Reference in New Issue
Block a user