Home  >  Q&A  >  body text

Title rewritten to read: PHP 7 is no longer compatible with using deprecated PHP4-style class constructors

<p>I'm trying to upgrade the PHP version of my WP website, which is hosted on SiteGround. The upgrade tool displays the following error: </p> <blockquote> <p>33 | WARNING | As of PHP 7, using the deprecated PHP4-style class constructors is not supported</p> </blockquote> <p>This is the code I found at the given location: </p> <pre class="brush:php;toolbar:false;">function gc_XmlBuilder($indent = ' ') { $this->indent = $indent; $this->xml = '<?xml version="1.0" encoding="utf-8"?>'."\n"; }</pre> <p>How do I fix this problem? </p>
P粉713846879P粉713846879394 days ago479

reply all(1)I'll reply

  • P粉755863750

    P粉7558637502023-08-25 23:19:20

    function __construct($indent = '  ') {
      $this->indent = $indent;
      $this->xml = '<?xml version="1.0" encoding="utf-8"?>'."\n";
    }

    Since you used to be able to define constructors by class name, but this has been deprecated since PHP 7:

    Error example, according to the documentation:

    reply
    0
  • Cancelreply