ID:               34278
 User updated by:  gk at proliberty dot com
 Reported By:      gk at proliberty dot com
-Status:           Bogus
+Status:           Open
 Bug Type:         Documentation problem
 Operating System: Linux
 PHP Version:      Irrelevant
 New Comment:

I apologize for reopening this bug but it appears that bug #12261 was
closed prematurely and I was not able to add a comment or re-open that
bug since I am not the original author.

[EMAIL PROTECTED] did not indicate which functions would be corrected.

I see only this change for xml_parser_get_option, which is not
sufficient:
>This function returns FALSE if parser does not refer to a valid parser
or if option isn't valid (generates also a E_WARNING). Else the option's
value is returned. 

>See xml_parser_set_option() for the list of options.

The problem remains that there is NO indication anywhere that any of
the options in xml_parser_set_option are 'invalid' options for
xml_parser_get_option.

It is not enough to say "see xml_parser_set_option()..." without
updating that documentation to explain which options are only valid for
one function and not for the other.

A much better solution, in my opinion, would to simply update
xml_parser_get_option() to explain which options it supports rather
than requiring that xml_parser_set_option() documentation describe
'invalid' options for another function: each function's documentation
should focus clearly focus on its own domain.


Previous Comments:
------------------------------------------------------------------------

[2005-08-29 17:22:53] [EMAIL PROTECTED]

Status of this bug will be tracked under bug #12261.

------------------------------------------------------------------------

[2005-08-27 11:13:50] gk at proliberty dot com

Description:
------------
The documentation says, that options for xml_parser_get_option are
defined in  xml_parser_set_option - i.e., none of these options are
'unsupported'.

However, E_WARNING errors are generated by passing 'unsupported'
options to xml_parser_get_option.

E_WARNING indicates a serious problem (in my case, I always use a
custom error handler that elevates E_WARNING errors to E_USER_ERROR
(fatal) status).

Furthermore, I argue, xml_parser_get_option SHOULD INDEED support ALL
options that xml_parser_set_option supports since code should be able
to query the environment in which it runs.

Also, for the sake of consistency with other set/get functions, these
two functions should support the same options.

SEE RELATED BUG:
Bug #12261      xml_parser_get_option doesn't get all option that
xml_parser_set_option can set
http://bugs.php.net/bug.php?id=12261

Reproduce code:
---------------
<?php
$parser = xml_parser_create();
echo "XML_OPTION_CASE_FOLDING=".xml_parser_get_option
($parser,XML_OPTION_CASE_FOLDING)."\n<br>";
echo "XML_OPTION_TARGET_ENCODING=".xml_parser_get_option
($parser,XML_OPTION_TARGET_ENCODING)."\n<br>";
echo "XML_OPTION_SKIP_TAGSTART=".xml_parser_get_option
($parser,XML_OPTION_SKIP_TAGSTART)."\n<br>";
echo "XML_OPTION_SKIP_WHITE=".xml_parser_get_option
($parser,XML_OPTION_SKIP_WHITE)."\n<br>";
?>

Expected result:
----------------
XML_OPTION_CASE_FOLDING=1 
XML_OPTION_TARGET_ENCODING=UTF-8 
XML_OPTION_SKIP_TAGSTART=<current value>
XML_OPTION_SKIP_WHITE=<current value>

Actual result:
--------------
XML_OPTION_CASE_FOLDING=1 
XML_OPTION_TARGET_ENCODING=UTF-8 

Warning: xml_parser_get_option() [function.xml-parser-get-option]:
Unknown option in /usr/local/apache/htdocs/test/test.php on line 5
XML_OPTION_SKIP_TAGSTART= 

Warning: xml_parser_get_option() [function.xml-parser-get-option]:
Unknown option in /usr/local/apache/htdocs/test/test.php on line 6
XML_OPTION_SKIP_WHITE=


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34278&edit=1

Reply via email to