Make WordPress Core

Opened 6 months ago

Closed 3 months ago

#62735 closed defect (bug) (fixed)

Change documented type of get_network_option, update_network_option and delete_network_option's $network_id parameter to int|null

Reported by: maikelraow's profile maikelraow Owned by: audrasjb's profile audrasjb
Milestone: 6.8 Priority: normal
Severity: minor Version:
Component: Options, Meta APIs Keywords: has-patch
Focuses: docs Cc:

Description

get_network_option, update_network_option and delete_network_option all have a $network_id as first parameter.

@param int $network_id ID of the network. Can be null to default to the current network ID.

It's @param type is set to INT yet it also explicitly says that NULL can be passed to use the current network ID. If passing NULL is valid then should the type not be INT|NULL?

Change History (5)

This ticket was mentioned in PR #8038 on WordPress/wordpress-develop by @im3dabasia1.


6 months ago
#1

  • Keywords has-patch added

This PR updates the documented type of the $network_id parameter in get_network_option, update_network_option, and delete_network_option methods to int|null, reflecting that NULL can be passed to default to the current network ID.

@im3dabasia1 commented on PR #8038:


6 months ago
#2

I also confirmed that int|null has been used in other functions, such as get_blog_count, which internally calls get_network_option: https://github.com/WordPress/wordpress-develop/blob/dc9b16ba4224259bd3ae2153f81686ed902391f2/src/wp-includes/ms-functions.php#L103-L117

#3 @audrasjb
6 months ago

  • Focuses php-compatibility removed
  • Milestone changed from Awaiting Review to 6.8
  • Owner set to audrasjb
  • Status changed from new to reviewing
  • Type changed from enhancement to defect (bug)
  • Version trunk deleted

Hello and welcome to WordPress Core Trac @maikelraow,

Thanks for reporting this. Moving to milestone 6.8.

@audrasjb commented on PR #8038:


3 months ago
#4

I approved this PR but I also spotted some other places that I'll fix directly when committing this changeset :)

#5 @audrasjb
3 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 59940:

Docs: Update $network_id parameter type to int|null in Network Option methods.

Props maikelraow, im3dabasia1, audrasjb, mukesh27.
Fixes #62735.
See #62281.

Note: See TracTickets for help on using tickets.