Bug in CobblePage::stdpath

Permalink Browser Info Environment
If any of the searched folders are missing (e.g. single-pages) from the site, CobblePage will start traversing the entire filesystem starting from / (which could account for the execution time exceeded error someone else reported).

Here's the fix:

diff -ruN cobble-ORIG/models/cobble_page.php cobble/models/cobble_page.php
--- cobble-ORIG/models/cobble_page.php 2010-09-12 13:13:20.000000000 -0700
+++ cobble/models/cobble_page.php 2011-07-26 11:20:32.000000000 -0700
@@ -491,7 +491,7 @@
if (!$tpath = realpath($path)) {
$tpath = $path;
}
- return str_replace('\\','/',realpath($tpath));
+ return str_replace('\\','/',$tpath);
}

// List all subdirectories (except ., ..) in the specified directory.)

Type: Discussion
Status: New
crispyking
View Replies:
agedman replied on at Permalink Reply
agedman
@crispyking, I agree with your proposed patch and will post an updated version. I didn't realize that realpath returns FALSE if the path doesn't exist. You're right that that could result in scanning the root directory and its immediate subdirectories -- which we definitely don't want to do!

I can't see how it could cause the entire file system to be traversed, though. The glob() function isn't recursive, and I don't believe there's any recursion in my code. If I'm wrong on this, let m know...

Edit: patch applied in version 1.14
jasteele12 replied on at Permalink Reply
jasteele12
I just downloaded this, it's version 1.13 according to concrete 5.5.1 (also listed as 1.13 on the marketplace page, 1.14 in the download).

Also, after clicking on the Dashboard -> Cobble link I get the following warning:

Warning: file_get_contents(/home/rollerderby/c551/themes/dashboard/description.txt) [function.file-get-contents]: failed to open stream: No such file or directory in /home/rollerderby/rollerderbynation.net/packages/cobble/models/cobble_page_theme.php on line 121
agedman replied on at Permalink Reply
agedman
Hi,

It looks like one of your themes may be missing 'description.txt'. Cobble isn't handling that eventuality very gracefully.

Sorry about the version confusion -- I'll see if I can fix that.

It's getting hard for me to find time to maintain this addon. But I just put the source up at github, in case that helps anyone.

https://github.com/ddrake/cobble...

Please feel free to fork it...

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.