Skip to content

Commit

Permalink
Fix null object on PHP8 (on Upload Image) as well
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienheraud committed May 1, 2023
1 parent 66f057f commit 34f7404
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion plugins/cck_field/upload_file/includes/afterstore.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@

if ( JFile::upload( $tmp_name, $location, false, $allowUnsafe, $safeFileOptions ) ) {
$value = $file_location;
if( isset( $fields[$name] ) && is_object( $fields[$name] ) ) {

if ( isset( $fields[$name] ) && is_object( $fields[$name] ) ) {
$fields[$name]->value = $value;
}
} else {
Expand Down
5 changes: 4 additions & 1 deletion plugins/cck_field/upload_image/includes/afterstore.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,10 @@
$src_w = $image->getWidth();
$src_h = $image->getHeight();
$value = $file_location;
$fields[$name]->value = $value;

if ( isset( $fields[$name] ) && is_object( $fields[$name] ) ) {
$fields[$name]->value = $value;
}

$options['thumb0_process'] = $options['image_process'];
$options['thumb0_width'] = $options['image_width'];
Expand Down

0 comments on commit 34f7404

Please sign in to comment.