Make WordPress Core

Opened 18 months ago

Closed 18 months ago

Last modified 14 months ago

#57659 closed defect (bug) (fixed)

Check the function set_time_limit() exist before calling

Reported by: mujuonly's profile mujuonly Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 6.2 Priority: normal
Severity: normal Version:
Component: Mail Keywords: has-patch
Focuses: Cc:

Description

The function set_time_limit() is used in multiple places in /wp-includes/class-pop3.php without check the function exist.

This throws a fatal error on certain environments.

Change History (7)

This ticket was mentioned in PR #4027 on WordPress/wordpress-develop by mujuonly.


18 months ago
#1

  • Keywords has-patch added

This avoids a fatal error if the function is disabled on certain environments. This can be handled like ( strpos(ini_get('disable_functions'), 'set_time_limit') === false ) as well.

This avoids a fatal error if the function is disabled on certain environments. This can be handled like ( strpos(ini_get('disable_functions'), 'set_time_limit') === false ) as well.

Trac ticket: https://core.trac.wordpress.org/ticket/57659

#2 @SergeyBiryukov
18 months ago

Hi there, welcome back to WordPress Trac! Thanks for the ticket.

I considered including this change in [55258] / #55711. Technically, class-pop3.php is an "adopted" library with some changes over the years, mostly PHP compatibility adjustments and typo fixes.

Since it's not actively supported and it was not immediately clear to me whether this code is ever executed in core, I chose not to include this file in [55258] at the time, though I don't have any objections to making this change. Curious to see what others think :)

#3 @mujuonly
18 months ago

The file is included in /wp-mail.php #L32

/** Get the POP3 class with which to access the mailbox. */
require_once ABSPATH . WPINC . '/class-pop3.php';

#4 @SergeyBiryukov
18 months ago

  • Component changed from General to Mail
  • Milestone changed from Awaiting Review to 6.2

Yeah, it appears to be used for the "Post via email" functionality.

On second thought, I don't see any downsides to adding a check for set_time_limit() in this file too, so might as well do it for consistency with the rest of core.

Minor nitpick: since the file does not follow WordPress coding standards, it would be more internally consistent here to use double quotes and avoid spaces between brackets. This can be adjusted on commit.

#5 @SergeyBiryukov
18 months ago

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

In 55305:

Mail: Check that set_time_limit() function is available before using it in class-pop3.php.

This avoids a fatal error if the function is disabled on certain environments.

Follow-up to [55258].

Props mujuonly.
Fixes #57659.

@SergeyBiryukov commented on PR #4027:


18 months ago
#6

Thanks for the PR! Merged in r55305.

This ticket was mentioned in Slack in #core-upgrade-install by pbiron. View the logs.


14 months ago

Note: See TracTickets for help on using tickets.