laravel / nova-issues

554 stars 34 forks source link

mb_strtoupper() expects parameter 1 to be string, array given in /vendor/laravel/nova/resources/views/layout.blade.php #2804

Closed chrhe closed 4 years ago

chrhe commented 4 years ago

Description:

After an update by composer (new version of Nova 3.8.3), i can't access to /nova. I got this error : ErrorException mb_strtoupper() expects parameter 1 to be string, array given (View: /[LARAVEL PATH]/vendor/laravel/nova/resources/views/layout.blade.php).

All is working if i downgrade the version of nova to 3.8.2. All the other parts of my website are working fine (outside of /nova).

This error looks to take place in the line 71 of the layout: window.config = @json(\Laravel\Nova\Nova::jsonVariables(request()));

All the error stack is describe here : https://flareapp.io/share/Bm091nPx#F1

My plugins are the following : "require": { "php": "^7.2.5", "appstract/nova-signature-field": "^1.1", "barryvdh/laravel-translation-manager": "^0.5.8", "beyondcode/nova-tinker-tool": "^1.1", "binarybuilds/nova-advanced-command-runner": "^2.0", "cache/array-adapter": "^1.0", "caouecs/laravel-lang": "^6.0", "chrhe/geocode-field": "", "coderello/laravel-nova-lang": "^1.4", "coreproc/nova-system-info-card": "^0.0.1", "cviebrock/eloquent-sluggable": "^7.0", "darkaonline/l5-swagger": "^7.0", "davidpiesse/nova-maintenance-mode": "^0.0.5", "davidpiesse/nova-map": "^0.0.5", "doctrine/dbal": "^2.10", "ek0519/quilljs": "^0.1.9", "eminiarts/nova-tabs": "^1.2", "fideloper/proxy": "^4.2", "fruitcake/laravel-cors": "^1.0", "geo6/geocoder-php-addok-provider": "^1.2", "geocoder-php/cache-provider": "^4.2", "geocoder-php/chain-provider": "^4.2", "geocoder-php/nominatim-provider": "^5.2", "grimzy/laravel-mysql-spatial": "2.2.", "guzzlehttp/guzzle": "^6.3", "intervention/image": "^2.5", "johnathan/nova-trumbowyg": "^1.0", "kabbouchi/nova-logs-tool": "^0.2.0", "kreitje/nova-horizon-stats": "^0.3.0", "laraning/nova-time-field": "^0.3.0", "laravel/framework": "^7.0", "laravel/helpers": "^1.2", "laravel/horizon": "^4.3", "laravel/nova": "~3.0", "laravel/sanctum": "^2.4", "laravel/telescope": "^3.5", "laravel/tinker": "^2.0", "laravel/ui": "^2.0", "laravolt/avatar": "^3.2", "lavary/laravel-menu": "^1.7", "lorisleiva/laravel-deployer": "^0.3.2", "mariuzzo/laravel-js-localization": "^1.6", "mdixon18/fontawesome": "^0.1.1", "michielkempen/nova-order-field": "^2.0", "predis/predis": "^1.1", "propaganistas/laravel-phone": "^4.2", "sbine/route-viewer": "^0.0.7", "shivanshrajpoot/nova-create-or-add": "^0.0.1", "spatie/eloquent-sortable": "^3.8", "spatie/laravel-permission": "^3.13", "spatie/laravel-translatable": "^4.3", "spatie/nova-translatable": "^3.0", "teamtnt/laravel-scout-tntsearch-driver": "^8.3", "tightenco/ziggy": "^0.9.4", "toin0u/geocoder-laravel": "^4.3", "vink/nova-cache-card": "^1.0", "vyuldashev/nova-permission": "^2.9", "yassi/nova-nested-form": "^3.0", "ynacorp/nova-swatches": "^1.0" },

davidhemphill commented 4 years ago

There appears to be an error in the translations of either your Nova components or one of the installed third-party packages. I would check to see if there's updates for any packages you use.

monaye commented 4 years ago

@chrhe I am having same issue as well. Please let me know if you already solved (fount the package that caused).

monaye commented 4 years ago

@davidhemphill I think this error happen if exisitng app have a translation scope matched to nova resouce name. I beleive due to this change https://github.com/laravel/nova/pull/910

ekandreas commented 4 years ago

Same problem here.

chrhe commented 4 years ago

I fixed my problem, @monaye you was right, it was a translation file called 'user.php', once I put it with datas inside I got the error. i fixed all by changing all my translations domains. Thanks

camaech commented 4 years ago

Had this same issue. So anyone who happened to have a translation file with the same name as a nova resource will now not be able to log into Nova without this error? What's the rationale behind this @davidhemphill? Thanks

roccoe commented 4 years ago

@camaech Nova now tries to find translations of your resource names in singular and plural form. If you use your resource names also as file names in your lang files, it can conflict. I resolved this issue, by adding translation strings for our resource names to the lang files (en.json or your locale, if you use another default language) in the nova translation directory (resources/lang/vendor/nova). You could also override the label and singularLabel methods in your resource classes.

It would be nice, if the documentation would inform about this functionality. It is not clear that Nova tries to resolve the resource names like that.

pmochine commented 4 years ago

For future readers (I make it short and easy to understand): Go to app/Nova and read all your Resource names while comparing all your lang/*/*.php lang files. If something is matching, try to rename the lang file and the problem is gone.

crynobone commented 4 years ago

To add, the issue has been fixed with v3.12.0

jorgenb commented 4 years ago

@crynobone

To add, the issue has been fixed with v3.12.0

I am getting this same error on a fresh L8 v8.13.0 and Nova v3.14.0 install:

Steps:

  1. Add a new locale to resources/lang. E.g. nb.
  2. Add a file named action.php to the resources/lang/en and the resources/lang/nb folders.
  3. Change the default locale in the config/app.php file to 'locale' => 'nb',

More info: https://flareapp.io/share/v5pgMAE7#F89

crynobone commented 4 years ago

@jorgenb please create a new issue with full reproducing example/code.