wppaste
WordPress

getid3_mp3::getOnlyMPEGaudioInfoBruteForce(): bool

Source
wp-includes/ID3/module.audio.mp3.php:1300

Compatibility

WordPress
core
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Return value

bool

Performance profile

How much work a call to getid3_mp3::getOnlyMPEGaudioInfoBruteForce() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Light

Touches nothing outside its own arguments.

Scaling
Scales with input

The body loops, so the work grows with how much data it finds.

Instructions
124–312

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 467.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What one call costs · 16 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost getid3_mp3::getOnlyMPEGaudioInfoBruteForce() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always124–126::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), array_sum(), ->error()
always127–129::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), ->error(), array_sum(), ->error()
always130–132::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), ->error(), ->error(), array_sum(), ->error()
always133–135::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), ->error(), ->error(), ->error(), array_sum(), ->error()
always180–183::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), array_sum(), ::getid3_lib(), ::getid3_lib()
always183–186::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), ->error(), array_sum(), ::getid3_lib(), ::getid3_lib()
always186–189::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), ->error(), ->error(), array_sum(), ::getid3_lib(), ::getid3_lib()
always189–192::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ksort(), ->error(), ->error(), ->error(), array_sum(), ::getid3_lib(), ::getid3_lib()
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned239–246::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), array_sum(), ->error()
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned242–249::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), ->error(), array_sum(), ->error()
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned245–252::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), ->error(), ->error(), array_sum(), ->error()
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned248–255::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), ->error(), ->error(), ->error(), array_sum(), ->error()
4 further outcomes, up to 312 instructions
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned295–303::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), array_sum(), ::getid3_lib(), ::getid3_lib()
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned298–306::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), ->error(), array_sum(), ::getid3_lib(), ::getid3_lib()
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned301–309::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), ->error(), ->error(), array_sum(), ::getid3_lib(), ::getid3_lib()
isset($MPEGaudioHeaderDecodeCache[$head4]) && isset($MPEGaudioHeaderValidCache[$head4]) && $MPEGaudioHeaderValidCache && isset($MPEGaudioHeaderLengthCache[$head4]) && isset($MPEGaudioHeaderDecodeCache[$next4]) && isset($MPEGaudioHeaderValidCache[$next4]) && !isset($value) && $frames_scanned304–312::MPEGaudioVersionArray(), ::MPEGaudioLayerArray(), ::MPEGaudioBitrateArray(), ::MPEGaudioFrequencyArray(), ::MPEGaudioChannelModeArray(), ::MPEGaudioModeExtensionArray(), ::MPEGaudioEmphasisArray(), ->fseek(), ->ftell(), set_time_limit(), ->fread(), ->ftell(), ->fseek(), ->fread(), ->fseek(), ->ftell(), ::getid3_lib(), number_format(), ->warning(), ksort(), ->error(), ->error(), ->error(), array_sum(), ::getid3_lib(), ::getid3_lib()

This body has more branch combinations than are worth enumerating, so the table covers the outcomes found first rather than every one that exists.

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev467124–31235
8.5467124–31235
8.4467124–31235
8.3467124–31235
8.2467124–312351 more instruction than PHP 8.1
8.1466124–312356 fewer instructions than PHP 7.4
7.4472124–31335

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Uses · 17

Show all 17

Used by · 1

