Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
mariopereiraBnext opened this issue Jun 19, 2023 · 0 comments
Open

Comments

@mariopereiraBnext
Copy link

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.

mariopereira added a commit to mariopereira/tnt that referenced this issue Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant