1

Topic: admin_options.php missing header

Hi, first, I love this system. Also migrating about 1.000 posts from phpBB went fine. PunBB is way faster, and I appreciate this a lot.

Just one minor bug: http://.../admin_options.php is missing header, the HTML is beginning with <table class="punspacer" cellspacing="1" cellpadding="4">. Using latest 1.1.4 release (tar.bz2 package).

Re: admin_options.php missing header

Hav eyou made any modifications to the forum?

3

Re: admin_options.php missing header

no, none, I noticed that http://localhost/punbb/profile.php is missing header as well, and drop-down select box for styles is EMPTY

Re: admin_options.php missing header

That's very odd. I've never encountered that problem.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

5

Re: admin_options.php missing header

well, I did, after a fresh install, ALL pages are ok EXCEPT those 2 mentioned (admin_options and profile). Any hints where should I look? I am fluent in PHP smile

6

Re: admin_options.php missing header

aha, this was the error:

<b>Fatal error</b>:  
[] operator not supported for strings in 
<b>C:\www\punbb\profile.php</b> on line <b>1145</b>

7 (edited by rADo 2004-06-23 19:38)

Re: admin_options.php missing header

this is the required fix (around line 1145):

$styles=array(); // add this
while (($entry = $d->read()) !== false)
if (strpos($entry,'.css')!== false) $styles[] = substr($entry, 0, strlen($entry)-4);

Re: admin_options.php missing header

I wonder why that happens to you and you alone.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: admin_options.php missing header

Mmmm, oh dear Rickard - using variables without declaring them ;-)

Anyway, I looked in my code - which I thought was 1.1.4 but it is totally different!

while (($entry = $d->read()) !== false)
                {
                        if (substr($entry, strlen($entry)-4) == '.css')
                                $styles[] = substr($entry, 0, strlen($entry)-4);
                }

Now I appreciate that the {} are redundant and the css check in this is better than the one rADo posted (more correct) - but why are they different?

My last point (which was why I started a followup in the first place wink is that you can use if(substr($entry, -4) == '.css') and substr($entry,0,-4) here and save a couple of strlen() calls.

Re: admin_options.php missing header

pgregg wrote:

Mmmm, oh dear Rickard - using variables without declaring them ;-)

I do that a lot in 1.1.*. It's been remedied in 1.2 though. It's runs with error level E_ALL. This isn't the problem though. In rADo's case, the variable $styles for some reason already exists and is a string. And as you pointed out, he's not running 1.1.4.

raDo: What version are you running? Try echoing out $styles before the loop. It appears to be initialized already.

pgregg wrote:

Now I appreciate that the {} are redundant and the css check in this is better than the one rADo posted (more correct) - but why are they different?

You tell me :)

pgregg wrote:

My last point (which was why I started a followup in the first place ;) is that you can use if(substr($entry, -4) == '.css') and substr($entry,0,-4) here and save a couple of strlen() calls.

True. I'll make a note of it for 1.2. Thanks :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

11

Re: admin_options.php missing header

Rickard wrote:

raDo: What version are you running? Try echoing out $styles before the loop. It appears to be initialized already.

I'm running 1.1.4, downloaded few hours ago. Initilazing $styles=array(); did the trick, it's working fine now (in both profile / admin_options.php).

Re: admin_options.php missing header

rADo wrote:
Rickard wrote:

raDo: What version are you running? Try echoing out $styles before the loop. It appears to be initialized already.

I'm running 1.1.4, downloaded few hours ago. Initilazing $styles=array(); did the trick, it's working fine now (in both profile / admin_options.php).

You can't be. Here's how the code looks on line 1142 in profile.php in 1.1.4:

while (($entry = $d->read()) !== false)
{
    if (substr($entry, strlen($entry)-4) == '.css')
        $styles[] = substr($entry, 0, strlen($entry)-4);
}

and here's what you said it looks like

while (($entry = $d->read()) !== false)
if (strpos($entry,'.css')!== false) $styles[] = substr($entry, 0, strlen($entry)-4);

Do you see? It's completely different code.

"Programming is like sex: one mistake and you have to support it for the rest of your life."

13

Re: admin_options.php missing header

well, sorry for confusion, when trying to solve the problem I modified slightly the while {} cycle, but the only needed solution is to add $styles=array();

Re: admin_options.php missing header

rADo: For some reason, you are the only one getting this error and I want to find out why instead of "solving" it by defining the $styles array before the loop. Could you try echoing out the contents of $styles just before the loop? You can use the dump() function:

dump($styles);

"Programming is like sex: one mistake and you have to support it for the rest of your life."

15

Re: admin_options.php missing header

here you go:

<pre>g</pre>

16 (edited by pgregg 2004-06-24 11:06)

Re: admin_options.php missing header

Ok, $styles isn't defined or initialized _anywhere_ in punBB, so I presume rADo uses that variable in something else he does, which punBB is conflicting with.  That it is set to a string, then pubBB tries to append to is will cause that warning.

I'm afraid the correct fix is just that, to init the variable before punBB uses it since punBB currently assumes it is unset.

Re: admin_options.php missing header

As I suspected. The fix rADo suggested above is already incorporated into PunBB 1.2 (since it runs with error level E_ALL). Thanks anyway :)

"Programming is like sex: one mistake and you have to support it for the rest of your life."

18

Re: admin_options.php missing header

I've made available whole mod for download, here's more info:

http://forum.blogcms.com/viewtopic.php?id=226