php-general Digest 16 Feb 2011 21:16:38 -0000 Issue 7185

2011-02-16 Thread php-general-digest-help

php-general Digest 16 Feb 2011 21:16:38 - Issue 7185

Topics (messages 311359 through 311392):

Re: errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?
311359 by: Richard Quadling
311361 by: Andre Polykanine
311363 by: Richard Quadling
311372 by: Daniel P. Brown
311373 by: David Hutto
311374 by: Daniel P. Brown
311375 by: David Hutto
311376 by: David Hutto
311377 by: Daniel P. Brown
311378 by: Richard Quadling
311380 by: Robert Cummings

Re: Howdy (new in here)
311360 by: Andre Polykanine
311379 by: Donovan Brooke

DOMDocument, content of entity
311362 by: Fanda
311364 by: Jay Blanchard
311365 by: Jay Blanchard
311366 by: Fanda
311367 by: Fanda
311368 by: Jay Blanchard
311369 by: Jay Blanchard
311370 by: Fanda

Re: Finding split points in an article for inserting ads
311371 by: Gerardo Benitez

PHP+MySQL question
311381 by: דניאל דנון
311382 by: Robert Cummings
311383 by: Robert Cummings

Re: Custom function
311384 by: Mark Kelly
311385 by: Dan Schaefer
311386 by: Peter Lind
311387 by: Andre Polykanine
311388 by: Adam Richardson
311389 by: Peter Lind
311390 by: Peter Lind
311391 by: Paul M Foster
311392 by: Peter Lind

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 16 February 2011 09:12,  fo...@gmx.de wrote:
 Hi everyone!

Hi.

Please read the changelog http://docs.php.net/ChangeLog-5.php#5.3.0
and do a search for ereg. You'll notice that it has been deprecated.

As such, old code that relies on this feature may no longer work as
expected and/or give a warning - just like you are seeing.

Your main choices at this stage are :

1 - Upgrade Typo3 to a compatible version for the version of PHP you
are using. Looking at the latest version
(https://svn.typo3.org/TYPO3v4/Core/tags/TYPO3_4-5-0/t3lib/class.t3lib_page.php)
no longer uses ereg_*(), but preg_*().
2 - Downgrade your PHP version back to the lowest version that is
compatible with your installation of Typo3.
3 - Do a LOT of hacking and hope for the best.

Personally, I'd revert the upgrade of PHP and then create a separate
vhost or site to install/configure/test/upgrade the data from the old
version to the new one.

Also, any plugins/extensions/mods that may have been applied may also
need to be upgraded accordingly.

Regards,

Richard.

P.S. The PHP mailing lists is probably not the best place to come for
support on Typo3. I've never used Typo3 or installed it. But, in this
instance, GWMF.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
---End Message---
---BeginMessage---
Hello Fotoo,

   ?
error_reporting(0);


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: fo...@gmx.de fo...@gmx.de
To: php-gene...@lists.php.net
Date created: , 11:12:13 AM
Subject: [PHP] errors after upgrade vom 5.2.10 to 5.3.0  howto solve or hide?


  Hi everyone!


after upgrading vomn php 5.2.10 to 5.3.0 I get a lot of errors. I changed 
already in some files ereg_replace() to  preg_replace(), but it generates more 
errors as you can see.

The typo3 installation ins still working. 

So - how can I prevent php from printing out this errors on the beginning at 
the website?

display_errors = Off   in  php.ini


Any Ideas?
Greetz.





Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 436

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 438

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 441

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

[PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread fotoo
Hi everyone!


after upgrading vomn php 5.2.10 to 5.3.0 I get a lot of errors. I changed 
already in some files ereg_replace() to  preg_replace(), but it generates more 
errors as you can see.

The typo3 installation ins still working. 

So - how can I prevent php from printing out this errors on the beginning at 
the website?

display_errors = Off   in  php.ini


Any Ideas?
Greetz.





Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 436

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 438

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 441

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2748

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2752

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164

Deprecated: Function spliti() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_parsehtml.php on line 227

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 

Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Richard Quadling
On 16 February 2011 09:12,  fo...@gmx.de wrote:
 Hi everyone!

Hi.

Please read the changelog http://docs.php.net/ChangeLog-5.php#5.3.0
and do a search for ereg. You'll notice that it has been deprecated.

As such, old code that relies on this feature may no longer work as
expected and/or give a warning - just like you are seeing.

Your main choices at this stage are :

1 - Upgrade Typo3 to a compatible version for the version of PHP you
are using. Looking at the latest version
(https://svn.typo3.org/TYPO3v4/Core/tags/TYPO3_4-5-0/t3lib/class.t3lib_page.php)
no longer uses ereg_*(), but preg_*().
2 - Downgrade your PHP version back to the lowest version that is
compatible with your installation of Typo3.
3 - Do a LOT of hacking and hope for the best.

Personally, I'd revert the upgrade of PHP and then create a separate
vhost or site to install/configure/test/upgrade the data from the old
version to the new one.

Also, any plugins/extensions/mods that may have been applied may also
need to be upgraded accordingly.

Regards,

Richard.

P.S. The PHP mailing lists is probably not the best place to come for
support on Typo3. I've never used Typo3 or installed it. But, in this
instance, GWMF.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Howdy (new in here)

2011-02-16 Thread Andre Polykanine
Hello Micky,

And I prefer this:

if ($foo==$baz)
:-).  I  don't know if it's kosher not to put spaces around the == but
still...
-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Micky Hulse rgmi...@gmail.com
To: php-general@lists.php.net
Date created: , 3:43:57 AM
Subject: [PHP] Howdy (new in here)


  On Tue, Feb 15, 2011 at 2:00 PM, David Harkness
davi...@highgearmedia.com wrote:
 I use KR. I started with it just as shown but as monitors increased in size
 I stopped cuddling the else so it's now on its own line, aligning the if,
 elseif, and else nicely. One of the developers at my company uses the
 truly abominable Horstmann style which makes moving code around a serious

KR here, unless existing guidelines are in place... CodeIgniter
framework and ExpressionEngine wants folks to use Allman.

I use a programming lang called Objectscript at work, and it will give
an error if there is not space between the if and the first (...
For example:

if(...) -- errors out.

I have had to learn to put a space in there:

if (...)

So I don't forget, I do this for everything now... I actually kinda
like the breathing room now.

Speaking of spaces, I am not a fan of putting spaces around the argument:

if ( foo == baz ) {

I definitely prefer this:

if (foo == baz) {

More on spaces: I am so glad that most PHP folks I know use tabs for
indentation and not spaces! Oops, did I just go there? Oh no I didn't!

Good thread! Thanks for that link Tedd!

Cheers,
Micky

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


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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Andre Polykanine
Hello Fotoo,

   ?
error_reporting(0);


-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: fo...@gmx.de fo...@gmx.de
To: php-general@lists.php.net
Date created: , 11:12:13 AM
Subject: [PHP] errors after upgrade vom 5.2.10 to 5.3.0  howto solve or hide?


  Hi everyone!


after upgrading vomn php 5.2.10 to 5.3.0 I get a lot of errors. I changed 
already in some files ereg_replace() to  preg_replace(), but it generates more 
errors as you can see.

The typo3 installation ins still working. 

So - how can I prevent php from printing out this errors on the beginning at 
the website?

display_errors = Off   in  php.ini


Any Ideas?
Greetz.





Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 436

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 438

Warning: preg_replace() [function.preg-replace]: Delimiter must not be 
alphanumeric or backslash in /typo3_src-3.8.1/t3lib/class.t3lib_page.php on 
line 441

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_matchcondition.php on line 527

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2748

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/typo3/sysext/cms/tslib/class.tslib_content.php on line 2752

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 801

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 809

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2097

Deprecated: Function ereg() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_stdgraphic.php on line 2164

Deprecated: Function spliti() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_parsehtml.php on line 227

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1583

Deprecated: Function eregi_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1585

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function split() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1598

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function ereg_replace() is deprecated in 
/typo3_src-3.8.1/t3lib/class.t3lib_div.php on line 1558

Deprecated: Function eregi_replace() is deprecated in 

[PHP] DOMDocument, content of entity

2011-02-16 Thread Fanda
Hi, does anybody know, how can I parse (by DOMDocument::loadHTMLFile) content 
of td tag, containing string in 3 rows (br)? I need it to split to 3 
strings.
Thanks. Fanda

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Richard Quadling
On 16 February 2011 11:25, Andre Polykanine an...@oire.org wrote:
 Hello Fotoo,

           ?
 error_reporting(0);

Really?

You consider shoving your head in the sand a REALISTIC option?


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



RE: [PHP] DOMDocument, content of entity

2011-02-16 Thread Jay Blanchard
[snip]
Hi, does anybody know, how can I parse (by DOMDocument::loadHTMLFile)
content of td tag, containing string in 3 rows (br)? I need it to
split to 3 strings.
[/snip]

http://www.php.net/explode

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



Re: [PHP] DOMDocument, content of entity

2011-02-16 Thread Fanda
 http://www.php.net/explode

I know it, but when I get content of td by $cols-item(0)-nodeValue, it is 
without br tags. So I need to:
a) get content with tags also or
b) split content by DOM (if it is possible) and get 3 different parts

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



RE: [PHP] DOMDocument, content of entity

2011-02-16 Thread Jay Blanchard
[snip]
 http://www.php.net/explode

I know it, but when I get content of td by $cols-item(0)-nodeValue,
it is without br tags. So I need to:
a) get content with tags also or
b) split content by DOM (if it is possible) and get 3 different parts
[/snip]

The DOM only exists in the browser, it really isn't available
server-side (it is proposed). What does this data look like? Is it just
strings?

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



RE: [PHP] DOMDocument, content of entity

2011-02-16 Thread Jay Blanchard
[snip]
The DOM only exists in the browser, it really isn't available
server-side (it is proposed). What does this data look like? Is it just
strings?
[/snip]

Have you tried DOMDocument::loadHTML?

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Daniel P. Brown
On Wed, Feb 16, 2011 at 07:15, Richard Quadling rquadl...@gmail.com wrote:
 On 16 February 2011 11:25, Andre Polykanine an...@oire.org wrote:
 Hello Fotoo,

           ?
 error_reporting(0);

 Really?

 You consider shoving your head in the sand a REALISTIC option?

Well, at the least, it would shut the errors up in the meantime,
pending an actual resolution.  However, the use of short_open_tags may
completely defeat the intended purpose.

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread David Hutto
On Wed, Feb 16, 2011 at 9:34 AM, Daniel P. Brown
daniel.br...@parasane.net wrote:
 On Wed, Feb 16, 2011 at 07:15, Richard Quadling rquadl...@gmail.com wrote:
 On 16 February 2011 11:25, Andre Polykanine an...@oire.org wrote:
 Hello Fotoo,

           ?
 error_reporting(0);

 Really?

 You consider shoving your head in the sand a REALISTIC option?

    Well, at the least, it would shut the errors up in the meantime,
 pending an actual resolution.  However, the use of short_open_tags may
 completely defeat the intended purpose.

 --
 /Daniel P. Brown
 Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
 (866-) 725-4321
 http://www.parasane.net/

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



What was the intended purpose again?

-- 
According to theoretical physics, the division of spatial intervals as
the universe evolves gives rise to the fact that in another timeline,
your interdimensional counterpart received helpful advice from me...so
be eternally pleased for them.

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Daniel P. Brown
On Wed, Feb 16, 2011 at 09:37, David Hutto smokefl...@gmail.com wrote:

 What was the intended purpose again?

The hiding of errors.

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread David Hutto
Only those who live in glass houses, should hide their errors.

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread David Hutto
On Wed, Feb 16, 2011 at 9:41 AM, David Hutto smokefl...@gmail.com wrote:
 Only those who live in glass houses, should hide their errors.



if that makes sense.
-- 
According to theoretical physics, the division of spatial intervals as
the universe evolves gives rise to the fact that in another timeline,
your interdimensional counterpart received helpful advice from me...so
be eternally pleased for them.

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Daniel P. Brown
On Wed, Feb 16, 2011 at 09:41, David Hutto smokefl...@gmail.com wrote:
 On Wed, Feb 16, 2011 at 9:41 AM, David Hutto smokefl...@gmail.com wrote:
 Only those who live in glass houses, should hide their errors.



 if that makes sense.

Did you even bother to read the whole of what I said?  I wasn't
advocating it as a solution, I simply said it was a temporary fix
pending a real resolution.

-- 
/Daniel P. Brown
Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
(866-) 725-4321
http://www.parasane.net/

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Richard Quadling
On 16 February 2011 14:34, Daniel P. Brown daniel.br...@parasane.net wrote:
 On Wed, Feb 16, 2011 at 07:15, Richard Quadling rquadl...@gmail.com wrote:
 On 16 February 2011 11:25, Andre Polykanine an...@oire.org wrote:
 Hello Fotoo,

           ?
 error_reporting(0);

 Really?

 You consider shoving your head in the sand a REALISTIC option?

    Well, at the least, it would shut the errors up in the meantime,
 pending an actual resolution.  However, the use of short_open_tags may
 completely defeat the intended purpose.

 --
 /Daniel P. Brown
 Dedicated Servers, Cloud and Cloud Hybrid Solutions, VPS, Hosting
 (866-) 725-4321
 http://www.parasane.net/


Because some of the code has been edited, it is now broken. Hiding the
errors at that stage is really driving with your eyes closed.

If the changes are reverted, so that ereg is still used rather than
preg, and the deprecation notices suppressed, then that maybe the best
place to be for the short term.


-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

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



Re: [PHP] Howdy (new in here)

2011-02-16 Thread Donovan Brooke

Tamara Temple wrote:


On Feb 15, 2011, at 4:17 PM, Donovan Brooke wrote:


[snip]

This is what I show my students:

http://rebel.lcc.edu/sperlt/citw229/brace-styles.php

Cheers,

tedd



I didn't know there were names for bracing styles... but


Neither did I -- just the KR style was the only name I recognized. (I
still have a first edition!)


However, I think on my next project, I will use Whitesmith's Style.


I would be more inclined to try other styles if my editor of choice,
TextMate, were to easily support them; as it is now, TextMate
automatically un-indents the line when you type a closing } on an open
line, and automatically indents on an open line after a opening { -- so,
what to do? I don't really want to dive into programming my editor's
functions (which I could do with TextMate) as that is really getting
into non-productive tweaking.


The issue I had at times with the KR style was locating the the
matching (open or closed) brace.. as they were not on the same
character column.


I never really found this to be a problem as long as I kept the various
branches short enough. I was unlucky enough to find someone who coded a
function that went on for 30 pages one (this was in C, not PHP) and
*that* was hard to untangle. Of course, one of the first things I did
when I had a spare moment was to chop it up in to individual functions



Well, in either case it add's a bit of complexity.. if you are not 
searching for an end brace, you are scrolling to find a function (or 
include file perhaps)... but yes, I try to keep them short as well.


One thing I do at times is comment what end brace is what..

} // end to: if $num == 6

