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

Two very minor changes #361

Merged
merged 3 commits into from
Apr 27, 2015
Merged

Two very minor changes #361

merged 3 commits into from
Apr 27, 2015

Conversation

jrfnl
Copy link
Contributor

@jrfnl jrfnl commented Apr 27, 2015

  • Don't pass parameter to function which doesn't have parameters
  • Only print (and escape) the message when there actually is one

@jrfnl jrfnl added this to the 2.5.0 milestone Apr 27, 2015
@@ -439,7 +439,7 @@ public function install_plugins_page() {
<?php $plugin_table->prepare_items(); ?>

<?php
if ( isset( $this->message ) ) {
if ( isset( $this->message ) && is_string( $this->message ) && '' !== $this->message ) {
Copy link
Member

Choose a reason for hiding this comment

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

Per the other discussion, I think the last part here should use empty().

Alternatively, as things stand, the second part is redundant, since the last part is already checking the type is a string.

So, either:

if ( isset( $this->message ) && is_string( $this->message ) && ! empty( $this->message ) ) {

or

if ( isset( $this->message ) && '' !== ( $this->message ) ) {

should be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll change it to your first option - the second is definitely incorrect as that would pass new stdClass, (int) 5 etc

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#wceu public is a bit too diverse for my hard-core PHP defensive coding talk (The big "Why equal doesn't equal" Quiz), but maybe we should do with a select group in a hallway track or something....

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh and I've update the PR for empty

Copy link
Member

Choose a reason for hiding this comment

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

I'll change it to your first option - the second is definitely incorrect as that would pass new stdClass, (int) 5 etc

Yes, you're right.

#wceu public is a bit too diverse for my hard-core PHP defensive coding talk (The big "Why equal doesn't equal" Quiz), but maybe we should do with a select group in a hallway track or something....

I've seen a video of it :-)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting... I always ask them to cut the actual quiz out if they video it - which one did you see ? There are actually some five different versions of the quiz (different sets of questions).

GaryJones added a commit that referenced this pull request Apr 27, 2015
@GaryJones GaryJones merged commit 10bee0c into develop Apr 27, 2015
@GaryJones GaryJones deleted the feature/minor-changes branch April 27, 2015 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants