A use-after-free vulnerability exists in the PHP SOAP extension when processing DTD entity references in XML documents. The vulnerability allows the SOAP extension to free the document type definition (DTD) while attribute values still reference entities it owns, leading to potential reading of freed memory. This also bypasses the SOAP server's rejection of documents containing a DTD. An unauthenticated remote attacker can send crafted requests to a SOAP endpoint or control a WSDL/schema document to crash the PHP process, causing denial of service. Memory disclosure and code execution have not been confirmed. The issue affects PHP versions before 8.2.36, 8.3.37, 8.4.28, and 8.5.13.