I still can't get away from BBedit, but the only automatic thing I have
turned on is text suggestion... which I think about turning off every 
time I code. ;-)




--
D Brooke

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



Re: [PHP] errors after upgrade vom 5.2.10 to 5.3.0 howto solve or hide?

2011-02-16 Thread Robert Cummings

On 11-02-16 09:45 AM, Daniel P. Brown wrote:

On Wed, Feb 16, 2011 at 09:41, David Huttosmokefl...@gmail.com  wrote:

On Wed, Feb 16, 2011 at 9:41 AM, David Huttosmokefl...@gmail.com  wrote:

Only those who live in glass houses, should hide their errors.




if that makes sense.


 Did you even bother to read the whole of what I said?  I wasn't
advocating it as a solution, I simply said it was a temporary fix
pending a real resolution.


Just plop a .htaccess file (or modify one if it already exists) into the 
typo3 root web folder. In it disable E_DEPRECATED warnings. Also, the OP 
appears to have introduced errors by renaming ereg to preg. Did he check 
the syntax for preg versus ereg? His delimiters are conflicting with the 
pattern or are non-existent.


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



[PHP] PHP+MySQL question

2011-02-16 Thread דניאל דנון
Hi.

I have a table called images with 4 columns - `image_id`, `item_name`,
`image_url`,  `image_views`
(Where image_id is UNIQUE and AUTO-INCREMENT).

