title: Argument #1 ($parser) must be passed by reference
body: <p>Moving from PHP 7.4 to PHP 8.0, I've got a problem with some code throwing a warning. Code works, but I would like to figure out the problem. There were no  Warnings in PHP 7.4. Here are the Warnings: (modified to take my info out of the error)</p>
  <blockquote>
  <p>PHP Warning:  XML::open(): Argument #1 ($parser) must be passed by reference, value given in .../classes/xml_5.php on line 89</p>
  </blockquote>
  <blockquote>
  <p>PHP Warning:  XML::open(): Argument #1 ($parser) must be passed by reference, value given in .../classes/xml_5.php on line 89</p>
  </blockquote>
  <blockquote>
  <p>PHP Warning:  XML::open(): Argument #1 ($parser) must be passed by reference, value given in .../classes/xml_5.php on line 89</p>
  </blockquote>
  <blockquote>
  <p>PHP Warning:  XML::data(): Argument #1 ($parser) must be passed by reference, value given in .../classes/xml_5.php on line 89</p>
  </blockquote>
  <blockquote>
  <p>PHP Warning:  XML::close(): Argument #1 ($parser) must be passed by reference, value given in .../classes/xml_5.php on line 89</p>
  </blockquote>
  <blockquote>
  <p>PHP Warning:  XML::open(): Argument #1 ($parser) must be passed by reference, value given in .../classes/xml_5.php on line 89</p>
  </blockquote>
  <p>(they keep going on the same)</p>
  <p>The code:</p>
  <pre class="lang-php prettyprint-override"><code>    function __construct(){
          $this-&gt;parser = xml_parser_create();
          xml_parser_set_option($this-&gt;parser, XML_OPTION_CASE_FOLDING, false);
          xml_set_object($this-&gt;parser, $this);
          xml_set_element_handler($this-&gt;parser, 'open', 'close');
          xml_set_character_data_handler($this-&gt;parser, 'data');
      }
  
      function destruct(){ xml_parser_free($this-&gt;parser); }
  
      function &amp; parse(&amp;$data){
          $this-&gt;document = array();
          $this-&gt;stack    = array();
          $this-&gt;parent   = &amp;$this-&gt;document;
          $return_data = xml_parse($this-&gt;parser, $data, true) ? $this-&gt;document : NULL;     
          return $return_data;
      }
  </code></pre>
  <p>The problem line (89) is at the end, this line:</p>
  <pre class="lang-php prettyprint-override"><code>$return_data = xml_parse($this-&gt;parser, $data, true) ? $this-&gt;document : NULL;  
  </code></pre>
  <p>I see that in PHP 8 that xml_parse changed:
  8.0.0   parser expects an XMLParser instance now; previously, a resource was expected.</p>
  <p>I have spent days on this, and I am missing something! Thanks, everyone!</p>