notifications.php - fix old_status_friendly_name undefined warning#502
Closed
jerclarke wants to merge 1 commit intoAutomattic:masterfrom
Closed
notifications.php - fix old_status_friendly_name undefined warning#502jerclarke wants to merge 1 commit intoAutomattic:masterfrom
jerclarke wants to merge 1 commit intoAutomattic:masterfrom
Conversation
- affects `notification_status_change()` - Moves the definition of $old_status_friendly_name (as well as $new_status_friendly_name) to above the complex `else if` block to ensure that it is always defined. - Fixes a recent change to this code, which moved the definition of $old_status_friendly_name to places where it didn’t effect all of the `else if` clauses: Automattic@071791d#diff-59ee072dc425b09b6d748cb84634734b - This triggered a PHP Warning: PHP Notice: Undefined variable: old_status_friendly_name - This warning also reflected that the string would be missing in many cases. - I tried to test this with all the possible status transition but might have missed some. Certainly the common ones of new->draft->pending->publish->trash are all working as expected now.
jerclarke
referenced
this pull request
Mar 8, 2019
This prevents duplicate conditional statements and sets a value for $old_status_friendly_name so that New or Auto-Draft that had no previous value will have something valid.
Contributor
|
I'd like to merge this in, but it reintroduces a problem mentioned here. One way it triggers: If you programmatically call One thing I can think of is adding null check around Open to suggestions. |
Member
|
Continued in #560 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
notification_status_change()else ifblock to ensure that it is always defined.else ifclauses:071791d#diff-59ee072dc425b09b6d748cb84634734b
PHP Warning: PHP Notice: Undefined variable: old_status_friendly_namebecause the variable is used right after in all cases.