Sometimes, there might be many items with the same name (but not with the
same url).

I want to make sure that each item name has at most 3 images (and
therefore I need to delete the rest).
The problem is that I want to keep the images with the most views.


I've tried to look for efficient solutions either in MySQL or in PHP, but
they are mostly very resource-intensive,
Such as selecting all different names in PHP (using GROUP BY), then, for
each name, doing DELETE FROM images WHERE item_name = 'ITEM-NAME-HERE' ORDER
BY image_views ASC LIMIT (here some sub-query with count on how many rows
have the name ITEM-NAME-HERE minus 3).


I'd be glad if anyone could help me or point me to the right direction.


Daniel.

-- 
Use ROT26 for best security


Re: [PHP] PHP+MySQL question

2011-02-16 Thread Robert Cummings

On 11-02-16 11:37 AM, דניאל דנון wrote:

Hi.

I have a table called images with 4 columns - `image_id`, `item_name`,
`image_url`,  `image_views`
(Where image_id is UNIQUE and AUTO-INCREMENT).

Sometimes, there might be many items with the same name (but not with the
same url).

I want to make sure that each item name has at most 3 images (and
therefore I need to delete the rest).
The problem is that I want to keep the images with the most views.


I've tried to look for efficient solutions either in MySQL or in PHP, but
they are mostly very resource-intensive,
Such as selecting all different names in PHP (using GROUP BY), then, for
each name, doing DELETE FROM images WHERE item_name = 'ITEM-NAME-HERE' ORDER
BY image_views ASC LIMIT (here some sub-query with count on how many rows
have the name ITEM-NAME-HERE minus 3).


I'd be glad if anyone could help me or point me to the right direction.


I'd use a cron job to manage the purging process... and off the top of 
my head I'd probably go the following route:


Get the list of images with more than 3 of the same name:

SELECT item_name, SUM( 1 ) AS total FROM images HAVING total  3;

Get the 3 best images for each image returned above:

SELECT image_id FROM images WHERE image_name = '[[NAME]]' ORDER BY 
image_views DESC.


(Make sure to quote your criteria properly in the above-- this is pseudo 
codish).


Now delete the laggards using the ID we just retrieved:

DELETE FROM images WHERE image_id NOT IN ([[ID_LIST]]).

That should get you to a decent solution.

Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] PHP+MySQL question

2011-02-16 Thread Robert Cummings



On 11-02-16 11:55 AM, Robert Cummings wrote:

On 11-02-16 11:37 AM, דניאל דנון wrote:

Hi.

I have a table called images with 4 columns - `image_id`, `item_name`,
`image_url`,  `image_views`
(Where image_id is UNIQUE and AUTO-INCREMENT).

Sometimes, there might be many items with the same name (but not with the
same url).

I want to make sure that each item name has at most 3 images (and
therefore I need to delete the rest).
The problem is that I want to keep the images with the most views.


I've tried to look for efficient solutions either in MySQL or in PHP, but
they are mostly very resource-intensive,
Such as selecting all different names in PHP (using GROUP BY), then, for
each name, doing DELETE FROM images WHERE item_name = 'ITEM-NAME-HERE' ORDER
BY image_views ASC LIMIT (here some sub-query with count on how many rows
have the name ITEM-NAME-HERE minus 3).


I'd be glad if anyone could help me or point me to the right direction.


I'd use a cron job to manage the purging process... and off the top of
my head I'd probably go the following route:

Get the list of images with more than 3 of the same name:

SELECT item_name, SUM( 1 ) AS total FROM images HAVING total  3;

Get the 3 best images for each image returned above:

SELECT image_id FROM images WHERE image_name = '[[NAME]]' ORDER BY
image_views DESC.


Oops... that should have a LIMIT clause on it:

SELECT image_id FROM images WHERE image_name = '[[NAME]]' ORDER BY 
image_views DESC LIMIT 3


Cheers,
Rob.
--
E-Mail Disclaimer: Information contained in this message and any
attached documents is considered confidential and legally protected.
This message is intended solely for the addressee(s). Disclosure,
copying, and distribution are prohibited unless authorized.

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



Re: [PHP] Custom function

2011-02-16 Thread Mark Kelly
Hi.

On Wednesday 16 Feb 2011 at 00:49 Simon J Welsh wrote:

 As $z is converted to a boolean and exists, that works just the same way as
  !empty(). ---

First I'd like to apologise for handing out bad advice, and second, to thank 
Simon and Andre for pointing out my mistake. I'll go back to keeping my mouth 
shut in future :)

Cheers guys,

Mark

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



Re: [PHP] Custom function

