WordPress.org

Make WordPress Core

Opened 5 months ago

Last modified 5 months ago

#47322 new defect (bug)

scenario based-bug in the file load-style.php

Reported by: asimbaki Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 5.2
Component: Script Loader Keywords: needs-patch
Focuses: Cc:
PR Number:

Description

Technically the file load-style.php has a bug, however it is a scenario based-bug so it rarely occurred. Not going in to so much details of PHP the problem is with the variable $out concatenation of "$contents" used in the foreach loop, i.e., O(n) complexity issue - the allocated buffer is exhausted assigned by PHP during the single http request execution.

The better and optimized way is:

move the "header" just the above "foreach ( $load as $handle )" loop statement.
remove "$out" , i.e., echo $content rather concatenating into $out.

I had this issue during installing app on my local machine, and solved it happily by doing changes that way.

Attachments (1)

load-styles.php (2.2 KB) - added by asimbaki 5 months ago.
Optimized and better way to stream-out the style contents.

Download all attachments as: .zip

Change History (2)

@asimbaki
5 months ago

Optimized and better way to stream-out the style contents.

#1 @SergeyBiryukov
5 months ago

  • Component changed from General to Script Loader
Note: See TracTickets for help on using tickets.