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

Fix byte length counting if strlen overloading used #18

Merged
merged 1 commit into from
Oct 30, 2013
Merged

Fix byte length counting if strlen overloading used #18

merged 1 commit into from
Oct 30, 2013

Conversation

alexeymorozov
Copy link
Contributor

Function strlen() counts characters instead of bytes if mbstring.func_overload is used in php.ini so Content-Length header gets a wrong value.

I changed strlen() call to mb_strlen() with "8bit" encoding as suggested here http://www.php.net/manual/ru/function.mb-strlen.php#77040

May be we can even get rid of setting Content-Length explicitly?

@@ -55,8 +55,8 @@ public function send()
// get content to send
$response = $this->getContent();
// set Content-Length header
header('Content-Length: '. strlen($response));
header('Content-Length: ' . mb_strlen($response, '8bit'));
Copy link
Member

Choose a reason for hiding this comment

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

Please check that mb_strlen() is available before to use or use strlen() function instead: https://github.com/symfony/Validator/blob/v2.3.6/Constraints/LengthValidator.php#L40

@alexeymorozov
Copy link
Contributor Author

Updated and squashed the PR.

@francisbesset francisbesset merged commit ed0846d into BeSimple:master Oct 30, 2013
ratnayake added a commit to ratnayake/BeSimpleSoap that referenced this pull request Oct 3, 2014
Add Basic auth to read from config.yml file
you can view example from
src\BeSimple\SoapBundle\Resources\doc\soapclient\configuration.rst
line BeSimple#18 onwards
data219 pushed a commit to Preis24/BeSimpleSoap that referenced this pull request Nov 4, 2015
Add Basic auth to read from config.yml file
you can view example from
src\BeSimple\SoapBundle\Resources\doc\soapclient\configuration.rst
line BeSimple#18 onwards
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