2011-02-16 Thread Dan Schaefer
In my code, I set the optional parameter to NULL and check for triple equals === or !== to see 
if the variable has been passed with a value. IMO, this is the safest way.


function MyFunction($x, $y, $z=NULL) {
if ($z !== NULL) {
// Do Something
}
}

Dan Schaefer
Web Developer/Systems Analyst
Performance Administration Corp.


On 2-15-2011 6:32 PM, Ron Piggott wrote:

Is there a way to make an optional flag in a custom function --- 2 parameters 
required, 1 optional?  Ron

The Verse of the Day
“Encouragement from God’s Word”
http://www.TheVerseOfTheDay.info



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



Re: [PHP] Custom function

2011-02-16 Thread Peter Lind
On 16 February 2011 21:00, Dan Schaefer d...@performanceadmin.com wrote:
 In my code, I set the optional parameter to NULL and check for triple equals
 === or !== to see if the variable has been passed with a value. IMO,
 this is the safest way.

 function MyFunction($x, $y, $z=NULL) {
 if ($z !== NULL) {
 // Do Something
 }
 }

In case you're actually trying to test if a variable was passed or not
that doesn't work (as it doesn't detect NULL passed in). Use
func_get_args() as that gives you any and all arguments passed to the
function, excluding defaults.

That said, if you're making use of optional parameters and need to
check if anything was passed in, you're almost certainly doing things
wrong.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



Re: [PHP] Custom function

2011-02-16 Thread Andre Polykanine
Hello Peter,

So is
func_get_args()
 the unique way?

-- 
With best regards from Ukraine,
Andre
Skype: Francophile
My blog: http://oire.org/menelion (mostly in Russian)
Twitter: http://twitter.com/m_elensule
Facebook: http://facebook.com/menelion

 Original message 
From: Peter Lind peter.e.l...@gmail.com
To: Dan Schaefer
Date created: , 10:21:20 PM
Subject: [PHP] Custom function


  On 16 February 2011 21:00, Dan Schaefer d...@performanceadmin.com wrote:
 In my code, I set the optional parameter to NULL and check for triple equals
 === or !== to see if the variable has been passed with a value. IMO,
 this is the safest way.

 function MyFunction($x, $y, $z=NULL) {
 if ($z !== NULL) {
 // Do Something
 }
 }

In case you're actually trying to test if a variable was passed or not
that doesn't work (as it doesn't detect NULL passed in). Use
func_get_args() as that gives you any and all arguments passed to the
function, excluding defaults.

That said, if you're making use of optional parameters and need to
check if anything was passed in, you're almost certainly doing things
wrong.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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


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



Re: [PHP] Custom function

2011-02-16 Thread Adam Richardson
On Wed, Feb 16, 2011 at 3:21 PM, Peter Lind peter.e.l...@gmail.com wrote:

 On 16 February 2011 21:00, Dan Schaefer d...@performanceadmin.com wrote:
  In my code, I set the optional parameter to NULL and check for triple
 equals
  === or !== to see if the variable has been passed with a value. IMO,
  this is the safest way.
 
  function MyFunction($x, $y, $z=NULL) {
  if ($z !== NULL) {
  // Do Something
  }
  }

 In case you're actually trying to test if a variable was passed or not
 that doesn't work (as it doesn't detect NULL passed in). Use
 func_get_args() as that gives you any and all arguments passed to the
 function, excluding defaults.


I'm not sure what you're saying here, Peter? Are you saying that the code
wouldn't detect if $z was set to NULL by the calling code or by the default?
I believe the point would be that no matter the case, the check would still
perform the same task.

Maybe I misunderstood (sorry.)



 That said, if you're making use of optional parameters and need to
 check if anything was passed in, you're almost certainly doing things
 wrong.


I sometimes use this approach. PHP doesn't to my knowledge allow you to use
function calls within defaults. There are times that I want the default to
be the result of a function, and to accomplish this, I'll often set the
default to null, then check for the null and carry out the function within.

Is there a better solution?

Adam

-- 
Nephtali:  A simple, flexible, fast, and security-focused PHP framework
http://nephtaliproject.com


Re: [PHP] Custom function

2011-02-16 Thread Peter Lind
On 16 February 2011 21:45, Andre Polykanine an...@oire.org wrote:
 Hello Peter,

 So is
 func_get_args()
     the unique way?


Not really sure what you mean by the unique way. Most things proposed
so far in the thread would be fine for most purposes, I'd say. If you
really need finegrained control, I'd suggest func_get_args.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



Re: [PHP] Custom function

2011-02-16 Thread Peter Lind
On 16 February 2011 21:45, Adam Richardson simples...@gmail.com wrote:
 On Wed, Feb 16, 2011 at 3:21 PM, Peter Lind peter.e.l...@gmail.com wrote:

 On 16 February 2011 21:00, Dan Schaefer d...@performanceadmin.com wrote:
  In my code, I set the optional parameter to NULL and check for triple
 equals
  === or !== to see if the variable has been passed with a value. IMO,
  this is the safest way.
 
  function MyFunction($x, $y, $z=NULL) {
  if ($z !== NULL) {
  // Do Something
  }
  }

 In case you're actually trying to test if a variable was passed or not
 that doesn't work (as it doesn't detect NULL passed in). Use
 func_get_args() as that gives you any and all arguments passed to the
 function, excluding defaults.


 I'm not sure what you're saying here, Peter? Are you saying that the code
 wouldn't detect if $z was set to NULL by the calling code or by the default?
 I believe the point would be that no matter the case, the check would still
 perform the same task.

 Maybe I misunderstood (sorry.)

