WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#9158 closed defect (bug) (invalid)

@ error-control operator overuse?

Reported by: jidanni Owned by:
Milestone: Priority: lowest
Severity: trivial Version: 2.7
Component: General Keywords:
Focuses: Cc:

Description

Curious to see what the many places where WordPress uses the @
error-control operator

(language.operators.errorcontrol.html)
might be hiding these days, I pasted Example 1 Error handling with
set_error_handler() and trigger_error()
of
(function.set-error-handler.html
into wp-config.php, pointed my browser to wp-admin/index.php here
offline, and saw e.g.,

Assigning the return value of new by reference is deprecated
Creating default object from empty value
Non-static method WP_Http_Curl::test() should not be called statically, assuming $this from incompatible context
Non-static method WP_Http_ExtHTTP::test() should not be called statically, assuming $this from incompatible context
Non-static method WP_Http_Streams::test() should not be called statically, assuming $this from incompatible context
Redefining already defined constructor for class WP_Dependencies
Redefining already defined constructor for class WP_Http
Redefining already defined constructor for class WP_Object_Cache
Redefining already defined constructor for class wpdb
Undefined property: stdClass::$updates
Undefined property: stdClass::$version_checked
is_a(): Deprecated. Please use the instanceof operator
mysql_fetch_object(): supplied argument is not a valid MySQL result resource
mysql_free_result(): supplied argument is not a valid MySQL result resource
mysql_num_fields(): supplied argument is not a valid MySQL result resource
ob_end_flush() [ref.outcontrol]: failed to delete and flush buffer. No buffer to delete or flush.

It seems heavy use of the @ operator is masking at lease one or two places where you
perhaps might revise the code so it wouldn't raise an error in the
first place, and you could remove the @ operator. Or you might do
if($x){bla();} instead of just @bla();, making the code less prone to mishaps.

Change History (3)

comment:1 jidanni5 years ago

  • Cc jidanni@… added

comment:2 Denis-de-Bernardy5 years ago

  • Resolution set to invalid
  • Status changed from new to closed

please open more specific tickets when the @ should be needed in your opinion.

comment:3 hakre5 years ago

Realted: #9182

Note: See TracTickets for help on using tickets.