Skip to content
This repository was archived by the owner on Sep 24, 2018. It is now read-only.

Conversation

@thebatclaudio
Copy link
Contributor

No description provided.

@rmccue
Copy link
Member

rmccue commented Mar 2, 2016

Thanks for the pull request. Is there any reason for this PR? As far as I'm aware, PHP doesn't throw warnings or notices if you try to unset a non-existent variable/index, so it's safe to call this regardless.

@thebatclaudio
Copy link
Contributor Author

Hello, on Ubuntu 14.04 LTS with Nginx 1.4.6 and PHP 5.5.9 i get this error everytime. So I solved the problem in this way

@rmccue
Copy link
Member

rmccue commented Mar 2, 2016

What error are you getting?

@thebatclaudio
Copy link
Contributor Author

I get this error:

PHP Fatal error: Cannot unset string offsets in /usr/share/nginx/website/wp-content/plugins/rest-api/lib/endpoints/class-wp-rest-controller.php on line 193

@BE-Webdesign
Copy link
Member

@rmccue There are other places in the WP API where there is an isset check before unset like in WP_REST_Controller->get_public_item_schema(). I tested it without the check and get Fatal errors as well.

@danielbachhuber danielbachhuber added this to the 2.0 Beta 13 milestone Mar 4, 2016
danielbachhuber added a commit that referenced this pull request Mar 4, 2016
Bug fix: check if $data[$key][$attribute] is set before unset it
@danielbachhuber danielbachhuber merged commit 7efee3b into WP-API:develop Mar 4, 2016
@danielbachhuber
Copy link
Member

Thanks again @thebatclaudio

@rmccue
Copy link
Member

rmccue commented Mar 7, 2016

I tested it without the check and get Fatal errors as well.

Curious. I suspect it's probably if $data is '' or a similar default.

Thanks for the PR!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants