1--TEST-- 2libxml_get_external_entity_loader() returns current handler 3--EXTENSIONS-- 4libxml 5--FILE-- 6<?php 7 8class Handler { 9 private $name; 10 11 public function __construct($name) { 12 $this->name = $name; 13 } 14 15 public function handle($public, $system, $context) { 16 return null; 17 } 18 19 public function __toString() { 20 return "Handler#{$this->name}"; 21 } 22} 23 24var_dump(libxml_get_external_entity_loader()); 25libxml_set_external_entity_loader([new Handler('A'), 'handle']); 26print libxml_get_external_entity_loader()[0] . "\n"; 27libxml_set_external_entity_loader([new Handler('B'), 'handle']); 28print libxml_get_external_entity_loader()[0] . "\n"; 29libxml_set_external_entity_loader(null); 30var_dump(libxml_get_external_entity_loader()); 31 32--EXPECT-- 33NULL 34Handler#A 35Handler#B 36NULL 37