AsgardCms / Platform

A modular multilingual CMS built with Laravel 5.
https://asgardcms.com/
MIT License
781 stars 241 forks source link

Media upload error #135

Closed ruscon closed 8 years ago

ruscon commented 8 years ago

After upload image new last version of code

Method [validateMaxSize] does not exist.
vendor/laravel/framework/src/Illuminate/Validation/Validator.php#2676
BadMethodCallException
            return $this->callExtension($rule, $parameters);
        }

        throw new BadMethodCallException("Method [$method] does not exist.");
    }
}

I have default asgard.media.config.php And i uploaded image ~100 kb (max 5 mb) All uploaded images with fail

nWidart commented 8 years ago

Hello,

I wasn't able to reproduce this error here. Are you on windows ?

ruscon commented 8 years ago

mac os

nWidart commented 8 years ago

What version of the media module are you using ?

Could you maybe try to add a dd() in here and see if it get's called ?

ruscon commented 8 years ago

What version of the media module are you using ?

1.14.2

[2015-11-30 17:23:30] local.ERROR: exception 'BadMethodCallException' with message 'Method [validateMaxSize] does not exist.' in xxx/vendor/laravel/framework/src/Illuminate/Validation/Validator.php:2676
Stack trace:
#0 xxx/vendor/laravel/framework/src/Illuminate/Validation/Validator.php(362): Illuminate\Validation\Validator->__call('validateMaxSize', Array)
#1 xxx/vendor/laravel/framework/src/Illuminate/Validation/Validator.php(362): Felixkiss\UniqueWithValidator\ValidatorExtension->validateMaxSize('file', Object(Symfony\Component\HttpFoundation\File\UploadedFile), Array, Object(Felixkiss\UniqueWithValidator\ValidatorExtension))
#2 xxx/vendor/laravel/framework/src/Illuminate/Validation/Validator.php(314): Illuminate\Validation\Validator->validate('file', 'maxSize')
#3 xxx/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php(24): Illuminate\Validation\Validator->passes()
#4 xxx/vendor/laravel/framework/src/Illuminate/Validation/ValidationServiceProvider.php(32): Illuminate\Foundation\Http\FormRequest->validate()
#5 xxx/vendor/laravel/framework/src/Illuminate/Container/Container.php(1020): Illuminate\Validation\ValidationServiceProvider->Illuminate\Validation\{closure}(Object(Modules\Media\Http\Requests\UploadMediaRequest), Object(Illuminate\Foundation\Application))
#6 xxx/vendor/laravel/framework/src/Illuminate/Container/Container.php(985): Illuminate\Container\Container->fireCallbackArray(Object(Modules\Media\Http\Requests\UploadMediaRequest), Array)
#7 xxx/vendor/laravel/framework/src/Illuminate/Container/Container.php(646): Illuminate\Container\Container->fireResolvingCallbacks('Modules\\Media\\H...', Object(Modules\Media\Http\Requests\UploadMediaRequest))
#8 xxx/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(674): Illuminate\Container\Container->make('Modules\\Media\\H...', Array)
#9 xxx/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(87): Illuminate\Foundation\Application->make('Modules\\Media\\H...')
#10 xxx/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(61): Illuminate\Routing\ControllerDispatcher->transformDependency(Object(ReflectionParameter), Array, Array)
#11 xxx/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(44): Illuminate\Routing\ControllerDispatcher->resolveMethodDependencies(Array, Object(ReflectionMethod))
#12 xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(162): Illuminate\Routing\ControllerDispatcher->resolveClassMethodDependencies(Array, Object(Modules\Media\Http\Controllers\Api\MediaController), 'store')
#13 xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(112): Illuminate\Routing\ControllerDispatcher->call(Object(Modules\Media\Http\Controllers\Api\MediaController), Object(Illuminate\Routing\Route), 'store')
#14 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#15 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#16 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#17 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#18 xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#19 xxx/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(69): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(Modules\Media\Http\Controllers\Api\MediaController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'store')
#20 xxx/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'Modules\\Media\\H...', 'store')
#21 xxx/vendor/laravel/framework/src/Illuminate/Routing/Route.php(134): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
#22 xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(704): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#23 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
#24 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#25 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#26 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#27 xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(706): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#28 xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(671): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
#29 xxx/vendor/laravel/framework/src/Illuminate/Routing/Router.php(631): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#30 xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(236): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#31 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
#32 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#33 xxx/vendor/barryvdh/laravel-debugbar/src/Middleware/Debugbar.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#34 [internal function]: Barryvdh\Debugbar\Middleware\Debugbar->handle(Object(Illuminate\Http\Request), Object(Closure))
#35 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#36 xxx/app/Http/Middleware/VerifyCsrfToken.php(34): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#37 [internal function]: App\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
#38 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#39 xxx/vendor/maatwebsite/laravel-sidebar/src/Middleware/ResolveSidebars.php(35): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#40 [internal function]: Maatwebsite\Sidebar\Middleware\ResolveSidebars->handle(Object(Illuminate\Http\Request), Object(Closure))
#41 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#42 xxx/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#43 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#44 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#45 xxx/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#46 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
#47 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#48 xxx/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#49 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
#50 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#51 xxx/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#52 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
#53 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#54 xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(42): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#55 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
#56 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
#57 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
#58 xxx/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
#59 xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#60 xxx/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
#61 xxx/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
nWidart commented 8 years ago

