Support » Plugin: Motor Racing League » Bug fix for your scoring script

  • In motorracingleaguescoring.php line #50, comparison “$key == 0” :

    if ($options->get_predict_pole() && $key == 0 && isset($drivers[0]) && $guess == $drivers[0]['id']) {

    Your use of ‘==’ causes PHP’s type coercion to cast string values of $key to be the integer 0, meaning that conditional can be satisfied with values like “rain” or “safety_car”, leading to extra pole position prediction points being erroneously added.

    Top tip: Always use ‘===’ to guarantee type safe comparisons. 🙂

    • This topic was modified 1 year, 4 months ago by  abulia.
Viewing 1 replies (of 1 total)
  • Plugin Author ianhaycox

    (@ianhaycox)

    Thank you for the feedback and fix.

    Yep – bit of a dumb PHP 101 error 🙂

    I’ll update the plugin with the fix.

    Ian.

Viewing 1 replies (of 1 total)
  • The topic ‘Bug fix for your scoring script’ is closed to new replies.