Wedge

Public area => Bug reports => The Pub => Archived fixes => Topic started by: Arantor on November 15th, 2012, 04:19 AM

Title: Undefined: ex_string in Class-CSS
Post by: Arantor on November 15th, 2012, 04:19 AM
 Undefined variable: ex_string in C:\wamp\www\wedge\Sources\Class-CSS.php on line 800

Points to:
Code: [Select]
// Did we finish the file with an extends or unextends...? Immediately open it and close it.
if ((strpos($ex_string, ' extends ') !== false || strpos($ex_string, ' unextends ') !== false))
$tree .= " {\n}\n";
while ($level > 0)
{
$tree .= '}';
$level -= $indent;
}

This came up after trying to load my calendar CSS file in the admin panel. I'd note that at no other time has it given me this error - including since I last changed it.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Arantor on November 15th, 2012, 04:27 AM
OK, now it's doing it every time I update the file.

Said file:
Code: [Select]
.calendar_table
width: 100%
th.days
width: 14%
td.days
vertical-align: top

.three-columns
box-sizing: border-box
vertical-align: top
width: 32%
margin: 0 .5%
display: inline-block

header .weekly
text-align: center

.weeklist
td
text-align: center
height: 49px
width: 7%
font-size: large
padding: 0 7px
td.weekdays
width: 100%
padding: 4px
text-align: left
vertical-align: middle

div.day
font-size: .9em
text-align: left

.event
color: #078907

.holiday
color: #000080

.chk
display: inline
float: left
width: 24%
padding: 3px
Posted: November 15th, 2012, 04:25 AM

OK, so I figured out what the root cause it, though I have no idea how it manifests it this way. If you call add_plugin_css_file with a file that doesn't exist, it sort of chokes on it silently up until this point.

Basically, I'd managed to put add_plugin_css_file('Wedgeward:Calendar', 'calendar.css', true); because I'd forgotten about not needing extensions there.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Nao on November 17th, 2012, 12:36 AM
If your css file doesn't exist, it shouldn't even loop through $branches, i.e. not encounter that $ex_string line...??
Title: Re: Undefined: ex_string in Class-CSS
Post by: Arantor on November 17th, 2012, 12:44 AM
Well, that's what I thought, but that's what's happening. The error went away as soon as I switched it to 'calendar' instead of 'calendar.css'.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Nao on November 17th, 2012, 08:19 PM
Maybe we should test for '.css' if the file is not found, i.e. just replace '.css.css' with '.css'...? For starters.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Arantor on November 17th, 2012, 08:47 PM
If the file's not found, I'd prefer to throw an error to the log rather than trying to silently fix things.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Nao on November 18th, 2012, 11:25 AM
I don't know.

I'll look into your code.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Nao on November 18th, 2012, 12:13 PM
Okay, I reproduced it... I also managed to trigger a bug when doing a 404 on a regular add_css_file call (which I fixed locally.)
I'm gonna have to leave my PC for now so I'll look into fixing the plugin bug later. (i.e adding fault tolerance for '.css.css')
Title: Re: Undefined: ex_string in Class-CSS
Post by: Arantor on November 26th, 2012, 03:58 AM
Is this the one you've mentioned as fixing in the last changelog or so? I don't want to re-test it without being sure.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Nao on November 27th, 2012, 12:42 AM
Yup...
Won't fix the file by adding .css.css, though. It'll just ignore the failed file. Normally.
Title: Re: Undefined: ex_string in Class-CSS
Post by: Arantor on November 27th, 2012, 12:45 AM
I still think it would e better to flag the error, that way someone can deal with it; I wouldn't have figured it out for a while if I hadn't been specifically looking.