(PHP 4, PHP 5, PHP 7, PHP 8)
xml_set_external_entity_ref_handler — Set up external entity reference handler
$parser, callable|string|null $handler): true
Sets the external entity reference handler function for the XML parser
parser.
parserXML-парсер.
handler
Якщо задано null, обробник буде скинуто до його початкового стану.
Якщо задано порожній рядок, обробник також буде скинуто, проте така дія застаріла, починаючи з PHP 8.4.0.
Якщо параметр handler має тип callable, то
обробником стане функція/метод, що має таку назву виклику.
Параметр handler може мати тип string, якщо
це назва метода об'єкта, встановленого функцією
xml_set_object().
Це є застарілим, починаючи з PHP 8.4.0.
Починаючи з PHP 8.4.0, назва виклику перевіряється на правильність під час встановлення обробника, а не під час його виклику. Це означає, що функцію xml_set_object() потрібно викликати перед встановленням назви метода, як зворотнього виклику. Однак, оскільки ця поведінка також є застарілою, починаючи з PHP 8.4.0, рекомендується використовувати правильну назву виклику (callable) методу.
The signature of the handler must be:
$parser,$open_entity_names,$base,$system_id,$public_idparserXML-парсер, що викликає обробника.
open_entity_namesA space-separated list of the names of the entities that are open for the parse of this entity (including the name of the referenced entity).
base
This is the base for resolving the system identifier
(system_id) of the external entity.
system_idThe system identifier as specified in the entity declaration.
public_idThe public identifier as specified in the entity declaration, or an empty string if none was specified; the whitespace in the public identifier will have been normalized as required by the XML spec.
The handler should return true if the entity was handled,
false otherwise.
When returning false the XML parser will stop parsing and
xml_get_error_code() will return
XML_ERROR_EXTERNAL_ENTITY_HANDLING.
Завжди повертає true.
| Версія | Опис |
|---|---|
| 8.4.0 |
Використання не-callable рядків (string) як
параметра handler тепер є застарілим. Необхідно
задавати правильну назву виклику методів або null для скидання обробника.
|
| 8.4.0 |
Правильність параметра handler, як назви виклику
(callable) тепер перевіряється на правильність під час
встановлення обробника, а не під час його виклику.
|
| 8.0.0 |
Тепер параметр parser має бути примірником
XMLParser. Раніше очікувався
xml-resource.
|
| 7.3.0 |
The return value of the handler is no longer
ignored if the extension has been built against libxml. Formerly, the return
value has been ignored, and parsing did never stop.
|