Make WordPress Core

Opened 8 years ago

Closed 7 years ago

Last modified 7 years ago

#39920 closed defect (bug) (fixed)

Empty if-statement

Reported by: appchecker's profile appchecker Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.9 Priority: normal
Severity: normal Version: 1.5
Component: Rewrite Rules Keywords: has-patch
Focuses: Cc:

Description

Hello!

In this code fragment:

<?php
        if ( $markerdata = explode( "\n", implode( '', file( $filename ) ) ));
        {
                $state = false;
                ....
        }

Body of if-statement actually is empty. Probably, semicolon is excess.

This possible defect found with ( AppChecker )

Attachments (3)

39920.patch (398 bytes) - added by yahil 8 years ago.
Is this what you are talking about?
39920.2.patch (465 bytes) - added by Dency 8 years ago.
added Empty if-statement
39920-3.patch (558 bytes) - added by Dency 7 years ago.

Download all attachments as: .zip

Change History (16)

@yahil
8 years ago

Is this what you are talking about?

#1 @SergeyBiryukov
8 years ago

  • Component changed from General to Rewrite Rules
  • Keywords needs-patch needs-unit-tests added
  • Milestone changed from Awaiting Review to 4.8
  • Version changed from trunk to 1.5

Hi @appchecker, welcome to WordPress Trac! Thanks for the report.

Good catch, introduced in [1489]. Would be great to have some unit tests for this (related: #26829).

@Dency
8 years ago

added Empty if-statement

#2 @Dency
8 years ago

  • Keywords has-patch added; needs-patch needs-unit-tests removed

Hi @SergeyBiryukov,

I have added Empty if-statement before foreach otherwise it generates error and adds explode line before the empty statement.

Thanks,

Last edited 8 years ago by Dency (previous) (diff)

#3 @ketuchetan
8 years ago

  • Keywords needs-unit-tests added

Hi @Dency

Have you tested your patch in unit testing?

Thanks,

This ticket was mentioned in Slack in #core by dixita. View the logs.


8 years ago

This ticket was mentioned in Slack in #core by obenland. View the logs.


8 years ago

#6 @obenland
8 years ago

  • Milestone changed from 4.8 to Future Release

#7 @chesio
8 years ago

Hi,

This could be solved with a patch I just submitted for #26829 (comes with unit tests too).

@Dency
7 years ago

#8 @Dency
7 years ago

  • Keywords needs-unit-tests removed

#9 @SergeyBiryukov
7 years ago

  • Milestone changed from Future Release to 4.9

This ticket was mentioned in Slack in #core by melchoyce. View the logs.


7 years ago

#11 @SergeyBiryukov
7 years ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 41928:

Rewrite Rules: Remove redundant if condition in extract_from_markers().

Props Dency, yahil, appchecker.
Fixes #39920.

#12 @SergeyBiryukov
7 years ago

In 42199:

Rewrite Rules: Correct the logic in extract_from_markers() after [41928].

Props stodorovic.
Fixes #42579. See #39920.

#13 @dd32
7 years ago

In 42213:

Rewrite Rules: Correct the logic in extract_from_markers() after [41928].

Props stodorovic, SergeyBiryukov.
Merges [42199] to the 4.9 branch.
Fixes #42579. See #39920.

Note: See TracTickets for help on using tickets.