Fixed A non well formed numeric value encountered - Image Proxy Related

Brent W

Well-known member
#1
PHP 7.1 is used on this server. Running 1.5.11

Code:
Server Error Log
Error Info
ErrorException: A non well formed numeric value encountered - library/Zend/Http/Client/Adapter/Socket.php:432
Generated By: Unknown Account, 7 minutes ago
Stack Trace

#0 /home/nginx/domains/christianforums.com/public/library/Zend/Http/Client/Adapter/Socket.php(432): XenForo_Application::handlePhpError(8, 'A non well form...', '/home/nginx/dom...', 432, Array)
#1 /home/nginx/domains/christianforums.com/public/library/Zend/Http/Client.php(989): Zend_Http_Client_Adapter_Socket->read()
#2 /home/nginx/domains/christianforums.com/public/library/XenForo/Helper/Http.php(265): Zend_Http_Client->request('GET')
#3 /home/nginx/domains/christianforums.com/public/library/XenForo/Model/ImageProxy.php(453): XenForo_Helper_Http::getUntrustedWithRedirects('https://g.chris...', Array, Array, '/home/nginx/dom...')
#4 /home/nginx/domains/christianforums.com/public/library/XenForo/Model/ImageProxy.php(334): XenForo_Model_ImageProxy->_fetchImageForProxy('https://g.chris...')
#5 /home/nginx/domains/christianforums.com/public/library/XenForo/Model/ImageProxy.php(33): XenForo_Model_ImageProxy->_fetchAndCacheImage('https://g.chris...')
#6 /home/nginx/domains/christianforums.com/public/library/XenForo/ProxyOutput.php(220): XenForo_Model_ImageProxy->getImage('https://g.chris...')
#7 /home/nginx/domains/christianforums.com/public/library/XenForo/ProxyOutput.php(155): XenForo_ProxyOutput->_outputImage(false)
#8 /home/nginx/domains/christianforums.com/public/library/XenForo/ProxyOutput.php(388): XenForo_ProxyOutput->output()
#9 /home/nginx/domains/christianforums.com/public/proxy.php(12): XenForo_ProxyOutput::run()
#10 {main}

Request State

array(3) {
  ["url"] => string(160) "http://www.christianforums.com/proxy.php?image=https%3A%2F%2Fg.christianbook.com%2Fdg%2Fproduct%2Fcbd%2Ff400%2F4053137.jpg&hash=68660e5fd07dec53039d5fb2f8eac44c"
  ["_GET"] => array(2) {
    ["image"] => string(59) "https://g.christianbook.com/dg/product/cbd/f400/4053137.jpg"
    ["hash"] => string(32) "68660e5fd07dec53039d5fb2f8eac44c"
  }
  ["_POST"] => array(0) {
  }
}
 

Mike

XenForo developer
Staff member
#2
If you put the image reference into the image proxy tester, can you reproduce the error?
Code:
https://g.christianbook.com/dg/product/cbd/f400/4053137.jpg
 

Brent W

Well-known member
#3
It says it was fetched successfully but still produces the error:

Selection_032.png


Code:
Server Error Log
Error Info
ErrorException: A non well formed numeric value encountered - library/Zend/Http/Client/Adapter/Socket.php:432
Generated By: Brent W, A moment ago
Stack Trace

#0 /home/nginx/domains/christianforums.com/public/library/Zend/Http/Client/Adapter/Socket.php(432): XenForo_Application::handlePhpError(8, 'A non well form...', '/home/nginx/dom...', 432, Array)
#1 /home/nginx/domains/christianforums.com/public/library/Zend/Http/Client.php(989): Zend_Http_Client_Adapter_Socket->read()
#2 /home/nginx/domains/christianforums.com/public/library/XenForo/Helper/Http.php(265): Zend_Http_Client->request('GET')
#3 /home/nginx/domains/christianforums.com/public/library/XenForo/Model/ImageProxy.php(453): XenForo_Helper_Http::getUntrustedWithRedirects('https://g.chris...', Array, Array, '/home/nginx/dom...')
#4 /home/nginx/domains/christianforums.com/public/library/XenForo/Model/ImageProxy.php(406): XenForo_Model_ImageProxy->_fetchImageForProxy('https://g.chris...')
#5 /home/nginx/domains/christianforums.com/public/library/XenForo/ControllerAdmin/Tools.php(343): XenForo_Model_ImageProxy->testImageProxyFetch('https://g.chris...')
#6 /home/nginx/domains/christianforums.com/public/library/XenForo/FrontController.php(351): XenForo_ControllerAdmin_Tools->actionTestImageProxy()
#7 /home/nginx/domains/christianforums.com/public/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#8 /home/nginx/domains/christianforums.com/public/admin.php(13): XenForo_FrontController->run()
#9 {main}

Request State

array(3) {
  ["url"] => string(63) "http://www.christianforums.com/admin.php?tools/test-image-proxy"
  ["_GET"] => array(1) {
    ["tools/test-image-proxy"] => string(0) ""
  }
  ["_POST"] => array(3) {
    ["url"] => string(59) "https://g.christianbook.com/dg/product/cbd/f400/4053137.jpg"
    ["_xfConfirm"] => string(1) "1"
    ["_xfToken"] => string(8) "********"
  }
}
 

Mike

XenForo developer
Staff member
#4
I have a workaround for the issue, but it's due to a bizarre response from that server. It's giving a Content-Length header with the proper number followed by 5 spaces. Those spaces should be ignored, I'm just not sure what would lead to that output.

Fix: In library/Zend/Http/Client/Adapter/Socket.php, find:
Code:
$chunk = '';
After it, add:
Code:
$contentLength = intval($contentLength);
 
Top