Bug #18172 XML: Extractvalue() accepts mallformed XPath without a XPath syntax error
Submitted: 12 Mar 2006 21:23 Modified: 22 Mar 2006 17:31
Reporter: Roland Bouman Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: XML functions Severity:S3 (Non-critical)
Version:5.1.7/5.1.8 BK OS:Windows (win xp pro/Linux)
Assigned to: Alexander Barkov CPU Architecture:Any

[12 Mar 2006 21:23] Roland Bouman
Description:
ExtractValue can be passed a mallformed XPath expression and no syntax error or warning is generated.

How to repeat:
mysql> select extractValue('<e><a>1</a></e>','/e/');
+---------------------------------------+
| extractValue('<e><a>1</a></e>','/e/') |
+---------------------------------------+
|                                       |
+---------------------------------------+
1 row in set (0.00 sec)

(XPath expression should not end with / - )

Suggested fix:
generate an error indicating the xpath expression is mallformed. In this case, a abbreviated axis specifier, axis name or abbreviated step should follow the last /
[13 Mar 2006 0:12] MySQL Verification Team
Thank you for the bug report.
[20 Mar 2006 11:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/3972
[21 Mar 2006 11:23] Sergei Glukhov
ok to push
[22 Mar 2006 9:05] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/4009
[22 Mar 2006 9:10] Alexander Barkov
Fixed in 5.1.8
[22 Mar 2006 17:31] Mike Hillyer
Documented:

      <listitem>
        <para>
          The <function>EXTRACTVALUE()</function> function did not
          return an error when passed an invalid XPATH string. (Bug
          #18172)
        </para>
      </listitem>