michaeluno / Task-Scheduler

Provides a task management system for WordPress
Other
14 stars 7 forks source link

Bug report on TaskScheduler_Occurrent_Daily.php line 69 #16

Closed quynhcvn closed 2 years ago

quynhcvn commented 2 years ago

Error on "task-scheduler\include\class\module\occurrence\daily\TaskScheduler_Occurrent_Daily.php", line 69 when we set a daily schedule to run the PHP script.

Error message: "Fatal error: Uncaught TypeError: round(): Argument #1 ($num) must be of type int|float, string given in:...task-scheduler\include\class\module\occurrence\daily\TaskScheduler_Occurrent_Daily.php:69 Stack...".

I tried to change the below code on line 69 of this PHP file, then the error disappear: From: $_iLastRunTime = round( $nLastRunTime ); To: $_iLastRunTime = $nLastRunTime;

michaeluno commented 2 years ago

Hi,

Can you provide the steps to reproduce it?

By the way, I'd suggest the following change

$_iLastRunTime = round( $nLastRunTime );

to

$_iLastRunTime = round( ( integer ) $nLastRunTime );

Also, please provide PHP and WordPress versions. Thank you.

quynhcvn commented 2 years ago

Hi,

This bug happened when I Added a new Task:

  1. In [Occurrence], I selected "Daily - Triggers actions daily at the specified time." ⇒ No issue
  2. Then selected Time and Days ⇒ No issue
  3. On "Select Action", I selected "Run PHP script" ⇒ No issue
  4. Select PHP Script Path, then Error message happened.

Here is some capture for your reference: [cid:794eaf47-a5b0-4b70-97a5-2c0e5e66073a] [cid:eea31ff4-54f2-4be6-96cb-be7fb5c745f7]

WordPress version: 5.9.1 PHP version: 8.0.9

Thanks, Frank.


From: Michael Uno @.> Sent: Thursday, February 24, 2022 3:10 PM To: michaeluno/Task-Scheduler @.> Cc: quynhcvn @.>; Author @.> Subject: Re: [michaeluno/Task-Scheduler] Bug report on TaskScheduler_Occurrent_Daily.php line 69 (Issue #16)

Hi,

Can you provide the steps to reproduce it?

By the way, I'd suggest the following change

$_iLastRunTime = round( $nLastRunTime );

to

$_iLastRunTime = round( ( integer ) $nLastRunTime );

Also, please provide PHP and WordPress versions. Thank you.

— Reply to this email directly, view it on GitHubhttps://github.com/michaeluno/Task-Scheduler/issues/16#issuecomment-1049594881, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVKAATPBR4GBZ3KUERMTHSDU4XRW5ANCNFSM5PGTKMAQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

quynhcvn commented 2 years ago

Hi,

I tried with your suggestion, and it works:

$_iLastRunTime = round( ( integer ) $nLastRunTime );

Thanks. Frank.


From: Nguyễn Văn Quỳnh @.> Sent: Thursday, February 24, 2022 3:38 PM To: michaeluno/Task-Scheduler @.>; michaeluno/Task-Scheduler @.> Cc: Author @.> Subject: Re: [michaeluno/Task-Scheduler] Bug report on TaskScheduler_Occurrent_Daily.php line 69 (Issue #16)

Hi,

This bug happened when I Added a new Task:

  1. In [Occurrence], I selected "Daily - Triggers actions daily at the specified time." ⇒ No issue
  2. Then selected Time and Days ⇒ No issue
  3. On "Select Action", I selected "Run PHP script" ⇒ No issue
  4. Select PHP Script Path, then Error message happened.

Here is some capture for your reference: [cid:794eaf47-a5b0-4b70-97a5-2c0e5e66073a] [cid:eea31ff4-54f2-4be6-96cb-be7fb5c745f7]

WordPress version: 5.9.1 PHP version: 8.0.9

Thanks, Frank.


From: Michael Uno @.> Sent: Thursday, February 24, 2022 3:10 PM To: michaeluno/Task-Scheduler @.> Cc: quynhcvn @.>; Author @.> Subject: Re: [michaeluno/Task-Scheduler] Bug report on TaskScheduler_Occurrent_Daily.php line 69 (Issue #16)

Hi,

Can you provide the steps to reproduce it?

By the way, I'd suggest the following change

$_iLastRunTime = round( $nLastRunTime );

to

$_iLastRunTime = round( ( integer ) $nLastRunTime );

Also, please provide PHP and WordPress versions. Thank you.

— Reply to this email directly, view it on GitHubhttps://github.com/michaeluno/Task-Scheduler/issues/16#issuecomment-1049594881, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AVKAATPBR4GBZ3KUERMTHSDU4XRW5ANCNFSM5PGTKMAQ. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.Message ID: @.***>

michaeluno commented 2 years ago

I could confirm this. Thank you for the report.