Upgraded v1.1 Beta5 from v1.0.1 -- PHP Warnings under Edit

Found a bug? Tell us!!
Post Reply
Brendon K
Regular
Posts: 44
Joined: Thu Feb 23, 2006 10:35 pm
Location: Saratoga Springs, NY, USA
Contact:

Upgraded v1.1 Beta5 from v1.0.1 -- PHP Warnings under Edit

Post by Brendon K »

When editing a story, I still receive two PHP Warnings (not notices, but I have my PHP set to display those as well) when attempting to edit an entry.

1.) Warning: Invalid argument supplied for foreach() in C:\Apache\htdocs\s9y\include\functions.inc.php on line 311

2.) Warning: Invalid argument supplied for foreach() in C:\Apache\htdocs\s9y\include\functions.inc.php on line 329

Like stated in the topic title, this was an upgrade. I will check tomorrow to see if it still shows this error on a clean install (though I would think it does). Since I also have Xdebug installed on my test server, it really screws up the layout of the administration section when these errors are displayed, but I notice if entries are available to be edited, they're outside the bounding box of the administration section (below the outer-most border) in Firefox, not IE(6). I haven't tested Opera. Not sure if it would occur without the long error messages or not.
They say, "Practice makes perfect," yet they also say, "Nobody's perfect." I don't get it.
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Upgraded v1.1 Beta5 from v1.0.1 -- PHP Warnings under Ed

Post by garvinhicking »

Hi!

Which PHP version are you using?

The function which makes the error is a foreach loop on an $ary variable.

However this check at the top of the serendipity_walkRecursive function should detect that:

Code: Select all

    if (!is_array($ary) || sizeof($ary) == 0) {
        return array();
    }
So I wonder why this is not stepping in for you. Can you do a "print_r($ary)" in that function to see what the variable looks like that is yielding those errors?

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Brendon K
Regular
Posts: 44
Joined: Thu Feb 23, 2006 10:35 pm
Location: Saratoga Springs, NY, USA
Contact:

Post by Brendon K »

The following check was the only one found in my file's copy:

Code: Select all

    if (sizeof($ary) == 0) {
        return array();
    }
At the top of the file, the version comments are as follows:

Code: Select all

# $Id: functions.inc.php 1413 2006-08-27 11:29:00Z garvinhicking $
# Copyright (c) 2003-2005, Jannis Hermanns (on behalf the Serendipity Developer Team)
# All rights reserved.  See LICENSE file for licensing details
I'm currently using PHP v5.1.6 with a slightly modified php.ini-recommended file under WinXP Pro.

I'm guessing that perhaps your local copy and the copy in the repository aren't the same? (I downloaded this version from the SourceForge package.) Once I make the check the same as the version you gave, it works perfectly fine. No errors, warnings, or notices are generated (and the display error no longer exists).
They say, "Practice makes perfect," yet they also say, "Nobody's perfect." I don't get it.
Post Reply