Bug #71986 [Opn->Csd]: Nested foreach assign-by-reference creates broken variables
| From: | laruence@php.net | Date: | Fri, 08 Apr 2016 09:58:18 +0000 |
| Subject: | Bug #71986 [Opn->Csd]: Nested foreach assign-by-reference creates broken variables | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-200433@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=71986&edit=1
ID: 71986
Updated by: laruence@php.net
Reported by: joshdifabio at gmail dot com
Summary: Nested foreach assign-by-reference creates broken
variables
-Status: Open
+Status: Closed
Type: Bug
Package: SOAP related
Operating System: All
PHP Version: 7.0.5
Block user comment: N
Private report: N
New Comment:
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=c45f7b97a3252767b31d38fd7e761b9291ed2152
Log: Fixed bug #71986 (Nested foreach assign-by-reference creates broken variables)
Previous Comments:
------------------------------------------------------------------------
[2016-04-08 09:06:46] joshdifabio at gmail dot com
Description:
------------
Nested foreach loops using assign-by-reference produce variables which, when passed to SoapClient,
cause errors. We discovered this bug when passing data returned by the official AWS DynamoDB client
to SoapClient, but reproduce it below with a few lines of PHP.
https://github.com/aws/aws-sdk-php/blob/3.17.5/src/DynamoDb/Marshaler.php#L285
Test script:
---------------
<?php
$client = new SoapClient(null, ['uri' => '', 'location' =>
'']);
$data = [[null]];
foreach ($data as &$value) {
foreach ($value as &$_value) {
$_value = 'foo';
}
}
$client->__soapCall('call', $data);
Expected result:
----------------
PHP Fatal error: Uncaught SoapFault exception: [HTTP] Unable to parse URL
(Because SoapClient attempts to retrieve the WSDL from the invalid URL provided in the test code.
This error is seen in PHP5.)
Actual result:
--------------
Fatal error: Uncaught SoapFault exception: [Client] SOAP-ERROR: Encoding: Cannot find encoding
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=71986&edit=1