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

PHP Doesn't Show Saved Options #31

Open
ryanmtaylor opened this issue Jun 17, 2015 · 0 comments
Open

PHP Doesn't Show Saved Options #31

ryanmtaylor opened this issue Jun 17, 2015 · 0 comments

Comments

@ryanmtaylor
Copy link

"Note that PHP's boolean operators always return a boolean value... as opposed to other languages that return the value of the last evaluated expression."
See this comment on php: http://php.net/manual/en/language.operators.logical.php#77411

The issue is in ManualImageCropSettingsPage.php with the line $sizesSettings = self::getSettings() || array();

I added if( empty($settings) ) return array(); to your getSettings() function, and then removed the || array(); part... you could also do like $settings = empty($settings) ? array() : $settings;

Also, I noticed you try to repeatedly call unserialize on the value up to 10 times, while it's empty/not an array? get_option() and update_option() will automatically serialize/unserialize for you, and if you're unsure ever you can use maybe_serialize() which will conditionally serialize (and make sure it doesn't happen twice)!

Great plugin, super useful and user-friendly!!

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

1 participant