bootstrap.inc produces [Notice] in error_log

AjK - April 26, 2006 - 09:46
Project:Drupal
Version:x.y.z
Component:base system
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

Every drupal page reports :-

PHP Notice:  Undefined index:  path in /home/drupal/drupal/includes/bootstrap.inc on line 161

Fixed with this:-

--- bootstrap.inc.orig Fri Apr 21 07:39:00 2006
+++ bootstrap.inc Wed Apr 26 10:35:35 2006
@@ -158,7 +158,7 @@ function conf_init() {
$parts = parse_url($base_url);
$base_path = isset($parts['path']) ? $parts['path'] . '/' : '/';
// Build $base_root (everything until first slash after "scheme://").
- $base_root = substr($base_url, 0, strlen($base_url) - strlen($parts['path']));
+ $base_root = substr($base_url, 0, strlen($base_url) - strlen($base_path));
}
else {
// Create base URL

--AjK

#1

Tobias Maier - April 26, 2006 - 18:51
Status:active» needs review

#2

AjK - May 1, 2006 - 13:30

The above patch for removing this PHP warning was incorrect.

Here is the code method:-

--- bootstrap.inc.orig  Mon May  1 14:22:21 2006
+++ bootstrap.inc       Mon May  1 14:23:27 2006
@@ -158,7 +158,7 @@ function conf_init() {
     $parts = parse_url($base_url);
     $base_path = isset($parts['path']) ? $parts['path'] . '/' : '/';
     // Build $base_root (everything until first slash after "scheme://").
-    $base_root = substr($base_url, 0, strlen($base_url) - strlen($parts['path']));
+    $base_root = @substr($base_url, 0, strlen($base_url) - strlen($parts['path']));
   }
   else {
     // Create base URL

--AjK

#3

JonBob - May 1, 2006 - 17:37

Here's a patch to fix the cause of the error rather than suppressing the error.

I think this is rather important to fix, as it happens before our error handler is installed, so the error may be echoed to the browser in certain configurations.

AttachmentSize
bootstrap_19.patch 816 bytes

#4

drumm - May 2, 2006 - 08:38
Status:needs review» fixed

I decided that an if statemkent was better than a ternanry operaor in this case.

Comitted to HEAD.

#5

Anonymous - May 16, 2006 - 08:45
Status:fixed» closed
 
 

Drupal is a registered trademark of Dries Buytaert.