Undefined offset

This is the place to discuss bugs that have been found in the most recent version of PivotX. Posting bugs will ensure that the Development Team is aware of them and that they will be addressed when resources are available.

Undefined offset

Postby ITI » Fri Dec 30, 2011 8:34 pm

PHP errors
version: 2.3.1

The following errors may appear depending on the PHP error reporting values/levels.

1. "Notice: Undefined offset: 1 in \pivotx\objects.php on line 822
Code: Select all
       list($type, $root) = explode(":", $PIVOTX['config']->get('root'));
       ...

$PIVOTX['config']->get('root') doesn't exist or have a value on a fresh install but if it is required you could consider doing this:
Code: Select all
        if($PIVOTX['config']->get('root') != "") { list($type, $root) = explode(":", $PIVOTX['config']->get('root'));}
        else {$type = false;}
        if ($type=="w" && !empty($root) && isset($this->data[$root]) ) {
            $this->default = $root;
        } else {
            // Nothing to do but fall back to the first available weblog..
            reset($this->data);
            $this->default = key($this->data);
        }


2. Would you please comment out the call to "trigger_error( $errormsg, $lvl);" in "rss_fetch.inc", function error() on line 239.

In non-debug mode it displays the php error message as well as the "Oops message" as well as generating the error message in the php error log.
Since we don't want the visitor to see the "php error" msg, nor will the user ever empty/delete the error log and the details are still available in debug mode there is no reason that I can see to use it. (In debug mode the php error is not displayed or logged but still appears with all the details in the debug log)

However, you could elaborate and give the user a bit more information in the "Oops ..." message by adding the file name to the Oops message.
In ajaxhelper.php, line 776 Change:
Code: Select all
echo "<p>" . __("Oops! I'm afraid I couldn't read the Forum feed.") . "</p>";

To:
Code: Select all
echo "<p>" . __("Oops! I'm afraid I couldn't read the Forum feed from:<br />\"".$notifier_url."\".") . "</p>";

The user (and visitor) would see:
Oops! I'm afraid I couldn't read the Forum feed from:
"http://forum.pivotx.net/feed.xml".

I just happen to encounter this the other night when your site was offline/down.
My feeling is that a broken feed is just not that important and if it is, the developer for that site would be coding an alternate solution.
I say this because that is what I do when the Bank of Canada exchange feed is down, my system defaults to an approximate exchange rate.
Glen
ITI Internetworking Technologies Inc.
ITI
 
Posts: 7
Joined: Wed Dec 28, 2011 7:01 pm
Location: Edmonton, Alberta, Canada

Re: Undefined offset

Postby hansfn » Tue Jan 03, 2012 11:35 pm

Thx for the report, but such PHP notices are very low priority for me. (I think there is a forum thread for collecting them.)

1. That isn't an error - it's a PHP notice. The slight sloppy coding doesn't hurt anyone. (There are plenty of PHP warnings I would fix before starting to look at PHP notices.) You aren't logging PHP notices on a production server, I hope?

2. About the trigger_error - didn't know the warning displayed in non-debug mode. Thx, fixed in revision 4040 (and 4041 for the 2.3.x branch).

3. Won't change. A normal user don't need to know where the forum feed is located - it doesn't help them at all. An administrator can see the location in the error log (after revision 4040 / 4041 has been applied).
hansfn
Developer
 
Posts: 3282
Joined: Sun Nov 25, 2007 7:48 pm
Location: Molde, Norway

Re: Undefined offset

Postby ITI » Thu Jan 05, 2012 6:19 pm

Hi Hans

1. I shouldn't have reported this. It's actually a result of "user" misconfiguration and therefore not a program error at all.
2. Thanks for fixing trigger_error.
3. I agree it's not necessary to elaborate, but I wanted to offer an suggestion in the event that we didn't agree.
Glen
ITI Internetworking Technologies Inc.
ITI
 
Posts: 7
Joined: Wed Dec 28, 2011 7:01 pm
Location: Edmonton, Alberta, Canada


Return to 2.x Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron