Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General::listStructure parameter $strip_root broken? #909

Closed
nils-werner opened this issue Nov 22, 2011 · 7 comments
Closed

General::listStructure parameter $strip_root broken? #909

nils-werner opened this issue Nov 22, 2011 · 7 comments

Comments

@nils-werner
Copy link
Contributor

It appears to me that General::listStructure()'s parameter $strip_root is broken: No matter what I provide as a value, the directory is never prepended to the value in the first place.

When opting to disable stripping I've expected to recieve something like

array(
    '/var/www/symphony/index.php',
    '/var/www/symphony/install.php',
)

but I always get something like

array(
    'index.php',
    'install.php',
)

no matter what I set here.

@brendo
Copy link
Member

brendo commented Nov 22, 2011

Looking at the code, both the listStructure and listDirStructure look to completely stuff up the $strip_root parameter and the documentation for the parameter is horribly confusing as well.

My understanding is the same as yours, if $strip_root is passed as false, I'd receive the full path to the file, if it's passed as true, I'd get just the filename.

I think what it's currently expecting is that if $strip_root is null, the full path to the file is returned, otherwise replace the value of $strip_root found in $dir (the first parameter) with ''. This appears to be what the core does in a number of places.

@nils-werner
Copy link
Contributor Author

I think what it's currently expecting is that if $strip_root is null, the full path to the file is returned, otherwise replace the value of $strip_root found in $dir (the first parameter) with ''. This appears to be what the core does in a number of places.

So by passing NULL you should get the full path. By passing DOCROOT you should get everything with DOCROOT taken out and when listing PAGES and passing PAGES as the strip_root param, you'd only get the basenames. That makes sense, it doesn't work though :-)

@brendo
Copy link
Member

brendo commented Nov 22, 2011

Yeah odd, it's used a number of times in the core so I'll have to check and see if it's broken there as well and if we are using some other means that is masking the real bug!

@nils-werner
Copy link
Contributor Author

I've pushed a possible solution to my generalliststructure branch.

I only did some simple testing: Browsing all backend pages and checking if things were still there. :-)

@brendo
Copy link
Member

brendo commented Nov 24, 2011

Pulled and tested, is working correctly as well. I've checked all instances of Symphony and the listStructure function was never used without the parameter (except for that Lang function you patched). I updated the documentation for that parameter to make more sense as well :)

Thanks @nils-werner :D

@nils-werner
Copy link
Contributor Author

Cool, thanks!

By the way did you know you can use the --no-ff flag during a merge or a pull to ensure Git won't fast-forward but will instead always finish the merge with a merge-commit?

That way it remains always reproducible what features came from whom and what branches.

@brendo
Copy link
Member

brendo commented Nov 24, 2011

No I didn't! You learn something new everyday :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants