ZF-6142: @ operator should be avoided in Zend_Dom_Query

Issue Type: Bug Created: 2009-03-27T13:08:43.000+0000 Last Updated: 2010-02-04T11:02:00.000+0000 Status: Resolved Fix version(s): - 1.10.1 (10/Feb/10)

Reporter: Till Klampaeckel (till) Assignee: Matthew Weier O'Phinney (matthew) Tags: - Zend_Dom_Query

Related issues: Attachments:


If used the means to debug are next to 0 without editing the code (to remove the @-operator).

<pre class="highlight">
--- library/Zend/Dom/Query.php  (revision XXX)
+++ library/Zend/Dom/Query.php  (working copy)
@@ -176,12 +176,12 @@
         $type   = $this->getDocumentType();
         switch ($type) {
             case self::DOC_XML:
-                $success = @$domDoc->loadXML($document);
+                $success = $domDoc->loadXML($document);
             case self::DOC_HTML:
             case self::DOC_XHTML:
-                $success = @$domDoc->loadHTML($document);
+                $success = $domDoc->loadHTML($document);

It should be left to the developer to catch E_WARNING instead. There's multiple ways, e.g. an error handler to generate an exception or a simple log file, etc..

This should be added to the Coding Standards as well so people avoid this kind of thing in other components.


Posted by Till Klampaeckel (till) on 2009-03-27T13:09:18.000+0000

Assigned component.

Posted by Benjamin Eberlei (beberlei) on 2009-09-17T15:31:44.000+0000

Assigned to component lead

Posted by Matthew Weier O'Phinney (matthew) on 2010-01-21T09:08:31.000+0000

One problem: this component was designed for use in unit testing. By omitting the '@' operator, PHPUnit tests that would otherwise pass now fail due to a notice or warning being raised. While the underlying cause should likely be corrected, in some instances, developers need to work with bad markup.

I'll review the rationale for using the suppression to see if there may be another route to take.

Posted by Matthew Weier O'Phinney (matthew) on 2010-02-04T11:02:00.000+0000

Updated in trunk and 1.10 release branch.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.