Error in regexp in function add_pingback
Posted: Sun Feb 11, 2007 8:40 pm
When S9Y receives a Pingback, it parses the XML with one giant preg_match in function add_pingback in include/functions_trackbacks.inc.php
However, that regexp has two subtle errors that prevent it from successfully parsing the URLs (source and target) out of the XML.
The problem is with the two occurences of ([^<])* - they should both read ([^<]*). Otherwise, you'll only get the last character of the URL ...
Fixed version:
This is in Serendipity 1.1, downloaded today.
However, that regexp has two subtle errors that prevent it from successfully parsing the URLs (source and target) out of the XML.
Code: Select all
if(preg_match('@<methodcall>\s*<methodName>\s*pingback.ping\s*</methodName>\s*<params>\s*<param>\s*<value>\s*<string>([^<])*</string>\s*</value>\s*</param>\s*<param>\s*<value>\s*<string>([^<])*</string>\s*</value>\s*</param>\s*</params>\s*</methodCall>@i', $postdata, $matches)) {Fixed version:
Code: Select all
if(preg_match('@<methodcall>\s*<methodName>\s*pingback.ping\s*</methodName>\s*<params>\s*<param>\s*<value>\s*<string>([^<]*)</string>\s*</value>\s*</param>\s*<param>\s*<value>\s*<string>([^<]*)</string>\s*</value>\s*</param>\s*</params>\s*</methodCall>@i', $postdata, $matches)) {