waleedmazhar / lightopenid

Automatically exported from code.google.com/p/lightopenid
0 stars 0 forks source link

The regular expressions in htmlTag parse some valid responses incorrectly #79

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I was trying to use openid with the communityId openid provider. This was 
failing because the 

preg_match_all("#<{$tag}[^>]*$valueName=['\"](.+?)['\"][^>]*$attrName=['\"].*?$a
ttrValue.*?['\"][^>]*/?>#i", $content, $matches2);

on line 391 parses the following incorrectly:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><meta 
http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Community ID</title> <link rel="shortcut icon" href="

/communityid/favicon.ico" />
<link rel="stylesheet" type="text/css" 
href="/communityid/javascript/yui/assets/skins/sam/skin.css" />
<link rel="stylesheet" type="text/css" 
href="/communityid/javascript/yui/reset-fonts-grids/reset-fonts-grids.css" />
<link rel="stylesheet" href="/communityid/styles/style.css?v=1.0.0_RC2" 
type="text/css" media="screen" charset="utf-8"/><link href="

http://uk2.greenwheel.com/communityid/openid/provider" rel="openid.server" />
<link href="http://uk2.greenwheel.com/communityid/openid/provider" 
rel="openid2.provider" />

It matches the entire section from /community.....to href="

I was able to fix this by changing the (.*?) to ([^>]*?) but this may not be 
the best fix.

Original issue reported on code.google.com by Gary.Bil...@gmail.com on 12 Mar 2014 at 3:05