The point is the poster seemed to suggest the safest way to use
optional parameters was to use null as the default value and use ===
null to check against the optional parameter - as a way to check if
anything was passed in or not. I just pointed out that that would fail
to check for a null passed in and that func_get_args() would be a
better match. You're obviously right that the check inside the
function would work the same whether null was passed in or the value
was defaulted to null.



 That said, if you're making use of optional parameters and need to
 check if anything was passed in, you're almost certainly doing things
 wrong.


 I sometimes use this approach. PHP doesn't to my knowledge allow you to use
 function calls within defaults. There are times that I want the default to
 be the result of a function, and to accomplish this, I'll often set the
 default to null, then check for the null and carry out the function within.

 Is there a better solution?

As noted in the post, func_get_args will show any and all (at least on
my 5.3.3 install and 5.2.6 install) values passed in to the function -
hence it will also show if no parameter was passed in (and is thus
safer than relying on the default value).
That noted, I don't think checking if a value was passed in is good
design - I think the function should be ignorant of what is passed to
it. But that's just me :)

Regards
Peter


-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



Re: [PHP] Custom function

2011-02-16 Thread Paul M Foster
On Wed, Feb 16, 2011 at 09:21:20PM +0100, Peter Lind wrote:

 On 16 February 2011 21:00, Dan Schaefer d...@performanceadmin.com wrote:
  In my code, I set the optional parameter to NULL and check for triple
 equals
  === or !== to see if the variable has been passed with a value. IMO,
  this is the safest way.
 
  function MyFunction($x, $y, $z=NULL) {
  if ($z !== NULL) {
  // Do Something
  }
  }
 
 In case you're actually trying to test if a variable was passed or not
 that doesn't work (as it doesn't detect NULL passed in). Use
 func_get_args() as that gives you any and all arguments passed to the
 function, excluding defaults.

This must be my week to make enemies.

I beg to differ. If the user passes in NULL for $z or passes in nothing
for that variable, it does in fact show up as NULL. The following test
code works as indicated:

function pizza($a, $b, $c = NULL)
{
if ($c === NULL)
echo c is nullbr\n;
elseif ($c !== NULL)
echo c is not null. it has a value of $cbr\n;
else
echo indeterminate: c is $cbr\n;
}   
 
pizza(1, 2, NULL);
pizza(1, 2, 3);
pizza(1, 2);

=-=-=-=-=-=-=

The responses in the first and third cases are NULL. You might be able
to argue that in the first case, where the user passed in NULL, it's
not the same as if the user passed in nothing. But I would assume that the
author considers NULL a signal value, such that if the user passed such
a value in, it would be equivalent to not passing a value for the third
parameter.

 
 That said, if you're making use of optional parameters and need to
 check if anything was passed in, you're almost certainly doing things
 wrong.

Again, assuming you're talking about examples like the one above, I have
to disagree. Presumably, passing in an optional parameter changes the
action inside the function. Thus, you would *need* to test for its
presence. Otherwise, you would be stuck with assuming it's there,
attempting to use it on that assumption, and dealing with whatever
errors it causes when-- surprise!-- it's not there.

Paul

-- 
Paul M. Foster
http://noferblatz.com


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



Re: [PHP] Custom function

2011-02-16 Thread Peter Lind
On 16 February 2011 22:04, Paul M Foster pa...@quillandmouse.com wrote:
 On Wed, Feb 16, 2011 at 09:21:20PM +0100, Peter Lind wrote:

 On 16 February 2011 21:00, Dan Schaefer d...@performanceadmin.com wrote:
  In my code, I set the optional parameter to NULL and check for triple
 equals
  === or !== to see if the variable has been passed with a value. IMO,
  this is the safest way.
 
  function MyFunction($x, $y, $z=NULL) {
  if ($z !== NULL) {
  // Do Something
  }
  }

 In case you're actually trying to test if a variable was passed or not
 that doesn't work (as it doesn't detect NULL passed in). Use
 func_get_args() as that gives you any and all arguments passed to the
 function, excluding defaults.

 This must be my week to make enemies.

 I beg to differ. If the user passes in NULL for $z or passes in nothing
 for that variable, it does in fact show up as NULL. The following test
 code works as indicated:

Did anyone say it wouldn't?


 The responses in the first and third cases are NULL. You might be able
 to argue that in the first case, where the user passed in NULL, it's
 not the same as if the user passed in nothing. But I would assume that the
 author considers NULL a signal value, such that if the user passed such
 a value in, it would be equivalent to not passing a value for the third
 parameter.

The point I was trying to make was specifically that someone might try
to distinguish whether a value was passed in for an optional parameter
or not (like the case Adam outlined). Relying on the value of the
optional parameter will not do, in that case (well it might, depending
upon how stringent you really need to be).


 That said, if you're making use of optional parameters and need to
 check if anything was passed in, you're almost certainly doing things
 wrong.

 Again, assuming you're talking about examples like the one above, I have
 to disagree. Presumably, passing in an optional parameter changes the
 action inside the function. Thus, you would *need* to test for its
 presence. Otherwise, you would be stuck with assuming it's there,
 attempting to use it on that assumption, and dealing with whatever
 errors it causes when-- surprise!-- it's not there.

