Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 295276

Wrong check for file status in _editor_record_file_usage

$
0
0

If you load a file entity through entity manager $file->status is of "FieldItemList" type.
The condition in "_editor_record_file_usage" function is :

     if ($file->status !== FILE_STATUS_PERMANENT) 

As type of FILE_STATUS_PERMANENT is "int" we have a wrong assumption that file is not permanent.
Field values should be accessed as $entity->field_name->value

Solution :
Change condition to

 if (!$file->isPermanent()) 

Viewing all articles
Browse latest Browse all 295276

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>