And is that file called ?

ruscon commented 8 years ago

validateMaxSize not called

nWidart commented 8 years ago

Hm ok, so next you can try a dd here: https://github.com/AsgardCms/Media/blob/develop/Providers/MediaServiceProvider.php#L87 in the callback.

It is very strange it doesn't get called on your setup

nWidart commented 8 years ago

Creating a clean install + uploading a file is working fine. So I'm thinking it has to be related to your setup, maybe something you customised.

ruscon commented 8 years ago
private function registerMaxFolderSizeValidator()
{
        dd(); // called
        Validator::resolver(function ($translator, $data, $rules, $messages, $attributes) {
                echo dd($translator, $data, $rules, $messages, $attributes);
            return new MaxFolderSizeValidator($translator, $data, $rules, $messages, $attributes);
        });
}
private function registerMaxFolderSizeValidator()
{
        Validator::resolver(function ($translator, $data, $rules, $messages, $attributes) {
                dd($translator, $data, $rules, $messages, $attributes); // not called
            return new MaxFolderSizeValidator($translator, $data, $rules, $messages, $attributes);
        });
}
ruscon commented 8 years ago

all asgard modules in xxx/Modules under gitignore I delete it and run composer install - no luck.

Old composer update info slice

  - Removing asgardcms/core-module (1.10.0)
  - Installing asgardcms/core-module (1.18.0)
    Downloading: 100%

  - Removing asgardcms/user-module (1.8.0)
  - Installing asgardcms/user-module (1.13.1)
    Downloading: 100%

  - Removing asgardcms/setting-module (1.11.0)
  - Installing asgardcms/setting-module (1.12.1)
    Downloading: 100%

  - Removing intervention/image (2.3.2)
  - Installing intervention/image (2.3.4)
    Downloading: 100%

  - Removing asgardcms/media-module (1.10.0)
  - Installing asgardcms/media-module (1.14.1)
    Downloading: 100%

  - Removing asgardcms/page-module (1.6.0)
  - Installing asgardcms/page-module (1.10.1)
    Downloading: 100%

  - Removing asgardcms/menu-module (1.10.1)
  - Installing asgardcms/menu-module (1.13.0)
    Downloading: 100%

  - Removing asgardcms/workshop-module (1.9.0)
  - Installing asgardcms/workshop-module (1.11.0)
    Downloading: 100%

  - Removing asgardcms/flatly-theme (1.1.1)
  - Installing asgardcms/flatly-theme (1.2.0)
    Downloading: 100%

  - Removing asgardcms/adminlte-theme (1.5.0)
  - Installing asgardcms/adminlte-theme (1.11.0)
    Downloading: 100%
nWidart commented 8 years ago

Hm ok, very odd. Could you zip your application with an export of your database, upload it somewhere and send it here ?

ruscon commented 8 years ago

ok

ruscon commented 8 years ago

Send link via mail

nWidart commented 8 years ago

Alright thank you.

So the error is due to the felixkiss/uniquewith-validator package. When removing that one, the upload works.

ruscon commented 8 years ago

omg! big thx :beer:

ruscon commented 8 years ago

If you want, you can see some custom logic in backend: ajax grid, php grid library integration. Dashboard not working normal And blade not working with the section into other section =/ sadly

nWidart commented 8 years ago

I don't understand a thing, but it looks very good. :smile:

What I don't understand though, is why https://github.com/felixkiss/uniquewith-validator/blob/master/src/Felixkiss/UniqueWithValidator/UniqueWithValidatorServiceProvider.php#L27 overwrites all other custom translators.

ruscon commented 8 years ago

can you open the bug for him ?

ruscon commented 8 years ago

I don't understand a thing

russian lang :)

but it looks very good

i think need to create something like this https://sonata-project.org/bundles/admin/2-3/doc/index.html But lighter :)

nWidart commented 8 years ago

The sonata project could be compared to AsgardCms tho in my opinion.