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

php 7.3. regex and hyphen has to be escaped. #4036

Closed
Jimmi08 opened this issue Nov 30, 2019 · 7 comments
Closed

php 7.3. regex and hyphen has to be escaped. #4036

Jimmi08 opened this issue Nov 30, 2019 · 7 comments
Assignees
Labels
type: bug A problem that should not be happening
Milestone

Comments

@Jimmi08
Copy link
Contributor

Jimmi08 commented Nov 30, 2019

Just note.

It was mentioned here already:
https://github.com/e107inc/e107/issues/3986

But I found next regex with an unescaped hyphen. In e107_admin/dp.php file

if(isset($_GET['mode']))
{
    $_GET['mode'] = preg_replace('/[^\w-]/', '', $_GET['mode']);
}

if(isset($_GET['type']))
{
    $_GET['type'] = preg_replace('/[^\w-]/', '', $_GET['type']);
}
@Moc Moc added the type: bug A problem that should not be happening label Nov 30, 2019
@Moc Moc added this to the e107 2.3.0 milestone Nov 30, 2019
@Moc Moc self-assigned this Dec 1, 2019
@Moc
Copy link
Member

Moc commented Dec 1, 2019

Went through all preg_replace and think these are all (except for the one in #3986 for which a PR is open).

Not sure about this one:

e_parse_class.php

	if($type === 'file')
		{
			return preg_replace('/[^\w\d_\.-]/',"-",$text);
		}

@Moc
Copy link
Member

Moc commented Dec 1, 2019

Self-note: also good potential for unit testing

@Moc
Copy link
Member

Moc commented Apr 28, 2020

Think we got them all. Otherwise hopefully they'll be caught by the unit tests.

@Moc Moc closed this as completed Apr 28, 2020
@tgtje
Copy link
Contributor

tgtje commented Apr 28, 2020

@Moc i assume you are talking about caught them all in present files? Helas.. just use preg_replace as search item for this repo (here) There are still some present.. Sorry in case i am mistaken here (in understanding)

@Moc
Copy link
Member

Moc commented Apr 28, 2020

Which ones? You need to look specifically for those that cause an error in PHP 7.3 because of the hyphen.

@tgtje
Copy link
Contributor

tgtje commented May 1, 2020

Noticed some hyphens, but probably mistaken. (likely they are already done; understanding as mentioned before).

@Moc
Copy link
Member

Moc commented May 1, 2020

Feel free to let me know which ones you saw. Maybe you are right :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A problem that should not be happening
Projects
None yet
Development

No branches or pull requests

3 participants