code: public function securityScan($xml)
      {
          $pattern = '/\\0?' . implode('\\0?', str_split('<!DOCTYPE')) . '\\0?/';
          if (preg_match($pattern, $xml)) {
              throw new Exception('Detected use of ENTITY in XML, spreadsheet file load() aborted to prevent XXE/XEE attacks');
          }
  
          return $xml;
      }
docs: Scan theXML for use of <!ENTITY to prevent XXE/XEE attacks.
  
  @param string $xml
  
  @throws Exception
  
  @return string