snipe / snipe-it

A free open source IT asset/license management system
https://snipeitapp.com
GNU Affero General Public License v3.0
11k stars 3.17k forks source link

Information entered for custom fields is not saved #2118

Closed mochange closed 8 years ago

mochange commented 8 years ago

Expected Behavior (or desired behavior if a feature request)

All data fields should save the information provided


Actual Behavior

When I add or update an asset any information entered in custom fields is not saved.


Please confirm you have done the following before posting your bug report:


Please provide answers to these questions before posting your bug report:

[Wed Jun 01 05:08:42.916593 2016] [:error] [pid 5399] [client xxx.xxx.xxx.172:51594] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/snipeit/bootstrap/cache/compiled.php:13761\nStack trace:\n#0 /var/www/html/snipeit/bootstrap/cache/compiled.php(13695): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/html/snipeit/bootstrap/cache/compiled.php(13456): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(13554): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(13249): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(13220): Illuminate\Log\Writer->writeLog('error', Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#5 /var/www/html/snipeit/vendor/laravel/frame in /var/www/html/snipeit/bootstrap/cache/compiled.php on line 13761 [Wed Jun 01 05:16:01.645402 2016] [:error] [pid 5402] [client xxx.xxx.xxx.172:51645] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/snipeit/bootstrap/cache/compiled.php:13761\nStack trace:\n#0 /var/www/html/snipeit/bootstrap/cache/compiled.php(13695): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/html/snipeit/bootstrap/cache/compiled.php(13456): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(13554): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)\n#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(13249): Monolog\Logger->error(Object(UnexpectedValueException), Array)\n#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(13220): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueException), Array)\n#5 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(56): Illuminate\Log\Writer->error in /var/www/html/snipeit/bootstrap/cache/compiled.php on line 13761 [Wed Jun 01 05:16:01.647215 2016] [:error] [pid 5402] [client xxx.xxx.xxx.172:51645] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/snipeit/bootstrap/cache/compiled.php:13761\nStack trace:\n#0 /var/www/html/snipeit/bootstrap/cache/compiled.php(13695): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/html/snipeit/bootstrap/cache/compiled.php(13456): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(13554): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(13249): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(13220): Illuminate\Log\Writer->writeLog('error', Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#5 /var/www/html/snipeit/vendor/laravel/frame in /var/www/html/snipeit/bootstrap/cache/compiled.php on line 13761 [Wed Jun 01 05:38:40.795203 2016] [:error] [pid 5397] [client xxx.xxx.xxx.172:52221] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/snipeit/bootstrap/cache/compiled.php:13761\nStack trace:\n#0 /var/www/html/snipeit/bootstrap/cache/compiled.php(13695): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/html/snipeit/bootstrap/cache/compiled.php(13456): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(13554): Monolog\Logger->addRecord(400, Object(UnexpectedValueException), Array)\n#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(13249): Monolog\Logger->error(Object(UnexpectedValueException), Array)\n#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(13220): Illuminate\Log\Writer->writeLog('error', Object(UnexpectedValueException), Array)\n#5 /var/www/html/snipeit/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php(56): Illuminate\Log\Writer->error in /var/www/html/snipeit/bootstrap/cache/compiled.php on line 13761 [Wed Jun 01 05:38:40.795932 2016] [:error] [pid 5397] [client xxx.xxx.xxx.172:52221] PHP Fatal error: Uncaught exception 'UnexpectedValueException' with message 'The stream or file "/var/www/html/snipeit/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied' in /var/www/html/snipeit/bootstrap/cache/compiled.php:13761\nStack trace:\n#0 /var/www/html/snipeit/bootstrap/cache/compiled.php(13695): Monolog\Handler\StreamHandler->write(Array)\n#1 /var/www/html/snipeit/bootstrap/cache/compiled.php(13456): Monolog\Handler\AbstractProcessingHandler->handle(Array)\n#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(13554): Monolog\Logger->addRecord(400, Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(13249): Monolog\Logger->error(Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(13220): Illuminate\Log\Writer->writeLog('error', Object(Symfony\Component\Debug\Exception\FatalErrorException), Array)\n#5 /var/www/html/snipeit/vendor/laravel/frame in /var/www/html/snipeit/bootstrap/cache/compiled.php on line 13761 [Thu Jun 02 10:56:12.747815 2016] [:error] [pid 2155] [client xxx.xxx.xxx.172:53564] PHP Warning: Uncaught exception 'ErrorException' with message 'Object of class Illuminate\Support\Collection could not be converted to int' in /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php:374\nStack trace:\n#0 /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php(374): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Object of class...', '/var/www/html/s...', 374, Array)\n#1 [internal function]: App\Http\Controllers\AssetModelsController->getClone('1')\n#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(9361): call_user_func_array(Array, Array)\n#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(9423): Illuminate\Routing\Controller->callAction('getClone', Array)\n#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(9403): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\AssetModelsController), Object(Illuminate\Routing\Route), 'getClone')\n#5 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing{closure}(Object(Ill in /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php on line 374, referer: http://xxx.xxx.xxx.30/hardware/models/1/view [Thu Jun 02 10:56:12.749024 2016] [:error] [pid 2155] [client xxx.xxx.xxx.172:53564] PHP Fatal error: Unsupported operand types in /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php on line 374, referer: http://xxx.xxx.xxx.30/hardware/models/1/view [Thu Jun 02 10:56:19.120796 2016] [:error] [pid 6798] [client xxx.xxx.xxx.172:53565] PHP Warning: Uncaught exception 'ErrorException' with message 'Object of class Illuminate\Support\Collection could not be converted to int' in /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php:374\nStack trace:\n#0 /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php(374): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'Object of class...', '/var/www/html/s...', 374, Array)\n#1 [internal function]: App\Http\Controllers\AssetModelsController->getClone('1')\n#2 /var/www/html/snipeit/bootstrap/cache/compiled.php(9361): call_user_func_array(Array, Array)\n#3 /var/www/html/snipeit/bootstrap/cache/compiled.php(9423): Illuminate\Routing\Controller->callAction('getClone', Array)\n#4 /var/www/html/snipeit/bootstrap/cache/compiled.php(9403): Illuminate\Routing\ControllerDispatcher->call(Object(App\Http\Controllers\AssetModelsController), Object(Illuminate\Routing\Route), 'getClone')\n#5 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing{closure}(Object(Ill in /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php on line 374, referer: http://xxx.xxx.xx.30/hardware/models/1/view [Thu Jun 02 10:56:19.120953 2016] [:error] [pid 6798] [client xxx.xxx.xxx.172:53565] PHP Fatal error: Unsupported operand types in /var/www/html/snipeit/app/Http/Controllers/AssetModelsController.php on line 374, referer: http://xxx.xxx.xxx.30/hardware/models/1/view

