WordPress.org

Make WordPress Core

Opened 9 months ago

Closed 5 weeks ago

Last modified 2 days ago

#39920 closed defect (bug) (fixed)

Empty if-statement

Reported by: appchecker Owned by: 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 9 months ago.
Is this what you are talking about?
39920.2.patch (465 bytes) - added by Dency 8 months ago.
added Empty if-statement
39920-3.patch (558 bytes) - added by Dency 5 months ago.

Download all attachments as: .zip

Change History (16)

@yahil
9 months ago

Is this what you are talking about?

#1 @SergeyBiryukov
9 months 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 months ago

added Empty if-statement

#2 @Dency
8 months 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 months ago by Dency (previous) (diff)

#3 @ketuchetan
8 months 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 months ago

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


6 months ago

#6 @obenland
6 months ago

  • Milestone changed from 4.8 to Future Release

#7 @chesio
6 months ago

Hi,

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

@Dency
5 months ago

#8 @Dency
5 months ago

  • Keywords needs-unit-tests removed

#9 @SergeyBiryukov
5 months ago

  • Milestone changed from Future Release to 4.9

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


6 weeks ago

#11 @SergeyBiryukov
5 weeks 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 days ago

In 42199:

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

Props stodorovic.
Fixes #42579. See #39920.

#13 @dd32
2 days 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.