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

CRM_Utils_File::isChildPath - Fix checking of non-existent paths #22021

Merged
merged 1 commit into from
Nov 10, 2021

Conversation

totten
Copy link
Member

@totten totten commented Nov 10, 2021

Overview

This fixes an edge case for the utility function, isChildPath(). Suppose you use call isChildPath() with these options:

  • $parent='/nonexistent'
  • $child='/home/me/exists.txt'
  • $checkRealPath=TRUE

Do you regard the real file /home/me/exists.txt as a child of /nonexistent?

Before

Reports that /home/me/exists.txt is a child of /nonexistent.

After

Reports that /home/me/exists.txt is NOT a child of /nonexistent.

Comments

I added six test cases for how isChildPath() behaves when using $checkRealPath=TRUE. The first five cases behave the same with or without the patch. The patch fixes the last case.

Suppose you use call `isChildPath()` with these options:

* `$parent='/nonexistent'`
* `$child='/home/me/exists.txt'`
* `$checkRealPath=TRUE`

Before
=====

Reports that `/home/me/exists.txt` is a child of `/nonexistent`

After
=====

Reports that `/home/me/exists.txt` is NOT a child of `/nonexistent`

Comments
========

I added six test cases for how `isChildPath()` behaves when using
`$checkRealPath=TRUE`.  The first five cases behave the same with or without
the patch.  The patch fixes the last case.
@civibot
Copy link

civibot bot commented Nov 10, 2021

(Standard links)

@civibot civibot bot added the master label Nov 10, 2021
@demeritcowboy demeritcowboy merged commit 090b541 into civicrm:master Nov 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants