Bug #71986 [NEW]: Nested foreach assign-by-reference creates broken variables
| From: | joshdifabio at gmail dot com | Date: | Fri, 08 Apr 2016 09:06:53 +0000 |
| Subject: | Bug #71986 [NEW]: Nested foreach assign-by-reference creates broken variables | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-200432@lists.php.net to get a copy of this message | ||
From: joshdifabio at gmail dot com
Operating system: All
PHP version: 7.0.5
Package: SOAP related
Bug Type: Bug
Bug description:Nested foreach assign-by-reference creates broken variables
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 bug report at https://bugs.php.net/bug.php?id=71986&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=71986&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=71986&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=71986&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=71986&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=71986&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=71986&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=71986&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=71986&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=71986&r=support
Expected behavior: https://bugs.php.net/fix.php?id=71986&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=71986&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=71986&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=71986&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=71986&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=71986&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=71986&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=71986&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=71986&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=71986&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=71986&r=mysqlcfg