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

Verify if is a string httpful/src/Httpful/Request.php on line 953 #168

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Verify if is a string httpful/src/Httpful/Request.php on line 953 #168

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Mar 6, 2015

Resolves the warning:

PHP Warning: mb_strlen() expects parameter 1 to be string, array given in httpful/src/Httpful/Request.php on line 953

@nategood
Copy link
Owner

nategood commented Mar 8, 2015

The serialized payload that we pass to this method should always be a string. What case were you running into where this wasn't the case? @michelwilhelm

@ghost
Copy link
Author

ghost commented Mar 8, 2015

This is a snippet:

$animal = [
  'var' => 'foo'
];

$response = \Httpful\Request::post($request)->
        sendsJson()->
        body($animal)->
        addHeader('Authorization', 'Token  '.$user['token'])->
        addHeader('Content-Type', 'application/json')->
        addHeader('Accept', 'application/json')->
        send();

Copy link
Owner

@nategood nategood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah if serialized_payload isn't a sting there should be a slew of other problems. I would prefer this solution be fixed by casting the call of Request::_serializePayload to string.

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

Successfully merging this pull request may close these issues.

2 participants