Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.4.4

Bug #4543 Function _readChunked gives errors when magic_quotes are on
Submitted: 2005-06-07 06:18 UTC Modified: 2005-11-05 14:23 UTC
From: Steven at offstage dot be Assigned: avb
Status: Closed Package: HTTP_Request
PHP Version: 4.3.11 OS: Gentoo Linux - Kernel 2.6.9
Roadmaps: (Not assigned)    
Subscription  


 [2005-06-07 06:18 UTC] Steven at offstage dot be
Description: ------------ Situation: - magic_quotes_gpc/runtime are OFF in php.ini - magic_quotes_runtime is ON in php-script When I get a XML file from a URL with the code below, I get an error (see below) actual error is in pear/HTTP/Request.php function _readChunked: $this->_chunkLength -= strlen($data); With the slashes added, strlen(data) is larger than _chunkLength giving a negative value. Reproduce code: --------------- $Parser = &new HTTP_Request($file); $Parser->sendRequest(); $xml_body = $Parser->getResponseBody(); quickfix for Request.php: (+/- line 1119) --- $data = $this->_sock->read($this->_chunkLength); $this->_chunkLength -= strlen($data); //Added by Steven - 20050607 if ($this->_chunkLength < 0) $this->_chunkLength = 0; if (0 == $this->_chunkLength) { $this->_sock->readLine(); // Trailing CRLF } Expected result: ---------------- Valid XML structure Actual result: -------------- time : 2005-06-07 13:05:23 error type : Warning error msg : fread(): Length parameter must be greater than 0. file : /home/www/powercity/www/inc/pear/Net/Socket.php line num : 274

Comments

 [2005-11-05 14:23 UTC] avb
Fixed in CVS. magic_quotes_runtime is now switched off when sending request / reading the response, since it breaks chunked responses and also POST file uploads.