Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-70917

Review and fix incorrect strpos() @admin/tool/behat/cli/run.php

XMLWordPrintable

    • MOODLE_310_STABLE
    • MOODLE_310_STABLE, MOODLE_39_STABLE
    • Hide
      1. Init Behat parallel run, e.g.:

        $ php admin/tool/behat/cli/init.php  --parallel=2
        

      2. Try to use invalid profile:

        $ php admin/tool/behat/cli/run.php --profile=doesntexist
        

      3. Pass empty 'replace' param:

        $ php admin/tool/behat/cli/run.php --profile=doesntexist --replace
        

      4. Pass non-matching 'replace' param:

        $ php admin/tool/behat/cli/run.php --profile=doesntexist --replace=foo
        

      5. Confirm that for each of steps 2-4 you see the message "Invalid profile passed: doesntexist" and do not see a PHP warning about strpos non-string needles
      6. Pass matching 'replace' param:

        $ php admin/tool/behat/cli/run.php --profile=doesntexist --replace=exist
        

      7. Confirm Behat starts run (it will fail later because 'doesnt1' and 'doesnt2' profiles don't exist either):

        Running 2 parallel behat sites:
        [behatrun1] vendor/bin/behat --config /var/www/behatdata/behatrun1/behat/behat.yml --profile="doesnt1"
        [behatrun2] vendor/bin/behat --config /var/www/behatdata/behatrun2/behat/behat.yml --profile="doesnt2"
        

       

      Show
      Init Behat parallel run, e.g.: $ php admin/tool/behat/cli/init.php --parallel=2 Try to use invalid profile: $ php admin/tool/behat/cli/run.php --profile=doesntexist Pass empty 'replace' param: $ php admin/tool/behat/cli/run.php --profile=doesntexist --replace Pass non-matching 'replace' param: $ php admin/tool/behat/cli/run.php --profile=doesntexist --replace=foo Confirm that for each of steps 2-4 you see the message " Invalid profile passed: doesntexist " and do not see a PHP warning about strpos non-string needles Pass matching 'replace' param: $ php admin/tool/behat/cli/run.php --profile=doesntexist --replace=exist Confirm Behat starts run (it will fail later because 'doesnt1' and 'doesnt2' profiles don't exist either): Running 2 parallel behat sites: [behatrun1] vendor/bin/behat --config /var/www/behatdata/behatrun1/behat/behat.yml --profile="doesnt1" [behatrun2] vendor/bin/behat --config /var/www/behatdata/behatrun2/behat/behat.yml --profile="doesnt2"  

      Line 149 of admin/tool/behat/cli/run.php throws a warning with php74

      149 : strpos($options['profile'], $options['replace']) >= 0

      PHP Deprecated: strpos(): Non-string needles will be interpreted as strings in the future. Use an explicit chr() call to preserve the current behavior in admin/tool/behat/cli/run.php on line 149

            pholden Paul Holden
            rdebleu Renaat Debleu
            Tim Hunt Tim Hunt
            Sara Arjona (@sarjona) Sara Arjona (@sarjona)
            Anna Carissa Sadia Anna Carissa Sadia
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0 minutes
                0m
                Logged:
                Time Spent - 2 hours, 20 minutes
                2h 20m

                  Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.