Fix regex for bug#48836

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@283700 c90b9560-bf6c-de11-be94-00142212c4b1
This commit is contained in:
Richard Quadling 2009-07-08 08:20:50 +00:00
parent 87e0b8ea27
commit 8f8c8c6890

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision: 1.53 $ -->
<!-- $Revision: 1.54 $ -->
<chapter xml:id="features.http-auth" xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>HTTP authentication with PHP</title>
@ -105,8 +105,9 @@ function http_digest_parse($txt)
// protect against missing data
$needed_parts = array('nonce'=>1, 'nc'=>1, 'cnonce'=>1, 'qop'=>1, 'username'=>1, 'uri'=>1, 'response'=>1);
$data = array();
$keys = implode('|', array_keys($needed_parts));
preg_match_all('@(\w+)=(?:([\'"])([^\2]+)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
preg_match_all('@(' . $keys . ')=(?:([\'"])([^\2]+?)\2|([^\s,]+))@', $txt, $matches, PREG_SET_ORDER);
foreach ($matches as $m) {
$data[$m[1]] = $m[3] ? $m[3] : $m[4];