WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9043 closed defect (bug) (invalid)

set_time_limit in import/wordpress.php causing issues.

Reported by: joostdevalk Owned by: joostdevalk
Milestone: Priority: normal
Severity: normal Version:
Component: Import Keywords: has-patchdev-feedback 2nd-opinion
Focuses: Cc:

Description

On line 366 of /wp-admin/wordpress/import.php, there's a "set_time_limit( 60 );" without any checks, and the set time limit is never set back to its original state. This causes issues when the entire import process takes longer.

Setting a 60 second time limit for the import of a single post makes sense though, so I'm attaching a patch that will store the original time limit, set the time limit to 60 seconds, and restore it to it's original value after the import has been done.

Attachments (1)

import-patch.txt (657 bytes) - added by joostdevalk 5 years ago.
Patch

Download all attachments as: .zip

Change History (4)

joostdevalk5 years ago

Patch

comment:1 tellyworth5 years ago

I don't think this works as you expect.

set_time_limit(123) doesn't set the time limit to 123 seconds since script execution started. It adds 123 new seconds from the current point. So if the original time limit is 30 seconds, when you call set_time_limit($orig_timelimit) you're adding a further 30 seconds of execution time, not winding back the total limit to 30 seconds.

This is covered in the set_time_limit() docs:

http://au.php.net/manual/en/function.set-time-limit.php

Can you elaborate on what the bug is?

comment:2 ryan5 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Indeed, it adds to the time. Closing as invalid for now. Reopen with more details.

comment:3 ryan5 years ago

  • Milestone 2.8 deleted
Note: See TracTickets for help on using tickets.