Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!ecngs!feeder2.ecngs.de!46.4.82.166.MISMATCH!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail From: "Christoph M. Becker" Newsgroups: comp.lang.php Subject: Re: strange result while passing a variable as referenz Date: Fri, 08 Aug 2014 22:21:16 +0200 Organization: solani.org Lines: 21 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: solani.org 1407529268 28542 eJwNwQERACAIBLBKIP+AccDD/hF0o7n6CTgdvH/2YBUNNmvdHETbqcmSUEBauPXgG9J3PxH6EGs= (8 Aug 2014 20:21:08 GMT) X-Complaints-To: abuse@news.solani.org NNTP-Posting-Date: Fri, 8 Aug 2014 20:21:08 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-User-ID: eJwFwQcBADAIAzBLvHLswMC/hCVQZ58whxsOJ3gH3YXqRkpRjTeLZbyXDdFqy6KbXDgVfw9BEF0= In-Reply-To: Cancel-Lock: sha1:nj3Fc+EBjZkjUwB4sL8DOZGcOGo= X-NNTP-Posting-Host: eJwNycEBwCAIA8CVQJIUxylF9h/B3vcYcn0PRIHDAXxqXtsJnl4BSx5b1bvjX5dYYMcSadZ5ARBBED4= Xref: csiph.com comp.lang.php:14165 Lars Uhlmann wrote: > PHP 5.3.3-7+squeeze21 with Suhosin-Patch (cli) Really cli? I'm asking because of the usage of $_SESSION. > I like to modify $_SESSION within a function, therefore I pass it as > reference. All my "tag"s are added to $_SESSION['data'] as expected but > they are empty and not 'mooh'. The script works fine under PHP 5.4.19 (*cli*) on Win7. There *might* be a bug in your PHP version. > Sure I can use $_SESSION in my function directly but that's IMHO no good > style ACK. However, why don't you simply return the new array and assign it to or merge it with $_SESSION['data']? IMHO that's even better style. -- Christoph M. Becker