Closed wujwmail closed 5 months ago
Do you have a full call stack?
There seems to be no context support in __construct() in this Class1 subclass?
Source code file | https://github.com/peachpiecompiler/peachpie/blob/master/src/Peachpie.Library.XmlDom/DOMDocument.cs Constructor definition in the source file: Line 275:
public DOMDocument(string version = null, string encoding = null)
Should it be like this ?:
public DOMDocument(Context ctx, string version = null, string encoding = null)
This problem can be solved in a php script, but it's not elegant!
<?php
class xmldom extends DOMDocument{
public static function get_instance($file){
$o=new xmldom();
if(file_exists($file)) $o->load($file);
return $o;
}
public function __construct(){
parent::__construct();
}
}
$xml_filename="./abc.xml"; // The content of abc.xml is: <root>abc</root>
$obj1=xmldom::get_instance($xml_filename);
hi @wujwmail ! Thank you very much for reporting the issue.
It is a bug in our implementation of DOMDocument
. I'll take a look how to fix it.
Peachpie.Library.XmlDom test of php.
call this class error: Unhandled exception. System.NullReferenceException: Object reference not set to an instance of an object. In Peachpie, both file_exists and load will go wrong?