Skip to content

Issue #140: Added explicit parameters for str_getcsv()#142

Merged
micoreyes merged 1 commit into
MOODLE_401_STABLEfrom
MOODLE_401_STABLE-issue140
Jul 17, 2026
Merged

Issue #140: Added explicit parameters for str_getcsv()#142
micoreyes merged 1 commit into
MOODLE_401_STABLEfrom
MOODLE_401_STABLE-issue140

Conversation

@niko-hoogeveen

Copy link
Copy Markdown
Contributor

Closes issue #105.

Updated file_search::get_id_from_csv to call str_getcsv() with explicit parameters to fix deprecation warnings during unit tests.

Environment

- Moodle 5.1.5+ (Build: 20260714)
- PHP: 8.4.22
- DB: MySQL 8.4
- PHPUnit: 11.5.55
- Branch: MOODLE_401_STABLE

Testing instructions:

  • tool_advancedreplace test suite: vendor/bin/phpunit --testsuite tool_advancedreplace_testsuite
  • Running the unit tests for tool_advancedreplace will produce the following warning (on the above environment):
Moodle 5.1.5+ (Build: 20260714)
Php: 8.4.22, mysqli: 8.4.10, OS: Linux 6.17.0-1028-oem x86_64
PHPUnit 11.5.55 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.22
Configuration: /var/www/upstream-plugins/phpunit.xml

............DDDD.DDDDD..............S....                         41 / 41 (100%)

Time: 00:06.373, Memory: 82.50 MB

9 tests triggered 1 PHP deprecation:

1) /var/www/upstream-plugins/public/admin/tool/advancedreplace/classes/file_search.php:642
str_getcsv(): the $escape parameter must be provided as its default value will change

Triggered by:

* tool_advancedreplace\file_search_test::test_get_id_from_csv#0
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:213

* tool_advancedreplace\file_search_test::test_get_id_from_csv#1
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:213

* tool_advancedreplace\file_search_test::test_get_id_from_csv#2
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:213

* tool_advancedreplace\file_search_test::test_get_id_from_csv#3
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:213

* tool_advancedreplace\file_search_test::test_resume#1 (2 times)
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:269

* tool_advancedreplace\file_search_test::test_resume#2 (2 times)
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:269

* tool_advancedreplace\file_search_test::test_resume#3 (3 times)
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:269

* tool_advancedreplace\file_search_test::test_resume#4 (3 times)
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:269

* tool_advancedreplace\file_search_test::test_resume#5 (2 times)
  /var/www/upstream-plugins/public/admin/tool/advancedreplace/tests/file_search_test.php:269

OK, but there were issues!
Tests: 41, Assertions: 145, Deprecations: 1, PHPUnit Deprecations: 10, Skipped: 1.

Expected Output from PHPUnit Tests

  • Pulling this branch MOODLE_404_STABLE-issue105 and re-running the testsuite:
Moodle 5.1.5+ (Build: 20260714)
Php: 8.4.22, mysqli: 8.4.10, OS: Linux 6.17.0-1028-oem x86_64
PHPUnit 11.5.55 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.22
Configuration: /var/www/upstream-plugins/phpunit.xml

....................................S....                         41 / 41 (100%)

Time: 00:06.244, Memory: 80.50 MB

OK, but there were issues!
Tests: 41, Assertions: 145, PHPUnit Deprecations: 10, Skipped: 1.

@micoreyes

Copy link
Copy Markdown
Contributor

Code changes looks good to me.

Tested in 501

root@840eefc78542:/var/www/catalystupstream501# vendor/bin/phpunit --testsuite tool_advancedreplace_testsuite
Moodle 5.1.5+ (Build: 20260714)
Php: 8.4.23, pgsql: 17.10 (Debian 17.10-1.pgdg13+1), OS: Linux 6.17.0-40-generic x86_64
PHPUnit 11.5.55 by Sebastian Bergmann and contributors.

Runtime:       PHP 8.4.23
Configuration: /var/www/catalystupstream501/phpunit.xml

....................................S....                         41 / 41 (100%)

Time: 00:04.875, Memory: 80.50 MB

OK, but there were issues!
Tests: 41, Assertions: 145, PHPUnit Deprecations: 10, Skipped: 1.

and 405

root@31331fa89c70:/var/www/catalystupstream405# vendor/bin/phpunit --testsuite tool_emailutils_testsuite
Moodle 4.5.12+ (Build: 20260714), 13e8d928852cb7dea57b1fad11d5946d244e8899
Php: 8.3.32, pgsql: 17.10 (Debian 17.10-1.pgdg13+1), OS: Linux 6.17.0-40-generic x86_64
PHPUnit 9.6.34 by Sebastian Bergmann and contributors.

S.......................                                          24 / 24 (100%)

Time: 00:01.652, Memory: 74.50 MB

OK, but incomplete, skipped, or risky tests!
Tests: 24, Assertions: 61, Skipped: 1.

@micoreyes
micoreyes merged commit f1261c5 into MOODLE_401_STABLE Jul 17, 2026
40 of 42 checks passed
@micoreyes
micoreyes deleted the MOODLE_401_STABLE-issue140 branch July 17, 2026 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants