POP3::uidl( $msgNum = "" )
- Source
wp-includes/class-pop3.php:519
Compatibility
- WordPress
- core
- PHP
- 7.4–8.4
- 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.4.
Parameters
$msgNumoptional- Default:
""
Performance profile
How much work a call to POP3::uidl() 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
- Heavy
- Scaling
- Scales with input
- Instructions
- 10–56
- Plugin surface
- None
- Called by
- 0
Reads or writes the filesystem via fwrite().
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.4, depending on the branch taken. The body compiles to 129.
Nothing here hands control to plugin code.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- regexregular expression over the whole input
preg_split()called directly - filesystemfilesystem access
fwrite()called directly
What one call costs · 8 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost POP3::uidl() can have, taken from its control-flow graph on PHP 8.4.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($value) | 10 | _() |
isset($value) && empty($msgNum) && $Total | 16 | ->update_timer() |
isset($value) && !empty($msgNum) && ->is_ok() | 25 | ->send_cmd(), ->is_ok(), preg_split() |
isset($value) && !empty($msgNum) && !->is_ok() | 27 | ->send_cmd(), ->is_ok(), _() |
isset($value) && empty($msgNum) && !$Total && ->is_ok() && $line | 44 | ->update_timer(), fwrite(), fgets(), ->strip_clf(), ->is_ok(), fgets() |
isset($value) && empty($msgNum) && !$Total && !->is_ok() | 45 | ->update_timer(), fwrite(), fgets(), ->strip_clf(), ->is_ok(), _() |
isset($value) && empty($msgNum) && !$Total && ->is_ok() && $line | 55 | ->update_timer(), fwrite(), fgets(), ->strip_clf(), error_log(), ->is_ok(), fgets() |
isset($value) && empty($msgNum) && !$Total && !->is_ok() | 56 | ->update_timer(), fwrite(), fgets(), ->strip_clf(), error_log(), ->is_ok(), _() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.4 | 129 | 10–56 | 8 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 132 | 10–58 | 8 | |
| 8.2 | 132 | 10–58 | 8 | |
| 8.1 | 132 | 10–58 | 8 | |
| 7.4 | 132 | 10–58 | 8 |
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 · 5
Source code
function uidl ($msgNum = "") { // Returns the UIDL of the msg specified. If called with // no arguments, returns an associative array where each // undeleted msg num is a key, and the msg's uidl is the element // Array element 0 will contain the total number of msgs if(!isset($this->FP)) { $this->ERROR = "POP3 uidl: " . _("No connection to server"); return false; } $fp = $this->FP; $buffer = $this->BUFFER; if(!empty($msgNum)) { $cmd = "UIDL $msgNum"; $reply = $this->send_cmd($cmd); if(!$this->is_ok($reply)) { $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } list ($ok,$num,$myUidl) = preg_split('/\s+/',$reply); return $myUidl; } else { $this->update_timer(); $UIDLArray = array(); $Total = $this->COUNT; $UIDLArray[0] = $Total; if ($Total < 1) { return $UIDLArray; } $cmd = "UIDL"; fwrite($fp, "UIDL\r\n"); $reply = fgets($fp, $buffer); $reply = $this->strip_clf($reply); if($this->DEBUG) { @error_log("POP3 SEND [$cmd] GOT [$reply]",0); } if(!$this->is_ok($reply)) { $this->ERROR = "POP3 uidl: " . _("Error ") . "[$reply]"; return false; } $line = ""; $count = 1; $line = fgets($fp,$buffer); while ( !preg_match('/^\.\r\n/',$line)) { list ($msg,$msgUidl) = preg_split('/\s+/',$line); $msgUidl = $this->strip_clf($msgUidl); if($count == $msg) { $UIDLArray[$msg] = $msgUidl; } else { $UIDLArray[$count] = 'deleted'; } $count++; $line = fgets($fp,$buffer); } } return $UIDLArray; }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 6.8.8 tag, from
src/wp-includes/class-pop3.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.