Project

General

Profile

« Previous | Next » 

Revision 9f6d92a2

Added by Phil Davis over 9 years ago

status_dhcp6_leases incorrect comparison operator

rather than assignment.
Also $dhcpv6leaseinlocaltime was also being re-used as the value part of the foreach - that looks not so good also.
Even so, I think the old code would have worked by good luck - in the end $dhcpv6leaseinlocaltime is only compared to "yes" anyway, so if it ended up as unset, or some part of a sub-array of $config['dhcpdv6'] or... it still functioned like "no".
I found this by a quick scan through the output of:
find /usr -type f -exec grep -H "^[^(]*==" {} \;
That returns a lot of other stuff, but the bad uses of "==" stand out.

View differences:

src/usr/local/www/status_dhcpv6_leases.php
119 119
function adjust_gmt($dt) {
120 120
	global $config;
121 121

  
122
	$dhcpv6leaseinlocaltime == "no";
122
	$dhcpv6leaseinlocaltime = "no";
123 123
	if (is_array($config['dhcpdv6'])) {
124 124
		$dhcpdv6 = $config['dhcpdv6'];
125
		foreach ($dhcpdv6 as $dhcpv6leaseinlocaltime) {
126
			$dhcpv6leaseinlocaltime = $dhcpv6leaseinlocaltime['dhcpv6leaseinlocaltime'];
125
		foreach ($dhcpdv6 as $dhcpdv6params) {
126
			$dhcpv6leaseinlocaltime = $dhcpdv6params['dhcpv6leaseinlocaltime'];
127 127
			if ($dhcpv6leaseinlocaltime == "yes") {
128 128
				break;
129 129
			}

Also available in: Unified diff