dmeltzer commented 8 years ago

Two questions:

1) Was this a fresh install with install.sh or an upgrade from a 2.x install with install.sh?

2) What version of php are you on? The error looks to be our adding a collection to an array, but that code hasn't changed since forever so I'm wondering if it's a php configuration thing. I've seen a siimlar issue in testing something somewhere but I can't remember where.

Edit: Actually that error in your logs has nothing to do with custom fields... is the timestamp on the last error there correct for when it occured or is that referring to something else?

mochange commented 8 years ago

Fresh install of alpha 2 via install.sh script with 3.0 beta files copied over PHP 5.6.22

dmeltzer commented 8 years ago

A few things.

1) I've tracked down the error in the log and I think it's unrelated to your issue. Patch coming shortly. 2) When you copied files over the permissions got overridden, so storage/logs/laravel.log can't be written to. Try the following and then reproduce the error and check the log.

sudo chown -R apache:apache /var/www/html/snipeit (or wherever it is)
sudo chmod -R 755 storage/
sudo chmod -R 755 public/uploads

Thanks!

mochange commented 8 years ago

Yea I realized that the log couldn't be related when you asked about the timestamp

mochange commented 8 years ago

Nothing new in laravel.log but I got this in the snipeIT.error.log [Sun Jun 05 10:56:45.885374 2016] [:error] [pid 1073] [client xxx.xxx.xxx.172:56326] PHP Fatal error: Trait 'App\Models\CompanyableTrait' not found in /var/www/html/snipeit/app/Models/Consumable.php on line 17, referer: http://xxx.xxx.xx.30/ [Sun Jun 05 10:56:52.334131 2016] [:error] [pid 2512] [client xxx.xxx.xxx.172:56332] PHP Fatal error: Class 'App\Providers\RouteServiceProvider' not found in /var/www/html/snipeit/bootstrap/cache/compiled.php on line 7595

mochange commented 8 years ago

tried a clean 3.0 beta install (cleared html/snipeit and deleted the database) here is the log snipeit-install.txt

lots of errors chcon: can't apply partial context to unlabeled file ‘lang’ chcon: can't apply partial context to unlabeled file ‘resources’ chcon: can't apply partial context to unlabeled file ‘/var/www/html/snipeit/’

snipe commented 8 years ago

That sounds like an SELinux problem

mochange commented 8 years ago

I wiped out the Snipe IT install dropped the database and started from scratch with v3 beta3 and all is working well.