Project

General

Profile

Actions

Bug #14036

closed
CC JP

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

Bug #14036: PHP error when the ``timeserver`` section of the configuration is empty

Added by Christopher Cope over 3 years ago. Updated over 3 years 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

JP Updated by Jim Pingle over 3 years ago Actions #1

  • Target version set to 2.7.0
  • Plus Target Version set to 23.05

JP Updated by Jim Pingle over 3 years ago Actions #2

  • Assignee set to Jim Pingle

JP Updated by Jim Pingle over 3 years ago Actions #3

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.

JP Updated by Jim Pingle over 3 years ago Actions #4

  • Status changed from New to Feedback
  • % Done changed from 0 to 100

Applied in changeset commit:6ffd8bbcbb3e4d4b84a0036ff879a9837c4f0d45.

DZ Updated by Danilo Zrenjanin over 3 years ago Actions #5

  • 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.

JP Updated by Jim Pingle over 3 years ago Actions #6

  • 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.

JP Updated by Jim Pingle over 3 years ago Actions #7

  • Affected Version set to 2.7.0
Actions

Also available in: Atom