facebook / facebook/hhvm

XMLWriter::writeAttributeNS does not correctly deal with null values for the namespaceUri.

オープン
#4,336 コメント 0 件 リアクション 0 件 担当者 1 名 @paulbiss が担当を希望しています GitHub で見る
php5 incompatibility
主要言語
C++
スター
18.7k
フォーク
3.1k
平均マージ
1時間 47分
マージ済み PR(30日)
2

説明

### Example 1: attribute is dropped

``` php
openMemory();

$xmlWriter->startDocument();

$xmlWriter->startElementNS('s', 'root', 'http://sabre.io/ns');

$xmlWriter->writeAttributeNS('s', 'foo', null, 'bar');
$xmlWriter->endElement();

echo $xmlWriter->outputMemory(), "\n";
```

Vanilla PHP output:

``` xml

```

HHVM output:

``` xml

```
### Example 2: extra xmlns declaration with empty string

``` php
openMemory();

$xmlWriter->startDocument();

$xmlWriter->startElementNS('s', 'root', 'http://sabre.io/ns');

$xmlWriter->startElementNS('s', 'child', null);
$xmlWriter->writeAttributeNS('s', 'foo', null, 'bar');
$xmlWriter->endElement();

$xmlWriter->endElement();

echo $xmlWriter->outputMemory(), "\n";
```

Vanilla PHP output:

``` xml

```

HHVM output:

``` xml

```

Interesting to note that PHP also had the same issue up until PHP 5.2.2, according to 3v4l.
### Workaround

Instead of calling:

``` php
$xmlWriter->writeAttributeNS('s', 'foo', null, 'bar');
```

It's possible to just call:

``` php
$xmlWriter->writeAttributeNS('s:foo', 'bar');
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。