A specific asset fails to display its 'view asset' page
Expected Behavior (or desired behavior if a feature request)
This is just on one particular asset, out the blue, but possibly linked to the user somehow.
Click on asset tag to view it and the asset information screen is displayed.
Actual Behavior
It loads part of the page then displays an exception error. The partly displayed page is not styled.
FatalErrorException in c23e1f397081f08a96f5b7244cfad1110445da61.php line 673:
Call to a member function fullName() on null
Please confirm you have done the following before posting your bug report:
- [x] I have enabled debug mode
- [x] I have read checked the Common Issues page
Please provide answers to these questions before posting your bug report:
- Version of Snipe-IT you're running - 3.6
- What OS and web server you're running Snipe-IT on - IIS8
- What method you used to install Snipe-IT (install.sh, manual installation, docker, etc) - manual
- WITH DEBUG TURNED ON, if you're getting an error in your browser, include that error.
Whoops, looks like something went wrong.
1/1
FatalErrorException in c23e1f397081f08a96f5b7244cfad1110445da61.php line 673:
Call to a member function fullName() on null
- in c23e1f397081f08a96f5b7244cfad1110445da61.php line 673
-
What specific Snipe-IT page you're on, and what specific element you're interacting with to trigger the error - http://snipeit/hardware/1042/view
-
If a stacktrace is provided in the error, include that too.
-
Any errors that appear in your browser's error console.
-
Confirm whether the error is reproduceable on the demo. - No
-
Include any additional information you can find in
app/storage/logsand your webserver's logs. - none different to what I've shown. -
Include what you've done so far in the installation, and if you got any error messages along the way.
-
Indicate whether or not you've manually edited any data directly in the database - No.
Is there anything unusual about that asset? Was it deleted or anything?
Also, can you show me the lines around 23e1f397081f08a96f5b7244cfad1110445da61.php line 673? A few above and a few below.
Renaming/removing the file in /storage/framework/views won't help?
that bug for me shows up after "signature" was enabled.
- it usually happens after asset was "signed" by the user and when you try to edit / save settings of that asset then that bug kicks in.
- for me removing the file ( asset ) helps but then you lose all the history so that is not a solution
- I will try to test it today and submit code that you requested
I have written about that in a topic concerning asset acceptance and sig_filename
Lines 670 - 676:
<?php else: ?>
<del><?php echo e($log->target->showAssetName()); ?></del>
<?php endif; ?>
<?php elseif(($log->action_type=='accepted') || ($log->action_type=='declined')): ?>
<?php echo e($log->item->assigneduser->fullName()); ?>
<?php else: ?>
As regards anything unusual, this particular asset was checked out to a manually created user, FirstName 'Snipe' , LastName 'test', Could just be a coincidence or there's something it doesn't like about the user somehow. It hasn't been deleted.
rozowykubek - the scenario you described tests out fine at my end.
rozowykubek - the scenario you described tests out fine at my end.
Actually that's bad but first part of your scenario matches mine that is "checked out to user". Although once it happened after asset was checked in.
Do you have signature feature enabled when it happens ? cause I don't have that issue with signature turned off ( fresh installation - 2 users nothing more )
@mmcleod82 Can you find the DB record with that entry in the action_logs table?
yes I've found the DB records for that asset - what are you interested in?
Can you tell if it's the update that it's choking on?
Well, when I've seen this happen once before, it chokes during checking in (it does checkin though), then on subsequent attempts to view the asset.
the line with id 4472 looks like the culprit to me. It has a target_id set, but not a target type...
Does changing the target_type on that line to App\Models\User fix it for you? It's a missing line in ViewAssetsController, I'll need to do something to retrofit it, but this should fix future issues.
diff --git a/app/Http/Controllers/ViewAssetsController.php b/app/Http/Controllers/ViewAssetsController.php
index 6febfd5..acbe21b 100755
--- a/app/Http/Controllers/ViewAssetsController.php
+++ b/app/Http/Controllers/ViewAssetsController.php
@@ -379,6 +379,7 @@ class ViewAssetsController extends Controller
}
$logaction->target_id = $findlog->target_id;
+ $logaction->target_type = User::class;
$logaction->note = e(Input::get('note'));
$logaction->updated_at = date("Y-m-d H:i:s");
Well, that's a different bug actually. I can't reproduce what you are seeing here..
ok, shall I just try changing the target_type on that line to App\Models\User anyway?
If not, is there anything dirty you can do to allow it to display?
You can try changing the target type, but I don't think it will fix this issue...
I can see why an issue would appear if the checkout was declined, but it doesn't look like that is in your table.
Oh yes, now I see. Changing the target type will fix it. Those lines are only hit if we don't have a target.
Yes, setting the target_type worked. What might of caused it not to be set then do you think?