Git Product home page Git Product logo

Comments (9)

dg avatar dg commented on May 27, 2024

Please write snippet of code to reproduce bug.

from http.

carstomas avatar carstomas commented on May 27, 2024

Nette\Http\RequestFactory

BUG
start line 148

foreach ($list as &$v) {
			if (!isset($v['name'])) {
				continue;

			} elseif (!is_array($v['name'])) {
				if (!$this->binary && (!preg_match($reChars, $v['name']) || preg_last_error())) {
					$v['name'] = '';
				}
				if ($v['error'] !== UPLOAD_ERR_NO_FILE) {
					$v['@'] = new FileUpload($v);
				}
				continue;
			}

			foreach ($v['name'] as $k => $foo) {
				if (!$this->binary && is_string($k) && (!preg_match($reChars, $k) || preg_last_error())) {
					continue;
				}
				$list[] = [
					'name' => $v['name'][$k],
					'type' => $v['type'][$k],
					'size' => $v['size'][$k],
					'tmp_name' => $v['tmp_name'][$k],
					'error' => $v['error'][$k],
					'@' => &$v['@'][$k],
				];
			}
		}


NO BUG

while (list(, $v) = each($list)) {
			if (!isset($v['name'])) {
				continue;

			} elseif (!is_array($v['name'])) {
				if (!$this->binary && (!preg_match($reChars, $v['name']) || preg_last_error())) {
					$v['name'] = '';
				}
				if ($v['error'] !== UPLOAD_ERR_NO_FILE) {
					$v['@'] = new FileUpload($v);
				}
				continue;
			}

			foreach ($v['name'] as $k => $foo) {
				if (!$this->binary && is_string($k) && (!preg_match($reChars, $k) || preg_last_error())) {
					continue;
				}
				$list[] = [
					'name' => $v['name'][$k],
					'type' => $v['type'][$k],
					'size' => $v['size'][$k],
					'tmp_name' => $v['tmp_name'][$k],
					'error' => $v['error'][$k],
					'@' => &$v['@'][$k],
				];
			}
		}

Is it correctly written?

from http.

dg avatar dg commented on May 27, 2024

I don't understand. What is wrong? It produces invalid (or different) output? For which input (ie. $_FILES)?

from http.

carstomas avatar carstomas commented on May 27, 2024

I'm sorry, but I don't know exactly how to describe it properly.
When I upload file by input file multiple and after submitted using dump, output is:
files => array (1)
| 0 => NULL
but I changing the line 148 to

while (list(, $v) = each($list))

output is:
files => array (1)
| 0 => Nette\Http\FileUpload

Is it clear?

from http.

dg avatar dg commented on May 27, 2024

dump global variable $_FILES

from http.

carstomas avatar carstomas commented on May 27, 2024

array (1)
files => array (5)
| name => array (1)
| | 0 => "1a.jpg" (6)
| type => array (1)
| | 0 => "image/jpeg" (10)
| tmp_name => array (1)
| | 0 => "D:\Program Files\xampp\tmp\phpCB54.tmp" (38)
| error => array (1)
| | 0 => 0
| size => array (1)
| | 0 => 10979

from http.

dg avatar dg commented on May 27, 2024

can you dump it as var_export($_FILES)?

from http.

carstomas avatar carstomas commented on May 27, 2024

array ( 'files' => array ( 'name' => array ( 0 => '1a.jpg', ), 'type' => array ( 0 => 'image/jpeg', ), 'tmp_name' => array ( 0 => 'D:\Program Files\xampp\tmp\php116.tmp', ), 'error' => array ( 0 => 0, ), 'size' => array ( 0 => 10979, ), ), )

from http.

dg avatar dg commented on May 27, 2024

It seems like bug in PHP 5, fixed

from http.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.