getid3_id3v2::ParseID3v2Frame( array $parsedFrame ): bool
- Source
wp-includes/ID3/module.tag.id3v2.php:569
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.
Parameters
$parsedFramearray
Return value
bool
Performance profile
How much work a call to getid3_id3v2::ParseID3v2Frame() 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
- Scaling
- Scales with input
- Instructions
- 156–302
- Plugin surface
- None
- Called by
- 1
Touches nothing outside its own arguments.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 4052.
Nothing here hands control to plugin code.
1 place in core call this, so the cost is paid more often than your own code shows.
What one call costs · 10 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost getid3_id3v2::ParseID3v2Frame() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!empty($parsedFrame) && !$id3v2_majorversion && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 | 156–168 | ->FrameNameLongLookup(), ->FrameNameShortLookup() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && !$i && !$frame_offset | 213–232 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ord(), ord() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && !$frame_offset | 220–238 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ::getid3_lib(), ::getid3_lib() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && !$frame_offset | 228–246 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && !$frame_offset | 236–254 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 | 266–267 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && !$i && $frame_offset | 271–280 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ord(), ord(), ::getid3_lib(), ::getid3_lib(), ->warning() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && $frame_offset | 279–286 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ->warning() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && $frame_offset | 287–294 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ->warning() |
!empty($parsedFrame) && empty($value) && !isset($parsedFrame) && $id3v2_majorversion != 2 && $id3v2_majorversion != 3 && $frame_offset | 295–302 | ->FrameNameLongLookup(), ->FrameNameShortLookup(), explode(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ::getid3_lib(), ->warning() |
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
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 4052 | 156–302 | 361 | |
| 8.5 | 4052 | 156–302 | 361 | |
| 8.4 | 4052 | 156–302 | 361 | 784 fewer instructions than PHP 8.3 |
| 8.3 | 4836 | 156–329 | 361 | |
| 8.2 | 4836 | 156–329 | 361 | 4 fewer instructions than PHP 8.1 |
| 8.1 | 4840 | 156–329 | 361 | 5 fewer instructions than PHP 7.4 |
| 7.4 | 4845 | 156–329 | 361 |
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 · 26
- getid3_id3v2::FrameNameLongLookup()
- getid3_id3v2::FrameNameShortLookup()
- getid3_id3v2::DeUnsynchronise()
- getid3_lib::BigEndian2Int()
- getid3_id3v2::warning()
- getid3_id3v2::TextEncodingTerminatorLookup()
- getid3_id3v2::MakeUTF16emptyStringEmpty()
- getid3_id3v2::TextEncodingNameLookup()
- getid3_lib::iconv_fallback()
- getid3_id3v2::RemoveStringTerminator()
- getid3_id3v2::ETCOEventLookup()
- getid3_lib::BigEndian2Bin()
Show all 26
- getid3_id3v2::LanguageLookup()
- getid3_id3v2::SYTLContentTypeLookup()
- getid3_id3v2::RVA2ChannelTypeLookup()
- getid3_id3v2::APICPictureTypeLookup()
- getid3_lib::GetDataImageSize()
- getID3::is_writable()
- getid3_lib::iconv_fallback_iso88591_utf8()ISO-8859-1 => UTF-8
- getid3_id3v2::LookupCurrencyUnits()
- getid3_id3v2::IsValidDateStampString()
- getid3_id3v2::COMRReceivedAsLookup()
- getid3_lib::BigEndian2Float()ANSI/IEEE Standard 754-1985, Standard for Binary Floating Point Arithmetic
- getid3_lib::RGADnameLookup()
- getid3_lib::RGADoriginatorLookup()
- getid3_lib::RGADadjustmentLookup()
Used by · 1
Source code
public function ParseID3v2Frame(&$parsedFrame) { // shortcuts $info = &$this->getid3->info; $id3v2_majorversion = $info['id3v2']['majorversion']; $parsedFrame['framenamelong'] = $this->FrameNameLongLookup($parsedFrame['frame_name']); if (empty($parsedFrame['framenamelong'])) { unset($parsedFrame['framenamelong']); } $parsedFrame['framenameshort'] = $this->FrameNameShortLookup($parsedFrame['frame_name']); if (empty($parsedFrame['framenameshort'])) { unset($parsedFrame['framenameshort']); } if ($id3v2_majorversion >= 3) { // frame flags are not part of the ID3v2.2 standard if ($id3v2_majorversion == 3) { // Frame Header Flags // %abc00000 %ijk00000 $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x8000); // a - Tag alter preservation $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // b - File alter preservation $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // c - Read only $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0080); // i - Compression $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // j - Encryption $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0020); // k - Grouping identity } elseif ($id3v2_majorversion == 4) { // Frame Header Flags // %0abc0000 %0h00kmnp $parsedFrame['flags']['TagAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x4000); // a - Tag alter preservation $parsedFrame['flags']['FileAlterPreservation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x2000); // b - File alter preservation $parsedFrame['flags']['ReadOnly'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x1000); // c - Read only $parsedFrame['flags']['GroupingIdentity'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0040); // h - Grouping identity $parsedFrame['flags']['compression'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0008); // k - Compression $parsedFrame['flags']['Encryption'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0004); // m - Encryption $parsedFrame['flags']['Unsynchronisation'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0002); // n - Unsynchronisation $parsedFrame['flags']['DataLengthIndicator'] = (bool) ($parsedFrame['frame_flags_raw'] & 0x0001); // p - Data length indicator // Frame-level de-unsynchronisation - ID3v2.4 if ($parsedFrame['flags']['Unsynchronisation']) { $parsedFrame['data'] = $this->DeUnsynchronise($parsedFrame['data']); } if ($parsedFrame['flags']['DataLengthIndicator']) { $parsedFrame['data_length_indicator'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4), 1); $parsedFrame['data'] = substr($parsedFrame['data'], 4); } } // Frame-level de-compression if ($parsedFrame['flags']['compression']) { $parsedFrame['decompressed_size'] = getid3_lib::BigEndian2Int(substr($parsedFrame['data'], 0, 4)); if (!function_exists('gzuncompress')) { $this->warning('gzuncompress() support required to decompress ID3v2 frame "'.$parsedFrame['frame_name'].'"'); } else { if ($decompresseddata = @gzuncompress(substr($parsedFrame['data'], 4))) { //if ($decompresseddata = @gzuncompress($parsedFrame['data'])) { $parsedFrame['data'] = $decompresseddata; unset($decompresseddata); } else { $this->warning('gzuncompress() failed on compressed contents of ID3v2 frame "'.$parsedFrame['frame_name'].'"'); } } } } if (!empty($parsedFrame['flags']['DataLengthIndicator'])) { if ($parsedFrame['data_length_indicator'] != strlen($parsedFrame['data'])) { $this->warning('ID3v2 frame "'.$parsedFrame['frame_name'].'" should be '.$parsedFrame['data_length_indicator'].' bytes long according to DataLengthIndicator, but found '.strlen($parsedFrame['data']).' bytes of data'); } } if (isset($parsedFrame['datalength']) && ($parsedFrame['datalength'] == 0)) { $warning = 'Frame "'.$parsedFrame['frame_name'].'" at offset '.$parsedFrame['dataoffset'].' has no data portion'; switch ($parsedFrame['frame_name']) { case 'WCOM': $warning .= ' (this is known to happen with files tagged by RioPort)'; break;Changelog
Unchanged from 6.7.7 through 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.tag.id3v2.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.