Source code

	public function getOnlyMPEGaudioInfoBruteForce() {		$MPEGaudioHeaderDecodeCache   = array();		$MPEGaudioHeaderValidCache    = array();		$MPEGaudioHeaderLengthCache   = array();		$MPEGaudioVersionLookup       = self::MPEGaudioVersionArray();		$MPEGaudioLayerLookup         = self::MPEGaudioLayerArray();		$MPEGaudioBitrateLookup       = self::MPEGaudioBitrateArray();		$MPEGaudioFrequencyLookup     = self::MPEGaudioFrequencyArray();		$MPEGaudioChannelModeLookup   = self::MPEGaudioChannelModeArray();		$MPEGaudioModeExtensionLookup = self::MPEGaudioModeExtensionArray();		$MPEGaudioEmphasisLookup      = self::MPEGaudioEmphasisArray();		$LongMPEGversionLookup        = array();		$LongMPEGlayerLookup          = array();		$LongMPEGbitrateLookup        = array();		$LongMPEGpaddingLookup        = array();		$LongMPEGfrequencyLookup      = array();		$Distribution                 = array();		$Distribution['bitrate']      = array();		$Distribution['frequency']    = array();		$Distribution['layer']        = array();		$Distribution['version']      = array();		$Distribution['padding']      = array(); 		$info = &$this->getid3->info;		$this->fseek($info['avdataoffset']); 		$max_frames_scan = 5000;		$frames_scanned  = 0; 		$previousvalidframe = $info['avdataoffset'];		while ($this->ftell() < $info['avdataend']) {			set_time_limit(30);			$head4 = $this->fread(4);			if (strlen($head4) < 4) {				break;			}			if ($head4[0] != "\xFF") {				for ($i = 1; $i < 4; $i++) {					if ($head4[$i] == "\xFF") {						$this->fseek($i - 4, SEEK_CUR);						continue 2;					}				}				continue;			}			if (!isset($MPEGaudioHeaderDecodeCache[$head4])) {				$MPEGaudioHeaderDecodeCache[$head4] = self::MPEGaudioHeaderDecode($head4);			}			if (!isset($MPEGaudioHeaderValidCache[$head4])) {				$MPEGaudioHeaderValidCache[$head4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$head4], false, false);			}			if ($MPEGaudioHeaderValidCache[$head4]) { 				if (!isset($MPEGaudioHeaderLengthCache[$head4])) {					$LongMPEGversionLookup[$head4]   = $MPEGaudioVersionLookup[$MPEGaudioHeaderDecodeCache[$head4]['version']];					$LongMPEGlayerLookup[$head4]     = $MPEGaudioLayerLookup[$MPEGaudioHeaderDecodeCache[$head4]['layer']];					$LongMPEGbitrateLookup[$head4]   = $MPEGaudioBitrateLookup[$LongMPEGversionLookup[$head4]][$LongMPEGlayerLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['bitrate']];					$LongMPEGpaddingLookup[$head4]   = (bool) $MPEGaudioHeaderDecodeCache[$head4]['padding'];					$LongMPEGfrequencyLookup[$head4] = $MPEGaudioFrequencyLookup[$LongMPEGversionLookup[$head4]][$MPEGaudioHeaderDecodeCache[$head4]['sample_rate']];					$MPEGaudioHeaderLengthCache[$head4] = self::MPEGaudioFrameLength(						$LongMPEGbitrateLookup[$head4],						$LongMPEGversionLookup[$head4],						$LongMPEGlayerLookup[$head4],						$LongMPEGpaddingLookup[$head4],						$LongMPEGfrequencyLookup[$head4]);				}				if ($MPEGaudioHeaderLengthCache[$head4] > 4) {					$WhereWeWere = $this->ftell();					$this->fseek($MPEGaudioHeaderLengthCache[$head4] - 4, SEEK_CUR);					$next4 = $this->fread(4);					if ($next4[0] == "\xFF") {						if (!isset($MPEGaudioHeaderDecodeCache[$next4])) {							$MPEGaudioHeaderDecodeCache[$next4] = self::MPEGaudioHeaderDecode($next4);						}						if (!isset($MPEGaudioHeaderValidCache[$next4])) {							$MPEGaudioHeaderValidCache[$next4] = self::MPEGaudioHeaderValid($MPEGaudioHeaderDecodeCache[$next4], false, false);						}						if ($MPEGaudioHeaderValidCache[$next4]) {							$this->fseek(-4, SEEK_CUR);

Changelog

Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/ID3/module.audio.mp3.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.