NETLINK Posted February 25, 2016 Report Share Posted February 25, 2016 The following change will prevent an error if, for some reason, Enom is only returning one nameserver, which happened me today. if ($response->status() == "OK") { $data = $response->response(); if ( isset( $data->dns ) && is_array( $data->dns ) ) { foreach ($data->dns as $ns) $vars->ns[] = $ns; } } Blesta Version 3.6.1 Enom (ver 2.2.1) File: components/modules/enom/enom.php Line: 1151 PauloV 1 Link to comment Share on other sites More sharing options...
Tyson Posted February 26, 2016 Report Share Posted February 26, 2016 What's the bug exactly and how does your code change resolve it? What is returned by the module (check the Module Logs for raw Output)? What error do you receive? Link to comment Share on other sites More sharing options...
NETLINK Posted February 26, 2016 Author Report Share Posted February 26, 2016 The expected output returned by the module is a list of nameservers associated with the domain, which is converted into a PHP array: https://reseller.enom.com/interface.asp <?xml version="1.0" encoding="utf-8"?> <interface-response> <dns>ns1.example.com</dns> <dns>ns2.example.com</dns> <UseDNS></UseDNS> However, the actual result I got was just 1 nameserver, which resulted in a fatal PHP error: Invalid argument supplied for foreach() https://reseller.enom.com/interface.asp <?xml version="1.0" encoding="utf-8"?> <interface-response> <dns>ns1.example.com</dns> <UseDNS></UseDNS> I added "&& is_array( $data->dns )", which checks if $data->dns is an array, and prevents a fatal error in this scenario. PauloV 1 Link to comment Share on other sites More sharing options...
NETLINK Posted March 7, 2016 Author Report Share Posted March 7, 2016 To elaborate further, it wasn't the module's fault that only one NS was returned. This was just how the domain was (mis)configured. However, adding this code in the module would prevent fatal errors in Blesta in this situation, as rare as it may be. Link to comment Share on other sites More sharing options...
Tyson Posted April 20, 2016 Report Share Posted April 20, 2016 This is fixed in CORE-2180 for v4.0. NETLINK and Michael 2 Link to comment Share on other sites More sharing options...
Recommended Posts