Re: [PHP] questions about $_SERVER

2012-03-13 Thread Donovan Brooke
Stuart Dallas wrote: [snip] so $GLOBALS['GLOBALS']['GLOBALS']['GLOBALS']['_SERVER'] is a perfectly valid, if daft, way of accessing $_SERVER. -Stuart Now this is becoming educational! ;-) Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http:/

[PHP] set_error_handler() only triggering every Nth time

2012-03-13 Thread Daevid Vincent
I am implementing a custom error handler and started noticing some bizarre behavior. Every Nth time I refresh the page, I see the error/output. In my 'includes/common.inc.php' the key things are these: set_error_handler('php_error_handler'); function php_error_handler($errno, $er

Re: [PHP] Randomly unable to read set variable from class

2012-03-13 Thread Camilo Sperberg
Sorry wasn't able to reproduce it on my test machine. Do you have any external modules loaded such as APC, memcached, xDebug maybe or other that can affect the output on that machine? Greetings On 13 Mar 2012, at 17:02, Adrian Basalic wrote: > I have an issue that occurs randomly on a machine

Re: [PHP] questions about $_SERVER

2012-03-13 Thread Tim Streater
On 13 Mar 2012 at 15:59, Tedd Sperling wrote: > I'm not sure what would have saved bacon in the above case. I don't see how > your example would work. I think it contained a typo. > > In what I think you were trying to demonstrate, I would just pass $x by > reference (&$x) -- or -- return $x by

Re: [PHP] questions about $_SERVER

2012-03-13 Thread Tedd Sperling
On Mar 13, 2012, at 12:20 PM, Stuart Dallas wrote: > On 13 Mar 2012, at 15:59, Tedd Sperling wrote: > >> In any event, I seldom use globals anyway. This was more an academic >> discussion. > -snip- > It ultimately also means that only the superglobals are true globals. That was my initial statem

Re: [PHP] questions about $_SERVER

2012-03-13 Thread Stuart Dallas
On 13 Mar 2012, at 15:59, Tedd Sperling wrote: > In any event, I seldom use globals anyway. This was more an academic > discussion. If you're being academic about it please remember that the way PHP defines globals is different to most other languages. PHP: A variable defined at the top-level

Re: [PHP] questions about $_SERVER

2012-03-13 Thread Matijn Woudt
On Tue, Mar 13, 2012 at 4:59 PM, Tedd Sperling wrote: > On Mar 12, 2012, at 7:12 PM, Tim Streater wrote: >> > >> function yes ($a) >>     { >>     global $x; >>     if  ($a)  $x = "yes\n"; >>     } >> >> first (true); >> >> echo $x; >> >> ?> >> >> >> but I haven't looked into $GLOBALS enough to kn

Re: [PHP] questions about $_SERVER

2012-03-13 Thread Tedd Sperling
On Mar 12, 2012, at 12:04 PM, Daniel Brown wrote: > On Sun, Mar 11, 2012 at 14:16, Tedd Sperling wrote: >> This document clearly states that $GLOBALS is a SuperGlobal -- what am I not >> understanding here? > >You are understanding it correctly, the only thing that's missing > is the populat

[PHP] Randomly unable to read set variable from class

2012-03-13 Thread Adrian Basalic
I have an issue that occurs randomly on a machine. After a number of reloads of the page i can't read $this->_foo although it is set (var_dump shows it but the script cannot read it). The code works locally and on other machines i tested. Apache restart seems to fix it but only temporary. Environm

Re: [PHP] questions about $_SERVER

2012-03-13 Thread Tedd Sperling
On Mar 12, 2012, at 7:12 PM, Tim Streater wrote: > > function yes ($a) > { > global $x; > if ($a) $x = "yes\n"; > } > > first (true); > > echo $x; > > ?> > > > but I haven't looked into $GLOBALS enough to know whether using them instead > would have saved my bacon. I'm no

RE: [PHP] Getting knotted with quotes encoding - (one possible solution)

2012-03-13 Thread Arno Kuhl
From: Ashley Sheridan [mailto:a...@ashleysheridan.co.uk] Sent: 13 March 2012 03:25 PM To: a...@dotcontent.net; php-general@lists.php.net Subject: Re: [PHP] Getting knotted with quotes encoding Arno Kuhl wrote: >I've been battling with quotes encoding when outputting javascript with >php. >It

Re: [PHP] Getting knotted with quotes encoding

2012-03-13 Thread Ashley Sheridan
Arno Kuhl wrote: >I've been battling with quotes encoding when outputting javascript with >php. >It can't be unique, so I'm hoping someone has a working solution >they're >willing to share. > >The following works perfectly as long as there aren't any single quotes >in >the link text: > ec

[PHP] Getting knotted with quotes encoding

2012-03-13 Thread Arno Kuhl
I've been battling with quotes encoding when outputting javascript with php. It can't be unique, so I'm hoping someone has a working solution they're willing to share. The following works perfectly as long as there aren't any single quotes in the link text: echo "$sTitle"; if $sTitle has