WordPress.org

Make WordPress Core

Opened 7 months ago

Last modified 2 months ago

#39920 new defect (bug)

Empty if-statement

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

Download all attachments as: .zip

Change History (12)

@yahil
7 months ago

Is this what you are talking about?

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

added Empty if-statement

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

#3 @ketuchetan
5 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.


5 months ago

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


4 months ago

#6 @obenland
4 months ago

  • Milestone changed from 4.8 to Future Release

#7 @chesio
4 months ago

Hi,

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

@Dency
3 months ago

#8 @Dency
3 months ago

  • Keywords needs-unit-tests removed

#9 @SergeyBiryukov
2 months ago

  • Milestone changed from Future Release to 4.9
Note: See TracTickets for help on using tickets.