Skip to content

PHP 8.1 fwrite(): Passing null to parameter #2 ($data) of type string is deprecated in Masterminds\HTML5\Serializer\OutputRules->wr()  #254

Description

@jkamizato

This is an error that shows up, using Drupal.

In that case, this method is called: Html::serialize($dom); , but $dom->nodeValue is null, and its causing the error.

Propose a solution: upcasting fwrite function with string:

    /**
     * Write to the output.
     *
     * @param string $text The string to put into the output
     *
     * @return $this
     */
    protected function wr($text)
    {
        fwrite($this->out, (string) $text);

        return $this;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions