2006-01-17
If 'useslash' is enabled and you upload a picture into dokuwiki, when you click on the thumbnail for a fullscreen version and to get lots of details about the image you get a stack of errors.
Warning: Unknown modifier 'r' in /home/special/wiki/helpdesk/inc/auth.php on line 259
Warning: Invalid argument supplied for foreach() in /home/special/wiki/helpdesk/inc/auth.php on line 261
Warning: Cannot modify header information - headers already sent by (output started at /home/special/wiki/helpdesk/inc/auth.php:259) in /home/special/wiki/helpdesk/lib/exe/detail.php on line 41
Looking at 259 and munching some debug its clear someone forgot about '/'s being part of the syntax for regex ;)
The solution is to replace '$id' with "preg_replace('/\\//','\\\\/',$id)" to escape those forward slashes, this should be fine even for when 'useslash' is off. The offending line then goes on to become:
$matches = preg_grep('/^'.preg_replace('/\\//','\\\\/',$id).'\\s+('.$regexp.')\\s+/',$AUTH_ACL);
The errors now all disappear.
Have fun
Cheers
Alex (alex-dokuwiki [at] digriz [dot] org [dot] uk)