You should be wary of assumptions, they're not really working out for you.
- a) you're not addressing Adam's use case
- b) I wouldn't need to test for any presence if I wrote the function
as I would personally prefer, i.e. not trying to test if any value was
passed to the function or not. That's the whole point of optional
values: even if nothing is passed in, there's a default value. That's
why trying to check if something was passed for the optional parameter
is counter-productive: the idea of the default value is that you
shouldn't have to check.

Regards
Peter

-- 
hype
WWW: plphp.dk / plind.dk
LinkedIn: plind
BeWelcome/Couchsurfing: Fake51
Twitter: kafe15
/hype

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



[PHP] iVery payment integration help

2011-02-16 Thread Michael Simiyu

hello,

i need some quick help integrating the iVery payment gateway in a
wordpress site

thanks

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



Re: [PHP] iVery payment integration help

2011-02-16 Thread Mujtaba Arshad
Here you go:
http://lmgtfy.com/?q=how+to+integrate+the+iVeri+payment+gateway+in+a+wordpress+site

On Wed, Feb 16, 2011 at 4:27 PM, Michael Simiyu simiyu.mich...@gmail.comwrote:

 hello,

 i need some quick help integrating the iVery payment gateway in a
 wordpress site

 thanks

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




-- 
Mujtaba


[PHP] DOMDocument depth limit

2011-02-16 Thread James Devine
Is there any way to pass LIBXML_PARSEHUGE to DOMDocument::loadHTML ?
I'm trying to load an in-memory html document and I'm hitting this
limit, DOMDocument::load and DOMDocument::loadXML both look like they
accept options but DOMDocument::loadHTML does not.

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



Re: [PHP] iVery payment integration help

2011-02-16 Thread Nicholas Kell

On Feb 16, 2011, at 3:34 PM, Mujtaba Arshad wrote:

 Here you go:
 http://lmgtfy.com/?q=how+to+integrate+the+iVeri+payment+gateway+in+a+wordpress+site
 
 On Wed, Feb 16, 2011 at 4:27 PM, Michael Simiyu 
 simiyu.mich...@gmail.comwrote:
 
 hello,
 
 i need some quick help integrating the iVery payment gateway in a
 wordpress site
 
 thanks
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 
 
 
 -- 
 Mujtaba


HA! That's a good one. *bookmarked*
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] root of PHP found!

2011-02-16 Thread Daevid Vincent
Aha!  I am working for the company that was the root of PHP!

http://www.panasonic.net/history/founder/chapter3/story3-02.html

;-)


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



Re: [PHP] Howdy (new in here)

2011-02-16 Thread Tamara Temple


On Feb 15, 2011, at 11:23 PM, Brian Waters wrote:

On Tue, Feb 15, 2011 at 11:46 PM, Tamara Temple tamouse.li...@gmail.com 
 wrote:



I was unlucky enough to find someone who coded a
function that went on for 30 pages one (this was in C, not PHP) and  
*that*

was hard to untangle.


Why!?!?!?!?!?!?!

- BW


(un?)fortunately, he was no longer with the company, which was why I  
got to take it over. It wasn't the oddest thing, by far. His designs  
were hugely complex (way overengineered for the task at hand, plus  
they didn't work), and he didn't use any consistent indenting style.



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



Re: [PHP] root of PHP found!

2011-02-16 Thread Daniel Brown
On Wed, Feb 16, 2011 at 18:15, Daevid Vincent dae...@daevid.com wrote:
 Aha!  I am working for the company that was the root of PHP!

 http://www.panasonic.net/history/founder/chapter3/story3-02.html

 ;-)

I'm surprised you found that.  Very few people know that PHP is
actually just a cover-up for Pan-Asian culture influence operations
conducted regularly by the CIA.

Unfortunately, now that you do know, you know what we have to do to you

;-P

-- 
/Daniel P. Brown
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/

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



[PHP] How is this possible???? (addslashes)

2011-02-16 Thread Paul S

Can anyone please tell me how the addslashes output (note = Everyone''s a
card on the \earth) in the following example is possible. It is
addslashes output but this result is consistent with the output from
post when runtime is set: 1): a single quote is inserted before a single
quote and nothing is added before  or \.

php: ...
---
?php
//error_reporting(E_ALL);
echo 'display_errors = ' . ini_get('display_errors') . br;
echo 'register_globals = ' . ini_get('register_globals') . br;
echo 'magic_quotes_gpc = ' . ini_get('magic_quotes_gpc') . br;
echo 'get_magic_quotes_gpc = ' . get_magic_quotes_gpc() . br;
echo 'get_magic_quotes_runtime = ' . get_magic_quotes_runtime() . br;
echo brbr;
echo br;
echo 'Current PHP version: ' . phpversion();
echo brbr;
?

?php
$note = Everyone's a card on the \earth;
echo br$notebr;
$note = addslashes($note);
echo brnote = $notebr;
?

?php
phpinfo();
?
-

output:

display_errors = 1
register_globals = 1
magic_quotes_gpc = 1
get_magic_quotes_gpc = 1
get_magic_quotes_runtime = 1



Current PHP version: 4.4.4


Everyone's a card on the \earth

note = Everyone''s a card on the \earth

Warning: phpinfo() has been disabled for security reasons in
---
--
Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: [PHP] How is this possible???? (addslashes)

