2,8 → 2,8 |
|
/* |
* OID-Utilities for PHP |
* Copyright 2011-2021 Daniel Marschall, ViaThinkSoft |
* Version 2021-09-23 |
* Copyright 2011-2022 Daniel Marschall, ViaThinkSoft |
* Version 2022-01-07 |
* |
* Licensed under the Apache License, Version 2.0 (the "License"); |
* you may not use this file except in compliance with the License. |
333,14 → 333,15 |
* @version 2015-08-17 |
* @param string $oid<br/> |
* An OID in dot notation. |
* @param boolean $leading_dot<br/> |
* @param mixed $leading_dot<br/> |
* true: The OID is valid, if it contains a leading dot.<br/> |
* false (default): The OID is valid, if it does not contain a leading dot. |
* 'auto: Allow both |
* @return string|false The OID without leading dots, or <code>false</code> if the OID is syntactically wrong. |
**/ |
$oid_sanitize_cache = array(); |
function sanitizeOID($oid, $leading_dot=false) { |
static $oid_sanitize_cache = array(); |
|
if ($leading_dot) $leading_dot = substr($oid,0,1) == '.'; |
|
// We are using a cache, since this function is used very often by OIDplus |
362,7 → 363,7 |
continue; |
} |
|
if (!ctype_digit($a)) return false; // does contain something other than digits |
if (!preg_match('@^(\\d+)$@', $a, $m)) return false; // does contain something other than digits |
|
// strike leading zeroes |
$a = preg_replace("@^0+@", '', $a); |