php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71986 Nested foreach assign-by-reference creates broken variables
Submitted: 2016-04-08 09:06 UTC Modified: -
From: joshdifabio at gmail dot com Assigned:
Status: Closed Package: SOAP related
PHP Version: 7.0.5 OS: All
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: joshdifabio at gmail dot com
New email:
PHP Version: OS:

 

 [2016-04-08 09:06 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-08 09:58 UTC] laruence@php.net
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)
 [2016-04-08 09:58 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2016-04-08 09:58 UTC] laruence@php.net
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)
 [2016-07-20 11:32 UTC] davey@php.net
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)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 13:01:29 2024 UTC