You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 21, 2020. It is now read-only.
After trying to use the last 1.3.1 version early released, i issued with this error notice :
Notice: Uninitialized string offset: 0 in ../vendor/zfcampus/zf-content-negotiation/src/ContentTypeListener.php on line 105
This notice appears on PATCH / PUT / DELETE request, whenever you did not pass any HTTP body − which is possible following standards.
As we can see within the code, trying to auto-detect JSON format in body when no Content-Type is provided is fine, but it must first detect if any body has been provided...
As reported in zfcampus#96, since zfcampus#94 and the 1.3.1 release, if the body content
for a PUT, PATCH, or DELETE call is empty, an "Uninitialized string
offset: 0" notice is raised.
This patch does the following:
- Adds tests missing from the original patch created for zfcampus#94, verifying
that JSON deserialization occurs for those HTTP methods if the content
looks like JSON but no Content-Type header was present.
- Adds tests demonstrating that _empty_ content in those same situations
will not result in an error, and a fix to the code to make that test
pass.
As reported in zfcampus#96, since zfcampus#94 and the 1.3.1 release, if the body content
for a PUT, PATCH, or DELETE call is empty, an "Uninitialized string
offset: 0" notice is raised.
This patch adds tests missing from the original patch created for zfcampus#94,
verifying that JSON deserialization occurs for those HTTP methods if the
content looks like JSON but no Content-Type header was present. The new
cases also include scenarios where no content is present. A fix is
introduced to the `ContentTypeListener` to ensure the notice is no
longer raised.
Hello,
After trying to use the last 1.3.1 version early released, i issued with this error notice :
Notice: Uninitialized string offset: 0 in ../vendor/zfcampus/zf-content-negotiation/src/ContentTypeListener.php on line 105
This notice appears on PATCH / PUT / DELETE request, whenever you did not pass any HTTP body − which is possible following standards.
As we can see within the code, trying to auto-detect JSON format in body when no Content-Type is provided is fine, but it must first detect if any body has been provided...
zf-content-negotiation/src/ContentTypeListener.php
Line 105 in 4bf815b
The text was updated successfully, but these errors were encountered: