[drupal-devel] [bug] Error handler ignores @ operator

Anonymous drupal-devel at drupal.org
Thu Feb 17 08:07:10 UTC 2005


 Project:      Drupal
 Version:      cvs
-Component:    system.module
+Component:    base system
 Category:     bug reports
 Priority:     normal
 Assigned to:  Anonymous
 Reported by:  Anonymous
 Updated by:   Anonymous
 Status:       patch

I have determined the source of this problem.  The fsockopen functions
(which are causing the errors) in drupal_http_request are already
prefixed with the @ operator... but it's not doing anything.  Why? 
Because Drupal implements its own custom error handler in the
error_handler function (inside common.inc).
To make the error_handler function respect the @ operator, this code
can be added to the top of the function:

<?php
// don't respond to the error if it was suppressed with a '@'
  if (error_reporting() == 0) {
    return;
  }
?>


This code was borrowed from a comment made on php.net [1].
[1]
http://us2.php.net/manual/en/language.operators.errorcontrol.php#37857


Anonymous



Previous comments:
------------------------------------------------------------------------

January 27, 2005 - 19:10 : Anonymous

When accessing the admin...settings page on a subdomain site, I get the
following two errors:
warning: fsockopen(): php_network_getaddresses: getaddrinfo failed:
Name or service not known in
/home/username/public_html/includes/common.inc on line 227.
warning: fsockopen(): unable to connect to sub.domain.com:80 in
/home/username/public_html/includes/common.inc on line 227.
This is a result of a failure to resolve the subdomain at my host. (DNS
is hosted elsewhere from the server.)  This could be easily fixed by
adding an "@" before
$request = drupal_http_request($GLOBALS['base_url'] . '/system/test');
in system.module.
I don't have an environment set up to create a patch at the moment, but
the change is very minor.


-- 
View: http://drupal.org/node/16309
Edit: http://drupal.org/project/comments/add/16309





More information about the drupal-devel mailing list