Project

General

Profile

Actions

Bug #14036

closed

PHP error when the ``timeserver`` section of the configuration is empty

Added by Christopher Cope over 1 year ago. Updated over 1 year ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
NTPD
Target version:
Start date:
Due date:
% Done:

100%

Estimated time:
Plus Target Version:
23.05
Release Notes:
Default
Affected Version:
2.7.0
Affected Architecture:

Description

The following error is thrown when there is an empty or missing "timeserver" entry in the config.

The code should check for the above situation(s).

[25-Feb-2023 16:46:09 Etc/UTC] PHP Fatal error:  Uncaught ValueError: substr_count(): Argument #2 ($needle) cannot be empty in /etc/inc/system.inc:2023
Stack trace:
#0 /etc/inc/system.inc(2023): substr_count('', '')
#1 /etc/rc.bootup(356): system_ntp_configure()
#2 {main}
  thrown in /etc/inc/system.inc on line 2023

Actions #1

Updated by Jim Pingle over 1 year ago

  • Target version set to 2.7.0
  • Plus Target Version set to 23.05
Actions #2

Updated by Jim Pingle over 1 year ago

  • Assignee set to Jim Pingle
Actions #3

Updated by Jim Pingle over 1 year ago

I don't see how anyone would get it into this state without manual config editing. Neither system.php nor the NTP config page allow you to save an empty list.

That said, if I clear out the list in my config (<timeservers></timeservers>) then I can reproduce the error.

Actions #4

Updated by Jim Pingle over 1 year ago

  • Status changed from New to Feedback
  • % Done changed from 0 to 100
Actions #5

Updated by Danilo Zrenjanin over 1 year ago

  • Status changed from Feedback to Resolved

I could replicate the issue on the:

23.01-RELEASE (amd64)
built on Fri Feb 10 20:06:33 UTC 2023
FreeBSD 14.0-CURRENT

The patch fixes it successfully. I am marking this ticket resolved.

Actions #6

Updated by Jim Pingle over 1 year ago

  • Subject changed from PHP error when missing timeserver in config to PHP error when the ``timeserver`` section of the configuration is empty

Updating subject for release notes.

Actions #7

Updated by Jim Pingle over 1 year ago

  • Affected Version set to 2.7.0
Actions

Also available in: Atom PDF