Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERROR: htmlspecialchars() expects parameter 1 to be string, array given #353

Closed
ambengers opened this issue Oct 8, 2018 · 6 comments
Closed

Comments

@ambengers
Copy link

I'm not actually sure where the issue is coming from, but suddenly our deployer stopped working because of this..

htmlspecialchars() expects parameter 1 to be string, array given (View: /Users/marvinquezon/codes/cms/vendor/mpociot/laravel-apidoc-generator/src/resources/views/partials/route.blade.php) {"exception":"[object] (ErrorException(code: 0): htmlspecialchars() expects parameter 1 to be string, array given (View: /Users/marvinquezon/codes/cms/vendor/mpociot/laravel-apidoc-generator/src/resources/views/partials/route.blade.php) at /Users/marvinquezon/codes/cms/vendor/laravel/framework/src/Illuminate/Support/helpers.php:560, ErrorException(code: 0): htmlspecialchars() expects parameter 1 to be string, array given at /Users/marvinquezon/codes/cms/vendor/laravel/framework/src/Illuminate/Support/helpers.php:560)

@strizh32
Copy link

strizh32 commented Oct 8, 2018

I'm not actually sure where the issue is coming from, but suddenly our deployer stopped working because of this..

htmlspecialchars() expects parameter 1 to be string, array given (View: /Users/marvinquezon/codes/cms/vendor/mpociot/laravel-apidoc-generator/src/resources/views/partials/route.blade.php) {"exception":"[object] (ErrorException(code: 0): htmlspecialchars() expects parameter 1 to be string, array given (View: /Users/marvinquezon/codes/cms/vendor/mpociot/laravel-apidoc-generator/src/resources/views/partials/route.blade.php) at /Users/marvinquezon/codes/cms/vendor/laravel/framework/src/Illuminate/Support/helpers.php:560, ErrorException(code: 0): htmlspecialchars() expects parameter 1 to be string, array given at /Users/marvinquezon/codes/cms/vendor/laravel/framework/src/Illuminate/Support/helpers.php:560)

same issue

@shalvah
Copy link
Contributor

shalvah commented Oct 8, 2018 via email

@strizh32
Copy link

strizh32 commented Oct 8, 2018

Can I get more of a stack trace, please?

`
➜ jwt git:(dev) ✗ php artisan api:generate --routePrefix="api/*" --noResponseCalls --noPostmanCollection
Processed route: [POST] api/auth/login
Processed route: [POST] api/auth/logout
Processed route: [POST] api/auth/refresh
Processed route: [POST] api/auth/me
Processed route: [GET] api/quizzes
Processed route: [GET] api/quizzes/{id}
Processed route: [POST] api/quizzes
Processed route: [PUT] api/quizzes/{id}
Processed route: [DELETE] api/quizzes/{id}
Processed route: [GET] api/questions
Processed route: [GET] api/questions/{id}
Processed route: [POST] api/questions
Processed route: [PUT] api/questions/{id}
Processed route: [DELETE] api/questions/{id}
Processed route: [GET] api/results
Processed route: [GET] api/results/{id}
Processed route: [POST] api/results
Processed route: [PUT] api/results/{id}
Processed route: [DELETE] api/results/{id}
Processed route: [GET] api/answers
Processed route: [GET] api/answers/{id}
Processed route: [POST] api/answers
Processed route: [PUT] api/answers/{id}
Processed route: [DELETE] api/answers/{id}

ErrorException : htmlspecialchars() expects parameter 1 to be string, array given (View: /Users/evgeny/Documents/Code/jwt/vendor/mpociot/laravel-apidoc-generator/src/resources/views/partials/route.blade.php)

at /Users/evgeny/Documents/Code/jwt/vendor/laravel/framework/src/Illuminate/Support/helpers.php:578
574| if ($value instanceof Htmlable) {
575| return $value->toHtml();
576| }
577|

578| return htmlspecialchars($value, ENT_QUOTES, 'UTF-8', $doubleEncode);
579| }
580| }
581|
582| if (! function_exists('ends_with')) {

Exception trace:

1 Illuminate\View\Engines\CompilerEngine::handleViewException(Object(ErrorException))
/Users/evgeny/Documents/Code/jwt/vendor/laravel/framework/src/Illuminate/View/Engines/PhpEngine.php:45

2 Mpociot\ApiDoc\Commands\GenerateDocumentation::Mpociot\ApiDoc\Commands{closure}()
[internal]:0

Please use the argument -v to see more details.
`

@strizh32
Copy link

strizh32 commented Oct 8, 2018

public function rules()
{
return [
'question_id' => 'integer|required',
'attachment_id' => 'integer',
'feedback_attachment_id' => 'integer',
'embed_id' => 'integer',
'body' => 'text',
'feedback' => 'text',
'correct' => 'boolean',
'results' => 'array',
'results.result_id' => 'integer',
'results.result_value' => 'integer',
];
}
all because of 'results' => 'array'

@pashamesh
Copy link

I also faced with such issue. I noticed the following: $parameter['value'] at https://github.com/mpociot/laravel-apidoc-generator/blob/master/src/resources/views/partials/route.blade.php#L16 comes as array. From previous comment example results attribute is array.

@shalvah
Copy link
Contributor

shalvah commented Oct 8, 2018

This should be fixed now (2.1.7)

@shalvah shalvah closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants