mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-12-26 11:37:33 +00:00
X509: use anonymous function in PHP >= 5.3.0
This commit is contained in:
parent
2e2c22b921
commit
703f7840db
@ -2765,7 +2765,11 @@ class File_X509
|
|||||||
$value = array_pop($value); // Always strip data type.
|
$value = array_pop($value); // Always strip data type.
|
||||||
}
|
}
|
||||||
} elseif (is_object($value) && strtolower(get_class($value)) == 'file_asn1_element') {
|
} elseif (is_object($value) && strtolower(get_class($value)) == 'file_asn1_element') {
|
||||||
$callback = create_function('$x', 'return "\x" . bin2hex($x[0]);');
|
// @codingStandardsIgnoreStart
|
||||||
|
$callback = version_compare(PHP_VERSION, '5.3.0') >= 0 ?
|
||||||
|
function ($x) { return "\x" . bin2hex($x[0]); } :
|
||||||
|
create_function('$x', 'return "\x" . bin2hex($x[0]);');
|
||||||
|
// @codingStandardsIgnoreEnd
|
||||||
$value = strtoupper(preg_replace_callback('#[^\x20-\x7E]#', $callback, $value->element));
|
$value = strtoupper(preg_replace_callback('#[^\x20-\x7E]#', $callback, $value->element));
|
||||||
}
|
}
|
||||||
$output.= $desc . '=' . $value;
|
$output.= $desc . '=' . $value;
|
||||||
|
Loading…
Reference in New Issue
Block a user