-
Bug
-
Resolution: Fixed
-
Minor
-
3.4.5, 3.5.2, 3.6
-
MOODLE_34_STABLE, MOODLE_35_STABLE, MOODLE_36_STABLE
-
MOODLE_34_STABLE, MOODLE_35_STABLE
-
While doing random checks with PHP 7.3 (MDL-63420) I saw this happening in unit tests (because strXXX() functions now require an string needle.
1) core_update_code_manager_testcase::test_list_plugin_folder_files |
strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
|
|
/var/www/html/lib/classes/update/code_manager.php:331 |
/var/www/html/lib/tests/update_code_manager_test.php:141 |
/var/www/html/lib/phpunit/classes/advanced_testcase.php:80 |
|
To re-run:
|
vendor/bin/phpunit "core_update_code_manager_testcase" lib/tests/update_code_manager_test.php |
|
2) core_update_code_manager_testcase::test_zip_plugin_folder |
strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
|
|
/var/www/html/lib/classes/update/code_manager.php:331 |
/var/www/html/lib/classes/update/code_manager.php:224 |
/var/www/html/lib/tests/update_code_manager_test.php:153 |
/var/www/html/lib/phpunit/classes/advanced_testcase.php:80 |
|
To re-run:
|
vendor/bin/phpunit "core_update_code_manager_testcase" lib/tests/update_code_manager_test.php |
|
3) core_update_code_manager_testcase::test_archiving_plugin_version |
strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior
|
|
/var/www/html/lib/classes/update/code_manager.php:331 |
/var/www/html/lib/classes/update/code_manager.php:224 |
/var/www/html/lib/classes/update/code_manager.php:265 |
/var/www/html/lib/tests/update_code_manager_test.php:180 |
/var/www/html/lib/phpunit/classes/advanced_testcase.php:80 |
|
To re-run:
|
vendor/bin/phpunit "core_update_code_manager_testcase" lib/tests/update_code_manager_test.php |
|
It seems, unless I'm missing something, that there is a parenthesis miss-placed there and it should be, instead:
diff --git a/lib/classes/update/code_manager.php b/lib/classes/update/code_manager.php
|
index 9eac43bf937..3493ad427fb 100644
|
--- a/lib/classes/update/code_manager.php
|
+++ b/lib/classes/update/code_manager.php
|
@@ -328,7 +328,7 @@ class code_manager {
|
if ($fileinfo->getFilename() === '..') {
|
continue;
|
}
|
- if (strpos($fileinfo->getRealPath(), $folderpathinfo->getRealPath() !== 0)) {
|
+ if (strpos($fileinfo->getRealPath(), $folderpathinfo->getRealPath()) !== 0) {
|
throw new moodle_exception('unexpected_filepath_mismatch', 'core_plugin');
|
}
|
$key = substr($fileinfo->getRealPath(), $strip);
|
- Discovered while testing
-
MDL-63420 Prepare Moodle for PHP 7.3
- Closed