Project

General

Profile

« Previous | Next » 

Revision c6c398c6

Added by Jim Pingle over 6 years ago

Fix #9121: Initialize arrays to prevent PHP 7 errors

View differences:

src/etc/inc/shaper.inc
308 308
function &get_reference_to_me_in_config(&$mypath) {
309 309
	global $config;
310 310

  
311
	$ptr =& $config['shaper'];
311
	init_config_arr(array('shaper'));
312
	$ptr = &$config['shaper'];
312 313
	foreach ($mypath as $indeks) {
313 314
		if (!is_array($ptr)) {
314 315
			$ptr = array();
......
319 320
		if (!is_array($ptr['queue'][$indeks])) {
320 321
			$ptr['queue'][$indeks] = array();
321 322
		}
322
		$ptr =& $ptr['queue'][$indeks];
323
		$ptr = &$ptr['queue'][$indeks];
323 324
	}
324 325

  
325 326
	return $ptr;
......
328 329
function unset_object_by_reference(&$mypath) {
329 330
	global $config;
330 331

  
331
	$ptr =& $config['shaper'];
332
	init_config_arr(array('shaper'));
333
	$ptr = &$config['shaper'];
332 334
	for ($i = 0; $i < count($mypath) - 1; $i++) {
333
		$ptr =& $ptr['queue'][$mypath[$i]];
335
		$ptr = &$ptr['queue'][$mypath[$i]];
334 336
	}
335 337
	unset($ptr['queue'][$mypath[$i]]);
336 338
}
......
338 340
function &get_dn_reference_to_me_in_config(&$mypath) {
339 341
	global $config;
340 342

  
341
	$ptr =& $config['dnshaper'];
343
	init_config_arr(array('dnshaper'));
344
	$ptr = &$config['dnshaper'];
342 345
	foreach ($mypath as $indeks) {
343
		$ptr =& $ptr['queue'][$indeks];
346
		$ptr = &$ptr['queue'][$indeks];
344 347
	}
345 348

  
346 349
	return $ptr;
......
349 352
function unset_dn_object_by_reference(&$mypath) {
350 353
	global $config;
351 354

  
352
	$ptr =& $config['dnshaper'];
355
	init_config_arr(array('dnshaper'));
356
	$ptr = &$config['dnshaper'];
353 357
	for ($i = 0; $i < count($mypath) - 1; $i++) {
354
		$ptr =& $ptr['queue'][$mypath[$i]];
358
		$ptr = &$ptr['queue'][$mypath[$i]];
355 359
	}
356 360
	unset($ptr['queue'][$mypath[$i]]);
357 361
}
......
522 526
	global $altq_list_queues;
523 527

  
524 528
	$int = $object->GetInterface();
525
	$altq =& $altq_list_queues[$int];
526
	if ($altq) {
529
	if (isset($altq_list_queues[$int])) {
530
		$altq = &$altq_list_queues[$int];
527 531
		$bw_3 = $altq->GetBandwidth();
528 532
		$bw_3 = $bw_3 * get_bandwidthtype_scale($altq->GetBwscale());
529 533
		return floatval($bw_3);
......
5014 5018
	global $altq_list_queues, $config;
5015 5019
	$path = array();
5016 5020

  
5017
	if (!is_array($config['shaper'])) {
5018
		$config['shaper'] = array();
5019
	}
5020
	if (!is_array($config['shaper']['queue'])) {
5021
		$config['shaper']['queue'] = array();
5022
	}
5021
	init_config_arr(array('shaper', 'queue'));
5023 5022
	$a_int = &$config['shaper']['queue'];
5024 5023

  
5025 5024
	$altq_list_queues = array();
......
5055 5054
	global $dummynet_pipe_list, $config;
5056 5055
	$path = array();
5057 5056

  
5058
	if (!is_array($config['dnshaper'])) {
5059
		$config['dnshaper'] = array();
5060
	}
5061
	if (!is_array($config['dnshaper']['queue'])) {
5062
		$config['dnshaper']['queue'] = array();
5063
	}
5057
	init_config_arr(array('dnshaper', 'queue'));
5064 5058
	$a_int = &$config['dnshaper']['queue'];
5065 5059

  
5066 5060
	$dummynet_pipe_list = array();
5067 5061

  
5068
	if (!is_array($config['dnshaper']['queue']) ||
5069
	    !count($config['dnshaper']['queue'])) {
5062
	if (!count($config['dnshaper']['queue'])) {
5070 5063
		return;
5071 5064
	}
5072 5065

  

Also available in: Unified diff