Преглед на файлове

Fix error when uploading huge files BT#10567

jmontoya преди 9 години
родител
ревизия
3f2f10af36
променени са 3 файла, в които са добавени 22 реда и са изтрити 14 реда
  1. 12 10
      main/inc/lib/nusoap/class.soap_parser.php
  2. 0 3
      main/inc/lib/nusoap/class.soap_server.php
  3. 10 1
      main/webservices/lp.php

+ 12 - 10
main/inc/lib/nusoap/class.soap_parser.php

@@ -1,8 +1,5 @@
 <?php
 
-
-
-
 /**
 *
 * nusoap_parser class parses SOAP XML messages into native PHP values
@@ -12,8 +9,8 @@
 * @version  $Id: class.soap_parser.php,v 1.42 2010/04/26 20:15:08 snichol Exp $
 * @access   public
 */
-class nusoap_parser extends nusoap_base {
-
+class nusoap_parser extends nusoap_base
+{
 	var $xml = '';
 	var $xml_encoding = '';
 	var $method = '';
@@ -65,7 +62,7 @@ class nusoap_parser extends nusoap_base {
 		$this->decode_utf8 = $decode_utf8;
 
 		// Check whether content has been read.
-		if(!empty($xml)){
+		if(!empty($this->xml)){
 			// Check XML encoding
 			$pos_xml = strpos($xml, '<?xml');
 			if ($pos_xml !== FALSE) {
@@ -102,8 +99,11 @@ class nusoap_parser extends nusoap_base {
 			xml_set_element_handler($this->parser, 'start_element','end_element');
 			xml_set_character_data_handler($this->parser,'character_data');
 
+			xml_parse($this->parser, $this->xml);
+
 			// Parse the XML file.
-			if(!xml_parse($this->parser,$xml,true)){
+			//if (!xml_parse($this->parser,$xml,true)){
+			if (false) {
 			    // Display an error message.
 			    $err = sprintf('XML error parsing SOAP payload on line %d: %s',
 			    xml_get_current_line_number($this->parser),
@@ -152,6 +152,7 @@ class nusoap_parser extends nusoap_base {
 	* @access   private
 	*/
 	function start_element($parser, $name, $attrs) {
+
 		// position in a total number of elements, starting from 0
 		// update class level pos
 		$pos = $this->position++;
@@ -412,9 +413,10 @@ class nusoap_parser extends nusoap_base {
 	* @param    string $data element content
 	* @access   private
 	*/
-	function character_data($parser, $data){
+	function character_data($parser, $data)
+    {
 		$pos = $this->depth_array[$this->depth];
-		if ($this->xml_encoding=='UTF-8'){
+		if ($this->xml_encoding == 'UTF-8'){
 			// TODO: add an option to disable this for folks who want
 			// raw UTF-8 that, e.g., might not map to iso-8859-1
 			// TODO: this can also be handled with xml_parser_set_option($this->parser, XML_OPTION_TARGET_ENCODING, "ISO-8859-1");
@@ -610,7 +612,7 @@ class nusoap_parser extends nusoap_base {
 			}
 			$ret = is_array($params) ? $params : array();
 			$this->debug('in buildVal, return:');
-			$this->appendDebug($this->varDump($ret));
+			//$this->appendDebug($this->varDump($ret));
 			return $ret;
 		} else {
         	$this->debug('in buildVal, no children, building scalar');

+ 0 - 3
main/inc/lib/nusoap/class.soap_server.php

@@ -1123,6 +1123,3 @@ class nusoap_server extends nusoap_base {
  */
 class soap_server extends nusoap_server {
 }
-
-
-?>

+ 10 - 1
main/webservices/lp.php

@@ -7,6 +7,15 @@
 require_once '../inc/global.inc.php';
 $libpath = api_get_path(LIBRARY_PATH);
 
+ini_set('memory_limit', -1);
+/*
+ini_set('upload_max_filesize', '4000M');
+ini_set('post_max_size', '4000M');
+ini_set('max_execution_time', '80000');
+ini_set('max_input_time', '80000');
+*/
+
+
 $debug = true;
 
 define('WS_ERROR_SECRET_KEY', 1);
@@ -36,7 +45,7 @@ function WSHelperVerifyKey($params)
     // if we are behind a reverse proxy, assume it will send the
     // HTTP_X_FORWARDED_FOR header and use this IP instead
     if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
-        list($ip1, $ip2) = split(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
+        list($ip1, $ip2) = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
         $ip = trim($ip1);
     }
     if ($debug)