|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2007-05-15 03:09 UTC] hscdaunte at hotmail dot com
Description:
------------
When using the eplode function on top of array that has memory pointers pointing at it will not work. The new array generated by explode overwrites current memory location rather then assiging the new values to the current memory. Suffucient example is provided example output with 'XXXXX' were just removed for identity purposes.
Reproduce code:
---------------
//data assignments!!!
$outgoing = array(
"primtransactionid" => &$incoming[0],
"origtransactionid" => &$incoming[1],
"prnttransactionid" => &$incoming[2],
"datecreated" => &$incoming[3],
"productid" => &$incoming[4],
"amount" => &$incoming[5],
"firstname" => &$incoming[6],
"lastname" => &$incoming[7],
"address1" => &$incoming[8],
"address2" => &$incoming[9],
"city" => &$incoming[10],
"state" => &$incoming[11],
"zip" => &$incoming[12],
"country" => &$incoming[13],
"phonenumber" => &$incoming[14],
"email" => &$incoming[15],
"ipaddress" => &$incoming[16],
"ssn" => &$incoming[17],
"dob" => &$incoming[18],
"maiden" => &$incoming[19],
"field1" => &$incoming[20],
"field2" => &$incoming[21],
"stampprocess" => &$incoming[22],
"status" => &$incoming[23],
"completion" => &$incoming[24],
"exception" => &$incoming[25],
"exceptiondate" => &$incoming[26],
);
//ebonus default settings per offer
//section removed
this area made a curl to a secure site to retrieve transactions
each transaction is divided by a '\r\n' then each sub data is
divided by a ';' like so the actual list is above
Example:
111123;111123;john;doe;2007-04-03;C\r\n
//end removed
// get the data from the curl
$post = new Post($_EPOST['efs01'], array());
//get the data retrieved from the curl and explode each transaction by '\r\n'
$transactions = explode("\r\n", $post->result);
//run each transaction
foreach ($transactions as $id => $transaction) {
//assign incoming the exploded data which should be pointed to with the outgoing pointers... incoming[0], incoming[1] etc...
$incoming = explode(";", $transaction);
//outgoing should display incomings data with the assoc array names created above...
print_r($incoming);
print_r($outgoing);
die();
}
Expected result:
----------------
This was the work around to make this work:
foreach ($transactions as $id => $transaction) {
$temp = explode(";", $transaction);
foreach($temp as $id => $value)
$incoming[$id] = $value;
print_r($incoming);
print_r($outgoing);
die();
}
Array
(
[0] => 134661267834
[1] => 134661267834
[2] =>
[3] => 2007-03-20 00:00:35
[4] => 891231
[5] => 124.90
[6] => XXXXX
[7] => rillon
[8] => 41-956 XXXXX hwy
[9] =>
[10] => waimanalo
[11] => XX
[12] => 96795
[13] => USA
[14] => XXXXXX5963
[15] => chelsey96795@XXXXX.com
[16] => 66.8.180.61
[17] => .
[18] =>
[19] =>
[20] =>
[21] =>
[22] => 2007-03-20 13:51:10
[23] => C
[24] => 2007-04-05
[25] =>
[26] => 0000-00-00
)
Array
(
[primtransactionid] => 134661267834
[origtransactionid] => 134661267834
[prnttransactionid] =>
[datecreated] => 2007-03-20 00:00:35
[productid] => 891231
[amount] => 124.90
[firstname] => XXXXX
[lastname] => rillon
[address1] => 41-956 XXXXX hwy
[address2] =>
[city] => waimanalo
[state] => XX
[zip] => 96795
[country] => USA
[phonenumber] => XXXXXX5963
[email] => chelsey96795@removed.com
[ipaddress] => 66.8.180.61
[ssn] => .
[dob] =>
[maiden] =>
[field1] =>
[field2] =>
[stampprocess] => 2007-03-20 13:51:10
[status] => C
[completion] => 2007-04-05
[exception] =>
[exceptiondate] => 0000-00-00
)
Actual result:
--------------
Array
(
[0] => 134661267834
[1] => 134661267834
[2] =>
[3] => 2007-03-20 00:00:35
[4] => 891231
[5] => 124.90
[6] => XXXXX
[7] => rillon
[8] => 41-956 XXXXX hwy
[9] =>
[10] => waimanalo
[11] => XX
[12] => 96795
[13] => USA
[14] => XXXXXX5963
[15] => chelsey96795@XXXXX.com
[16] => 66.8.180.61
[17] => .
[18] =>
[19] =>
[20] =>
[21] =>
[22] => 2007-03-20 13:51:10
[23] => C
[24] => 2007-04-05
[25] =>
[26] => 0000-00-00
)
Array
(
[primtransactionid] =>
[origtransactionid] =>
[prnttransactionid] =>
[datecreated] =>
[productid] =>
[amount] =>
[firstname] =>
[lastname] =>
[address1] =>
[address2] =>
[city] =>
[state] =>
[zip] =>
[country] =>
[phonenumber] =>
[email] =>
[ipaddress] =>
[ssn] =>
[dob] =>
[maiden] =>
[field1] =>
[field2] =>
[stampprocess] =>
[status] =>
[completion] =>
[exception] =>
[exceptiondate] =>
)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 01:00:01 2025 UTC |
<? //data assignments!!! $outgoing = array( "primtransactionid" => &$incoming[0], "origtransactionid" => &$incoming[1], "prnttransactionid" => &$incoming[2], "datecreated" => &$incoming[3], "productid" => &$incoming[4], "amount" => &$incoming[5], "firstname" => &$incoming[6], "lastname" => &$incoming[7], "address1" => &$incoming[8], "address2" => &$incoming[9], "city" => &$incoming[10], "state" => &$incoming[11], "zip" => &$incoming[12], "country" => &$incoming[13], "phonenumber" => &$incoming[14], "email" => &$incoming[15], "ipaddress" => &$incoming[16], "ssn" => &$incoming[17], "dob" => &$incoming[18], "maiden" => &$incoming[19], "field1" => &$incoming[20], "field2" => &$incoming[21], "stampprocess" => &$incoming[22], "status" => &$incoming[23], "completion" => &$incoming[24], "exception" => &$incoming[25], "exceptiondate" => &$incoming[26], ); //this area made a curl to a secure site to retrieve transactions //each transaction is divided by a '\r\n' then each sub data is //divided by a ';' like so the actual list is above // get the data from the curl however to replicate we are just going to provide the data this is one example row below $data = "134661267834;134661267834;;2007-03-20 00:00:35;891231;124.90;XXXXX;rillon;41-956 XXXXX hwy;;waimanalo;XX;96795;USA;XXXXXX5963;chelsey96795@XXXXX.com;66.8.180.61;.;;;;;;2007-03-20 13:51:10;C;2007-04-05;0000-00-00\r\n"; //get the data retrieved from the curl and explode each transaction by '\r\n' $transactions = explode("\r\n", $data); //run each transaction foreach ($transactions as $id => $transaction) { //assign incoming the exploded data which should be pointed to with the outgoing pointers allready created... incoming[0], incoming[1] etc... $incoming = explode(";", $transaction); //outgoing should display incomings data with the assoc array names created above... print_r($incoming); print_r($outgoing); die(); } ?>