Req #79344 [Asn->Csd]: xmlwriter_write_attribute_ns: $prefix should be nullable

From: Date: Tue, 16 Jun 2020 13:52:05 +0000
Subject: Req #79344 [Asn->Csd]: xmlwriter_write_attribute_ns: $prefix should be nullable
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-227512@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79344&edit=1 ID: 79344 Updated by: cmb@php.net Reported by: jtojnar at gmail dot com Summary: xmlwriter_write_attribute_ns: $prefix should be nullable -Status: Assigned +Status: Closed Type: Feature/Change Request Package: XML Writer Operating System: NixOS PHP Version: 7.4.3 Assigned To: cmb Block user comment: N Private report: N New Comment: Implemented as <http://git.php.net/?p=php-src.git;a=commit;h=aa754ba85e8241c0e59627c359d2c002a5caf8db>. Previous Comments: ------------------------------------------------------------------------ [2020-06-16 13:49:44] cmb@php.net Not strictly a bug; changing to feature request. ------------------------------------------------------------------------ [2020-06-16 12:17:40] cmb@php.net The following pull request has been associated: Patch Name: FR #79344: xmlwriter_write_attribute_ns: $prefix should be nullable On GitHub: https://github.com/php/php-src/pull/5724 Patch: https://github.com/php/php-src/pull/5724.patch ------------------------------------------------------------------------ [2020-06-16 12:16:44] cmb@php.net Indeed, @nikic, my analysis was nonsense. The point is that the $prefix parameter is not nullable. ------------------------------------------------------------------------ [2020-03-05 08:30:57] nikic@php.net @cmb: Are you sure that's the reason? Looking at the implementation, $prefix is accepted as s, not s!, so we will cast NULL to "". ------------------------------------------------------------------------ [2020-03-05 08:05:48] cmb@php.net The difference between passing NULL and an empty string to XMLWriter::writeAttributeNS() is that either NULL or an empty string is passed to xmlTextWriterWriteAttributeNS() (which does the actual work). The documentation of that function[1] is unfortunately not clear about whether there is a difference or not. So we can only observe the current libxml2 behavior, and it seems there is no difference. So I don't think there is anything we could do (except for calling xmlTextWriterWriteAttribute() if both prefix and uri are NULL, but that would constitute a BC break), besides documenting the behavior. http://xmlsoft.org/html/libxml-xmlwriter.html#xmlTextWriterWriteAttributeNS ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=79344 -- Edit this bug report at https://bugs.php.net/bug.php?id=79344&edit=1

« previous php.bugs (#227512) next »