Skip to content

AbstractXml destructor emiting a warning (again and with fix) #36

@mariopereiraBnext

Description

@mariopereiraBnext

The problem in issue AbstractXml destructor emiting a warning is back, even with the fix.

The same message of XMLWriter::flush(): Invalid or uninitialized XMLWriter object is still poping up in vendor\200mph\tnt-express-connect\src\service\ShippingService\entity\AbstractXml.php

I've made a composer update and can't see any changes except for the fixes of issues 33 and 34, but the warning is back.

I had to change the method to the following:

/**
 * Flush XML memory when destruct object
 */
public function __destruct()
{
    set_error_handler(function() {});

    if($this->xml instanceof MyXMLWriter) {
        $this->xml->flush();
    }

    restore_error_handler();
}

Basically, I had to shut down error handling for the method.
This works, but I haven't had time to check for bad side effetcts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions