php-general Digest 15 Apr 2012 10:46:04 -0000 Issue 7775

2012-04-15 Thread php-general-digest-help

php-general Digest 15 Apr 2012 10:46:04 - Issue 7775

Topics (messages 317546 through 317552):

Re: case-insensitive $_REQUEST,$_GET,$_POST keys?
317546 by: David OBrien
317550 by: tamouse mailing lists

Upcoming Outage: php.net
317547 by: Daniel Brown
317548 by: Govinda

tempnam() not working as expected...
317549 by: tamouse mailing lists
317551 by: Matijn Woudt

strict nannying ...
317552 by: Lester Caine

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On Fri, Apr 13, 2012 at 1:13 PM, tamouse mailing lists 
tamouse.li...@gmail.com wrote:

 Anyone have a quick-and-dirty way to check $_REQUEST keys that is
 case-insensitive?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


this what you asking?

foreach ( $_REQUEST as $key = $value ) {
  if ( strtolower($key) in array('name','username','password')) $data[
strtolower($key) ] = $value;
}
---End Message---
---BeginMessage---
On Fri, Apr 13, 2012 at 12:22 PM, David OBrien dgobr...@gmail.com wrote:
 On Fri, Apr 13, 2012 at 1:13 PM, tamouse mailing lists
 tamouse.li...@gmail.com wrote:

 Anyone have a quick-and-dirty way to check $_REQUEST keys that is
 case-insensitive?

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


 this what you asking?

 foreach ( $_REQUEST as $key = $value ) {
       if ( strtolower($key) in array('name','username','password')) $data[
 strtolower($key) ] = $value;
 }

That would do it! Thanks.
---End Message---
---BeginMessage---
Greetings, all;

This coming Monday, 16 April, 2012, between the hours of 18:00 and
20:00 EDT (22:00 to 00:00 GMT), the one of the primary php.net servers
will be undergoing a critical preventative maintenance operation.  In
this two-hour maintenance window, we do expect a period of
interruption lasting up to thirty minutes, during which certain core
services will be partially or totally unavailable.

The system that will experience the downtime is OSU1PHP.PHP.NET
which, among other things, is the primary system for our mail exchange
and master database.  As such, a sample of services that will likely
be unavailable for a short period of time will include:

* Email (including mailing lists)
* Events, user, and mirror management
* User note submissions from userland
* Et cetera

We are informed by the on-site staff in Oregon State University's
Open Source Lab, who quite generously provide this system
free-of-charge, that while the maintenance is anticipated to take up
to thirty minutes, they will be making all attempts to limit the
downtime to a period of just five to ten minutes.

My apologies for any inconvenience this may cause any of you, but
as stated, this is critical preventative maintenance that is required
to protect the integrity of the system, and to ensure that these
services are not negatively impacted in the future.

Please contact me directly if you have any questions or concerns.

Thanks, all, and have a great weekend.

-- 
/Daniel P. Brown
Network Infrastructure Manager
http://www.php.net/
---End Message---
---BeginMessage---
This coming Monday, 16 April, 2012, between the hours of 18:00 and
 20:00 EDT (22:00 to 00:00 GMT), the one of the primary php.net servers
 will be undergoing a critical preventative maintenance operation.
 [snip]


thanks for the heads up!
:-)

---End Message---
---BeginMessage---
Can someone explain the following to me:


?php
$d=tempnam(.,dir);  /* create a temp named file */
unlink($d); /* unlink it because we're going to make it a 
directory */
mkdir($d,777,true); /* make the directory */
echo $d is . (is_dir($d)?'':'NOT'). a directory\n;


$f=tempnam($d,file);  /* using the first directory, create a new
temp named file */
unlink($f); /* unlink it as we're going to make it a 
directory */
mkdir($f,777,true); /* make the directory */
echo $f is . (is_dir($f)?'':'NOT'). a directory\n;
?

/Users/tamara/Sites/gallery/lib/common/t/dirGuWOLW is  a directory
/private/var/folders/pI/pIx-p0mhH5eEQ64yAiDQmE+++TI/-Tmp-/fileC7Rnzg
is  a directory

Why isn't the second tempnam using the directory path I pass to it?

The strange thing I notice is that if I pass in a directory path to
tempnam that was NOT created initially by tempnam, it works:

miishka:t tamara$ mkdir a
miishka:t tamara$ php -r 'echo
tempnam(/Users/tamara/Sites/gallery/lib/common/t/a,file).PHP_EOL;'
/Users/tamara/Sites/gallery/lib/common/t/a/filepSwRzF
miishka:t tamara$
---End Message---

php-general Digest 16 Apr 2012 02:00:11 -0000 Issue 7776

2012-04-15 Thread php-general-digest-help

php-general Digest 16 Apr 2012 02:00:11 - Issue 7776

Topics (messages 317553 through 317562):

Re: strict nannying ...
317553 by: Stuart Dallas
317554 by: Lester Caine
317555 by: Stuart Dallas
317556 by: Lester Caine
317557 by: Stuart Dallas
317558 by: Lester Caine
317559 by: Stuart Dallas

Customized Session Handler can not work for PHP 5.1.6 and CentOS 5.5
317560 by: Mingda
317561 by: Mingda
317562 by: Mingda

Administrivia:

To subscribe to the digest, e-mail:
php-general-digest-subscr...@lists.php.net

To unsubscribe from the digest, e-mail:
php-general-digest-unsubscr...@lists.php.net

To post to the list, e-mail:
php-gene...@lists.php.net


--
---BeginMessage---
On 15 Apr 2012, at 11:44, Lester Caine wrote:

 I've got a machine set up with PHP5.4 and left the strict errors showing, and 
 I'm falling at the first hurdle :)
 
 The functions for generating URL's are used both statically and as part of 
 the class. STRICT complains because they are not marked 'static' ( and I'm 
 assuming 'public static' is the correct addition here ) but then of cause the 
 $this fallback fails because '$this' is not allowed IN the static use of the 
 function?
 
 How do others get around this problem? I've some 120 static instances to fix 
 in parallel with about the same number of class uses across about 40 odd 
 functions. Do I really have to duplicate the code and rename every static use?

If the class can be used both statically and as an instance why is it referring 
to $this? When called statically $this will not exist.

To refer to the class when in a static method use self...

?php
class StaticClass
{
  public static $staticVariable = 1234;

  public static function staticMethod()
  {
return self::otherStaticMethod();
  }

  public static function otherStaticMethod()
  {
return self::$staticVariable;
  }
}

-Stuart

-- 
Stuart Dallas
3ft9 Ltd
http://3ft9.com/
---End Message---
---BeginMessage---

Stuart Dallas wrote:

On 15 Apr 2012, at 11:44, Lester Caine wrote:


I've got a machine set up with PHP5.4 and left the strict errors showing, and 
I'm falling at the first hurdle :)

The functions for generating URL's are used both statically and as part of the 
class. STRICT complains because they are not marked 'static' ( and I'm assuming 
'public static' is the correct addition here ) but then of cause the $this 
fallback fails because '$this' is not allowed IN the static use of the function?

How do others get around this problem? I've some 120 static instances to fix in 
parallel with about the same number of class uses across about 40 odd 
functions. Do I really have to duplicate the code and rename every static use?


If the class can be used both statically and as an instance why is it referring 
to $this? When called statically $this will not exist.

To refer to the class when in a static method use self...

?php
class StaticClass
{
   public static $staticVariable = 1234;

   public static function staticMethod()
   {
 return self::otherStaticMethod();
   }

   public static function otherStaticMethod()
   {
 return self::$staticVariable;
   }
}


This is all legacy code only some of which I wrote, and the function IS working 
happily with 'STRICT' switched off. I'm just trying to work out how to remove 
the messages that switching 'STRICT' on creates - which in this case is 
complaining when the function IS called statically without being defined as 
such. The function creates a url based on the information supplied, and if no 
information is supplied it uses $this to access the data directly. The problem 
now is getting both uses of the function working, but it looks like I HAVE to 
duplicate the code ... or rather work out how to get the correct values selected 
before calling the static version of the code.


With reference to the above, does self:: replace parent:: when trying to call 
the base functionality which is where I think I am trying to head ... 
getDisplayUrl() gives me a url in one of a number of formats depending what 
style of url is selected, and the base package that created it, so the use both 
statically and 'dynamically' made perfect sense 10 years ago :)


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php
---End Message---
---BeginMessage---
On 15 Apr 2012, at 13:30, Lester Caine wrote:

 Stuart Dallas wrote:
 On 15 Apr 2012, at 11:44, Lester Caine wrote:
 
 I've got a machine set up with PHP5.4 and left the strict errors showing, 
 and I'm falling at the first hurdle :)
 
 The functions for generating URL's are used both statically and as part of