2011-02-16 Thread Daniel Brown
On Feb 16, 2011 7:07 PM, Paul S pau...@roadrunner.com wrote:

 Can anyone please tell me how the addslashes output (note = Everyone''s a
 card on the \earth) in the following example is possible. It is
 addslashes output but this result is consistent with the output from
 post when runtime is set: 1): a single quote is inserted before a single
 quote and nothing is added before  or \.

 php: ...
 ---
 ?php
 //error_reporting(E_ALL);
 echo 'display_errors = ' . ini_get('display_errors') . br;
 echo 'register_globals = ' . ini_get('register_globals') . br;
 echo 'magic_quotes_gpc = ' . ini_get('magic_quotes_gpc') . br;
 echo 'get_magic_quotes_gpc = ' . get_magic_quotes_gpc() . br;
 echo 'get_magic_quotes_runtime = ' . get_magic_quotes_runtime() . br;
 echo brbr;
 echo br;
 echo 'Current PHP version: ' . phpversion();
 echo brbr;
 ?

 ?php
 $note = Everyone's a card on the \earth;
 echo br$notebr;
 $note = addslashes($note);
 echo brnote = $notebr;
 ?

 ?php
 phpinfo();
 ?
 -

 output:
 
 display_errors = 1
 register_globals = 1
 magic_quotes_gpc = 1
 get_magic_quotes_gpc = 1
 get_magic_quotes_runtime = 1



 Current PHP version: 4.4.4

No offense, but are you kidding me? The host disables phpinfo() for
security reasons, but keeps 4.4.4 running? Talk about running, Paul run
away from them. Fast.

 Everyone's a card on the \earth

 note = Everyone''s a card on the \earth

 Warning: phpinfo() has been disabled for security reasons in

---
 --
 Using Opera's revolutionary email client: http://www.opera.com/mail/

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



Re: [PHP] Turning off magic_quotes_gpc?

2011-02-16 Thread Michael Stroh


  
  
Thanks for the replies, I got caught up in another project and
wasn't able to get back to this. The problem is that I've located a
couple of scripts that are already on the system and are acting up
and I believe it's due to magic quotes being on. Is there a way I
could turn magic quotes off on a file by file basis or even just
folders at a time to test things systematically before I turn things
off system wide?

Cheers,
Michael


  

  
  

  

k...@bitflop.com
  February 10, 2011 5:40 PM
  

  
  
On Thu, 10 Feb 2011 14:52:26 -0500
"Bob McConnell" r...@cbord.com wrote:



  It's a good idea to turn it off as soon as possible. However, you need
to test your site to make sure it won't broke something first.



You have to test not only your site, but also the data that possible
lies in the database, if any.



  There is a way to undo the results of magic quotes. We have
implemented it on a number of sites so that we won't care when it
gets turned off. Early in the script we have the following code:

// If magic quotes is on, we want to remove slashes
if (get_magic_quotes_gpc()) {
  // Magic quotes is on
  $response = stripslashes($_GET[$key]);
}



Many people use this approach or something similar and when you use
that from the beginning of production, it's not a problem. 

If however you are going to turn Magic Quotes off while running a
production system where it was previously turned on, you might run into
problems. 

Don't trust this method blindly. You have to remember that stripslashes
will only remove a single slash. If, for some reason, data has been
pulled out, updated, and re-inserted it may contain several slashes
(because each time Magic Quotes will add a new slash).

If you are turning off Magic Quotes on a system that has been running
with Magic Quotes on, you have to inspect the data manually to be safe.

---
Kind regards

Kim N. Lesmer
Programmer/Unix systemadministrator

Web: www.bitflop.com
E-mail : k...@bitflop.com



  
  

  

Bob McConnell
  February 10, 2011 2:52 PM
  

  
  
From: Michael Stroh



  I'm maintaining various php scripts on a server that was originally 
configured to have magic_quotes_gpc turned on. The installed php


version 


  is 5.2.6. I've read that magic_quotes_gpc is deprecated in 5.3 and 
continuing to use it is "highly discouraged." I've ran into a few


fields 


  that I believe this is causing issues with so I'm considering turning


it 


  off but am wondering what steps should I take to make sure that


nothing 


  breaks and what should I look out for? Also, is it still a good idea


to 


  turn off since this installation isn't yet at 5.3?



It's a good idea to turn it off as soon as possible. However, you need
to test your site to make sure it won't broke something first.

There is a way to undo the results of magic quotes. We have implemented
it on a number of sites so that we won't care when it gets turned off.
Early in the script we have the following code:

// If magic quotes is on, we want to remove slashes
if (get_magic_quotes_gpc()) {
  // Magic quotes is on
  $response = stripslashes($_GET[$key]);
}

Bob McConnell



  
  

  

Michael Stroh
  February 10, 2011 2:40 PM
  

  
  
I'm maintaining various php scripts on a server that was
originally configured to have magic_quotes_gpc turned on. The
installed php version is 5.2.6. I've read that magic_quotes_gpc
is deprecated in 5.3 and continuing to use it is "highly
discouraged." I've ran into a few fields that I believe this is
causing issues with so I'm considering turning it off but am
wondering what steps should I take to make sure that nothing
breaks and what should I look out for? Also, is it still a good
idea to turn off since this installation isn't yet at 5.3?


Cheers,

Michael