Can anybody running EA 1.1.2 test this (especially with nginx + php7 like me)? Admin > Maintenance > Routine > Check all files against current versions > Run task now
I kinda got an error but will need confirmation from others before reporting.
It doesn't seems to be the problem with the 1.1.2 update. I will carry on inspecting. Meanwhile, I do appreciate any feedback from others.
I'm getting an open basedir restriction error. Which is puzzling.... :-X
Ok. That is the same with me
@badmonkey (we both use ISPConfig).
The error:
The ".." is not a file at all. The line complained is "if ($dir->isDir())" of which "$dir" revert back to "$iter" in the function below:
function readFileVersions(&$version_info, $directories, $pattern, $recursive = false)
{
// The comment looks roughly like... that.
$version_regex = '~\*\s@version\s+(.+)[\s]{2}~i';
$unknown_version = '??';
$ext_offset = -strlen($pattern);
foreach ($directories as $type => $dirname)
{
if ($recursive === true)
{
$iter = new RecursiveIteratorIterator(
new RecursiveDirectoryIterator($dirname, RecursiveDirectoryIterator::SKIP_DOTS),
RecursiveIteratorIterator::CHILD_FIRST,
RecursiveIteratorIterator::CATCH_GET_CHILD // Ignore "Permission denied"
);
}
else
{
$iter = new IteratorIterator(new DirectoryIterator($dirname));
}
foreach ($iter as $dir)
{
if ($dir->isDir())
{
continue;
}
$entry = $dir->getFilename();
if (substr($entry, $ext_offset) == $pattern)
{
if ($dir->isWritable() === false)
{
continue;
}
// Read the first 768 bytes from the file.... enough for the header.
$header = file_get_contents($dir->getPathname(), false, null, 0, 768);
if ($recursive === true)
{
$entry_key = $dir->getPathname();
}
else
{
$entry_key = $entry;
}
// Look for the version comment in the file header.
if (preg_match($version_regex, $header, $match) == 1)
$version_info[$type][$entry_key] = $match[1];
// It wasn't found, but the file was... show a $unknown_version.
else
$version_info[$type][$entry_key] = $unknown_version;
}
}
}
}
I think, somehow, "$iter" also catches ".." as file which it should not. The php coding is an advanced one (to me), so I am not quite sure I understand correctly nor I am able to help on determining the true error or fixing this one.
I hope @emanule can look into it.
Yeah, kind of wondered if that was the same error you were getting.
For sake of full disclosure, nginx 1.13.9, php 7.2.2, mariadb 10.2.13. It's probably irrelevant, but just in case. 8)
Linux kernel 4.15.7, Nginx 1.13.8, Php 7.2.2, MariaDB 10.2.13 ;)
Could it be because we are using "DirectoryIterator" instead of "FilesystemIterator" where the former may use "." and ".." (). I tested with the later and it works without error but I need confirmation.
The original code:
$iter = new IteratorIterator(new DirectoryIterator($dirname));
The fixed code?:
$iter = new IteratorIterator(new FilesystemIterator($dirname));
Is this the right way to fix it
@emanuele?
Edited: I opened this as an issue and PR the above as suggested fix, so time will not be wasted if it is acceptable as a fix.
works fine for me ;)
if can be useful test.sss.ovh/skoda/phpinfo_.php
That is because your open_basedir has no value, which is not safe / advisable. Mine (and probably
@badmonkey too) has value to it.
Confirmed it works without the error, and without errors in the forum error log. 8) Nice work
@ahrasis
I guess so
@ahrasis Iterator are still a bit a mystery for me. :P
For me all codes are always mysterious... :P
LOL
Just to note that this is somehow missed in 1.1.3 package. I think issue number was #3120 but I will create a new PR anyway.
O:-)
I noted that
@emanuele reverted the iterator to the old one in EA 1.1.5 causing the same error all over again. Please refix in 1.1.6 and note that I won't be re-opening the same issue again at github.
@ahrasis you sent the pull request to development, not to the patch version, I didn't notice and the fix was missed.
https://github.com/elkarte/Elkarte/pull/3166
Sorry but I only know as there are only development, master and gh-pages branches; and I am not sure how to PR to other than that. I remember that I was told that PR to development should be fine?
This 1.1.2 fix was already noted by you and
@Spuds in PR #3121 and #3166, for milestone 1.1.3 and 1.1.4, and I only come to know it is not there again when I updated to 1.1.5 as I haven't updated to 1.1.4; so I don't have clue if somebody will forget about it again in any update?
I guess I'll post and remind here (forum instead of github) in the future.
@emanuele If you create the 1.1.6 branch I will do that change against that. Same as the other outstanding one I currently have on there that I can't switch to the new branch as it doesn't exist.
That ok with you
@ahrasis ?
Oh my... I forgot to create the branch, sorry!! :-[
Now it's up.