diff --git a/src/Database/PDOStatement.php b/src/Database/PDOStatement.php index 0ee8e6b..11ccdd9 100644 --- a/src/Database/PDOStatement.php +++ b/src/Database/PDOStatement.php @@ -66,6 +66,9 @@ class Database_PDOStatement extends PDOStatement implements IteratorAggregate } function getInt($name) { + if (!$this->fields) { + throw new Error('no fields'); + } return (int)$this->fields[$name]; } diff --git a/src/Path.php b/src/Path.php index 926f1a8..785ed95 100644 --- a/src/Path.php +++ b/src/Path.php @@ -173,11 +173,14 @@ class Path public static function makeUrl($path) { + $slash = (isset($path['host']) && strlen($path['path'] > 0) && ($path['path'][0] != '/')) ? '/' : ''; + return (isset($path['scheme']) ? $path['scheme'] . ':/' : '') . (isset($path['host']) ? ('/' . (isset($path['user']) ? $path['user'] . (isset($path['pass']) ? ':' . $path['pass'] : '') . '@' : '') . $path['host'] . (isset($path['port']) ? ':' . $path['port'] : '')) : '') + . $slash . $path['path'] . (isset($path['query']) ? '?' . $path['query'] : '') . (isset($path['fragment']) ? '#' . $path['fragment'] : ''); @@ -286,8 +289,9 @@ class Path $parts = new Path($file); $result [] = $parts->getParts(); } + // При обьединении ссылок можно обьеденить path, query, fragment - $path = implode(self::SEPARATOR, self::optimize(call_user_func_array('array_merge', $result))); + $path = implode(self::SEPARATOR, self::optimize(call_user_func_array('array_merge', $result))); $parts0->url['path'] = ($parts0->isAbsolute()) ? '/' . $path : $path; return $parts0; }