Home » Networking » Net_URL » Bug #2824
error suppresion is used where code canbe easily changed to avoid errors
Details
| Request #2824 | error suppresion is used where code canbe easily changed to avoid errors |
|---|---|
| Submitted | 2004-11-24 22:35 UTC |
| From | alexei at net24 dot co dot nz |
| Status | Closed |
| Package | Net_URL |
| PHP Version | 5.0.2 |
| OS | freebsd |
| Roadmaps | (Not assigned) |
Comments
[2004-11-24 22:35 UTC] alexei at net24 dot co dot nz
Description:
------------
functions __construct and _parseRawQuerystring use error suppression (@) where code can be easily rewritten to avoid errors
patch included
Reproduce code:
---------------
? Net_URL.diff
Index: URL.php
===================================================================
RCS file: /repository/pear/Net_URL/URL.php,v
retrieving revision 1.37
diff -u -r1.37 URL.php
--- URL.php 26 Jun 2004 12:45:07 -0000 1.37
+++ URL.php 24 Nov 2004 22:21:06 -0000
@@ -125,7 +125,7 @@
// Only use defaults if not an absolute URL given
if (!preg_match('/^[a-z0-9]+:\/\//i', $url)) {
- $this->protocol = (@$_SERVER['HTTPS'] == 'on' ? 'https' : 'http');
+ $this->protocol = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on' ? 'https' : 'http');
/**
* Figure out host/port
@@ -370,7 +370,7 @@
}
if (substr($key, -2) == '[]') {
$key = substr($key, 0, -2);
- if (@!is_array($return[$key])) {
+ if (!isset($return[$key]) || !is_array($return[$key])) {
$return[$key] = array();
$return[$key][] = $value;
} else {