php-general Digest 8 Nov 2008 12:56:47 -0000 Issue 5779

2008-11-08 Thread php-general-digest-help

php-general Digest 8 Nov 2008 12:56:47 - Issue 5779

Topics (messages 283090 through 283093):

Re: PCRE regex result is different between Linux  Windows.
283090 by: ClapClap
283093 by: Lupus Michaelis

Re: object persistence within a session
283091 by: Shawn McKenzie
283092 by: Andrew Ballard

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:
[EMAIL PROTECTED]


--
---BeginMessage---

Jochem Maas a écrit :

 [I precede you, sorry for language mistakes...]

 php or english? :-)


ohhh... sh.. ! I think I speak PHP better than english (silly, not ?).


 okay, are you using the same PHP version on both machines?
 anything in the php.ini's that differs?


The same, not possible (Windows/Linux).
For php.ini, quite the same (some directories are different).
Under Windows (PHP 5.1.6 on 2k SP4 / 5.2.4 on XP SP2, the officials).
Under Linux (Ubuntu 8.04) 5.2.4-2ubuntu5.3.

 are you possibly looking at an input/file character-set encoding related
 issue? (i.e. encoding is different between the two servers)?


All PHP source is written in UTF-8.
I take the HTML code and convert it to UTF-8 using iconv() / mbstring...

 can you post a short complete script to see if others can reproduce the
 error?


See the following link for the bogus test (Must match : windows = 90, 
linux = 54): http://pastebin.com/m1c43cc10


The same results are given when :
- comments are removed
- with 'm' or 's' PCRE options
- recursion is removed (multiple parses in while statement (matches for 
each pass : 55, 26, 5, 2))


This snippet is used in a part of code which goal is to convert HTML 
from Word 2003 to valid XHTML. But that is not the subject...


For the PCRE version, I really can not tell you which one I use...
Where can I see that ?

So, It may be a bug ? Too bad...


 have you tried to use the Tidy extension to clean up the input string?,
 it has alsorts of wonderful settings for making (x)HTML nice an shiny.


You think I have already tried it. ;-)
Tidy is too agressive for parsing HTML from MS Office...

Hope it will work :-/

--
Julien

---End Message---
---BeginMessage---

ClapClap a écrit :


For the PCRE version, I really can not tell you which one I use...
Where can I see that ?


  In the the output from phpinfo function.


So, It may be a bug ? Too bad...


  I remember some change behavior recently in PCRE. But I am not sure, 
I want just to drop this option first.


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org
---End Message---
---BeginMessage---
tedd wrote:
 At 7:08 PM +0100 11/7/08, Jochem Maas wrote:
 Stan schreef:
  If this is the wrong forum, please point me at the correct forum.

  I am new to PHP but have 40 years experience programming.

 cool. we're you around when they programmed with Rocks[tm]? :-)
 (stick around a while and you'll get to know that inside joke)
 
 
 Rocks?! Did someone say Rocks? Did I ever tell you about programming
 with rocks
 
 Egads, not another old fart.  :-)
 
 Well, welcome to the group oldster and get ready to learn from these
 up-starts. I don't know when these youngsters passed me, but they did.
 
 Cheers,
 
 ted
 
Stan is a young whipper - snapper.

-- 
Thanks!
-Shawn
http://www.spidean.com
---End Message---
---BeginMessage---
On Fri, Nov 7, 2008 at 3:54 PM, Stan [EMAIL PROTECTED] wrote:
 Andrew,
 Do I feel stupid!
 Thanks.

Welcome to the list. No need to feel stupid, and you're welcome. We
were all here at some point. Even tedd, who has been programming since
Rocks apparently. :-) At least you read up on the language and took a
stab at a solution before you came looking for help. That's a lot more
than can be said for some of the requests that show up on this list.

Just something to keep in mind based on your description of the
project. (You said you were trying to avoid repeated database calls on
each request.) PHP sessions are usually stored in the file system
(unlike ASP sessions that are stored in memory). Therefore there will
be some overhead with sessions as well. (The server has to read the
cookie, find the corresponding file, compare the modified time of the
file to make sure the session hasn't expired, read the file into
memory, and unserialize the data into variables.) You may want to
experiment from project to project while you're getting used to the
language until find the right balance of how much you store in
sessions versus how often you repeat trips to the database.

I usually use the database to store session information so that it is
available regardless of which server handles a request in a clustered
environment. I've found that I don't mind a few well organized
database calls per page for the information I need. I know some people
on this list have forgone sessions altogether in favor of other

[PHP] Re: PCRE regex result is different between Linux Windows.

2008-11-08 Thread Lupus Michaelis

ClapClap a écrit :


For the PCRE version, I really can not tell you which one I use...
Where can I see that ?


  In the the output from phpinfo function.


So, It may be a bug ? Too bad...


  I remember some change behavior recently in PCRE. But I am not sure, 
I want just to drop this option first.


--
Mickaël Wolff aka Lupus Michaelis
http://lupusmic.org

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



Re: [PHP] Printing Web Page

2008-11-08 Thread Ashley Sheridan
On Sat, 2008-11-08 at 08:01 -0500, Patrick Moloney wrote:
 Ashley Sheridan wrote:
  On Thu, 2008-11-06 at 22:35 +0100, Frank Arensmeier wrote:
  6 nov 2008 kl. 21.21 skrev Patrick Moloney:
 
  I'd like to enable my users to print individual web pages from their  
  browser. If they simply select the browser print button they don't  
  get all the text that is displayed in a scrolling text area.
  The web page is static html and css, in a php file.
 
  This might be a good starting point.
 
  http://www.alistapart.com/articles/printyourway
 
  //frank
 
 
  link href=print.css media=print type=text/css rel=stylesheet/
  
  Then set out your CSS in print.css to lay out the page without scrolling
  areas.
  
  
  Ash
  www.ashleysheridan.co.uk
  
 
 Thanks all! So, to state the obvious (to you all) the solution is to 
 address my original question through CSS. That sounds good.
 Ashly, your post is helpful. What is the next step, to display the page 
 on screen using the new stylesheet, then rely on the user to use the 
 browsers print button?
 
 Thanks,
 Patrick
 
 
Easier than that even, the browser automatically selects this stylesheet
when the user presses the print button (or you issue a window.print()
from javascript) because it recognises the media=print attribute. You
can use the media type for other browsers too, like audio, print,
screen, projectors, etc.


Ash
www.ashleysheridan.co.uk


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



Re: [PHP] Printing Web Page

2008-11-08 Thread Patrick Moloney

Ashley Sheridan wrote:

On Thu, 2008-11-06 at 22:35 +0100, Frank Arensmeier wrote:

6 nov 2008 kl. 21.21 skrev Patrick Moloney:

I'd like to enable my users to print individual web pages from their  
browser. If they simply select the browser print button they don't  
get all the text that is displayed in a scrolling text area.

The web page is static html and css, in a php file.


This might be a good starting point.

http://www.alistapart.com/articles/printyourway

//frank



link href=print.css media=print type=text/css rel=stylesheet/

Then set out your CSS in print.css to lay out the page without scrolling
areas.


Ash
www.ashleysheridan.co.uk



Thanks all! So, to state the obvious (to you all) the solution is to 
address my original question through CSS. That sounds good.
Ashly, your post is helpful. What is the next step, to display the page 
on screen using the new stylesheet, then rely on the user to use the 
browsers print button?


Thanks,
Patrick


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



[PHP] strtotime

2008-11-08 Thread gilles
Avec la version 4 de php, strtotime(20080950) fonctionne correctement en 
allant sur le mois d'octobre, alors qu'en version 5: 19700101.
Merci de votre aide 



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



[PHP] Re: strtotime

2008-11-08 Thread Maciek Sokolewicz

gilles wrote:
Avec la version 4 de php, strtotime(20080950) fonctionne correctement en 
allant sur le mois d'octobre, alors qu'en version 5: 19700101.
Merci de votre aide 





This is an ENGLISH list, please rephrase your question in english and 
people might understand.


Cette liste est une liste anglaise, reformulent svp votre question en 
anglais svp.


merci,

- Tul

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



Re: [PHP] Re: strtotime

2008-11-08 Thread Bastien Koert
2008/11/8 Maciek Sokolewicz [EMAIL PROTECTED]

 gilles wrote:

 Avec la version 4 de php, strtotime(20080950) fonctionne correctement en
 allant sur le mois d'octobre, alors qu'en version 5: 19700101.
 Merci de votre aide


 This is an ENGLISH list, please rephrase your question in english and
 people might understand.

 Cette liste est une liste anglaise, reformulent svp votre question en
 anglais svp.

 merci,

 - Tul


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


I'll translate

In PHP4, strtotime works fine

in PHP5 strtotime gives a result of 19700101 when the data entered was
strtotime(20080950)

-- 

Bastien

Cat, the other other white meat


[PHP] htmlentities() and default_charset

2008-11-08 Thread Jim Hermann - UUN Hostmaster
Folks,

Why should htmlentities() use the default_charset for $charset with this
example, taken from ext/standard/tests/strings/htmlentities10.phpt?

?php
ini_set('mbstring.internal_encoding','pass');
ini_set('default_charset','cp1252');
var_dump(htmlentities(\x82\x86\x99\x9f, ENT_QUOTES, ''));
?

The test script expects the output to be:
string(28) sbquo;dagger;trade;Yuml;

According to the PHP Manual, the htmlentities() syntax is:

string htmlentities  ( string $string  [, int $quote_style  [, string
$charset  [, bool $double_encode  ]]] )

For the parameter charset:

Like htmlspecialchars(), it takes an optional third argument charset which
defines character set used in conversion. Presently, the ISO-8859-1
character set is used as the default.  It goes on to list the supported
values for charset and states:  Note:  Any other character sets are not
recognized and ISO-8859-1 will be used instead.

Therefore, when $charset = '' I would expect that
htmlentities(\x82\x86\x99\x9f, ENT_QUOTES, '') would use ISO-8859-1 since
the null string is not listed as a supported value.  Also, it does not
mention the use of default_charset.  Furthermore, when default_charset = '',
PHP states that ISO-8859-1 will be used as the default.

Since the $charset is optional, I would expect
htmlentities(\x82\x86\x99\x9f, ENT_QUOTES) would use the default_charset,
but not htmlentities(\x82\x86\x99\x9f, ENT_QUOTES, '').  However, test
scripts ext/standard/tests/strings/htmlentities10.phpt, htmlentities11.phpt,
and htmlentities13.phpt all expect the default_charset to be used when
charset=''.

Thanks.

Jim
-
Jim Hermann [EMAIL PROTECTED]
UUism Networks http://www.UUism.net
Ministering to the Needs of Online UUs
Web Hosting, Email Services, Mailing Lists
-


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



[PHP] Re: PCRE regex result is different between Linux Windows.

2008-11-08 Thread ClapClap

Lupus Michaelis a écrit :

ClapClap a écrit :


For the PCRE version, I really can not tell you which one I use...
Where can I see that ?


  In the the output from phpinfo function.



Thanks.
My versions of PCRE :
- Linux 7.4 2007-09-21 (PHP 5.2.4-2ubuntu5.3)
- Windows XP 7.2 2007-06-19 (PHP 5.2.4)


So, It may be a bug ? Too bad...


  I remember some change behavior recently in PCRE. But I am not sure, I 
want just to drop this option first.




Yeah !
It's probably that. I hope...
Too bad.

--
Julien


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



Re: [PHP] Re: strtotime

2008-11-08 Thread Micah Gersten
Bastien Koert wrote:
 2008/11/8 Maciek Sokolewicz [EMAIL PROTECTED]

   
 gilles wrote:

 
 Avec la version 4 de php, strtotime(20080950) fonctionne correctement en
 allant sur le mois d'octobre, alors qu'en version 5: 19700101.
 Merci de votre aide


   
 This is an ENGLISH list, please rephrase your question in english and
 people might understand.

 Cette liste est une liste anglaise, reformulent svp votre question en
 anglais svp.

 merci,

 - Tul


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


 
 I'll translate

 In PHP4, strtotime works fine

 in PHP5 strtotime gives a result of 19700101 when the data entered was
 strtotime(20080950)

   
What does work fine mean?  20080950 isn't normal, so what is the
expected result?

Thank you,
Micah Gersten
onShore Networks
Internal Developer
http://www.onshore.com



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



Re: [PHP] Re: strtotime

2008-11-08 Thread Ashley Sheridan
On Sat, 2008-11-08 at 18:57 -0600, Micah Gersten wrote:
 Bastien Koert wrote:
  2008/11/8 Maciek Sokolewicz [EMAIL PROTECTED]
 

  gilles wrote:
 
  
  Avec la version 4 de php, strtotime(20080950) fonctionne correctement en
  allant sur le mois d'octobre, alors qu'en version 5: 19700101.
  Merci de votre aide
 
 

  This is an ENGLISH list, please rephrase your question in english and
  people might understand.
 
  Cette liste est une liste anglaise, reformulent svp votre question en
  anglais svp.
 
  merci,
 
  - Tul
 
 
  --
  PHP General Mailing List (http://www.php.net/)
  To unsubscribe, visit: http://www.php.net/unsub.php
 
 
  
  I'll translate
 
  In PHP4, strtotime works fine
 
  in PHP5 strtotime gives a result of 19700101 when the data entered was
  strtotime(20080950)
 

 What does work fine mean?  20080950 isn't normal, so what is the
 expected result?
 
 Thank you,
 Micah Gersten
 onShore Networks
 Internal Developer
 http://www.onshore.com
 
 
 
Well, for starts Micah is right, your date string will be interpreted as
the 50th of September, 2008, which isn't valid and defaults to the time
represented by the timestamp 0. If you want to turn 8-digit number
strings into timestamps, make sure of two things:

1.It's actually a string and not a number
2.The string is in the format mmdd

The strings can be a variety of formats, all found at
http://www.gnu.org/software/shishi/manual/html_node/Date-input-formats.html 
which is a link available on the strtotime manual page.


Ash
www.ashleysheridan.co.uk


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



[PHP] PHP - Web/list Question...

2008-11-08 Thread bruce
Hi.

I've got a question/issue that I want to bounce off the list.

I have a list that extends over multiple pages. there might be 200 items,
and i don't want to have the items listed on the same page as it would be
too long. i can break the list up, so i can have it be displayed over
multiple pages. however, i want the user to select different items from the
list. given that the selected items might be over different pages, what's
the best way of keeping a running track of the items that have been
selected??

I could have each page be a form, and do a post/get where i then keep track
of the selected items from page to page, but that would appear to get ugly.
i'm looking for pointers to other sites/code that might have already
implemented this kind of scenario.

thoughts/pointers would be appreciated...


thanks

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

Re: [PHP] PHP - Web/list Question...

2008-11-08 Thread Wolf

 bruce [EMAIL PROTECTED] wrote:
 Hi.

 I've got a question/issue that I want to bounce off the list.

 I have a list that extends over multiple pages. there might be 200 items,
 and i don't want to have the items listed on the same page as it would be
 too long. i can break the list up, so i can have it be displayed over
 multiple pages. however, i want the user to select different items
from the
 list. given that the selected items might be over different pages, what's
 the best way of keeping a running track of the items that have been
 selected??

 I could have each page be a form, and do a post/get where i then keep
track
 of the selected items from page to page, but that would appear to get
ugly.
 i'm looking for pointers to other sites/code that might have already
 implemented this kind of scenario.

You use a database, form on each page adds to a temp table on the
database, when they have verified them all (if that is something they
can do) OR have finished whatever form/survey you have them doing, then
you write the temp table info to the one you want to keep.

You could do some of that with ajax as well, but if you want to break up
a 200 item list, you are looking at a database to store the info in the
most efficient manner possible.

You could also do it with sessions, but if they get stuck and need to
come back, then if they had to login their session might be different
and they'd have to start over again.

HTH,
Wolf


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



Re: [PHP] PHP - Web/list Question...

2008-11-08 Thread Robert Cummings
On Sat, 2008-11-08 at 20:26 -0800, bruce wrote:
 Hi.
 
 I've got a question/issue that I want to bounce off the list.
 
 I have a list that extends over multiple pages. there might be 200 items,
 and i don't want to have the items listed on the same page as it would be
 too long. i can break the list up, so i can have it be displayed over
 multiple pages. however, i want the user to select different items from the
 list. given that the selected items might be over different pages, what's
 the best way of keeping a running track of the items that have been
 selected??
 
 I could have each page be a form, and do a post/get where i then keep track
 of the selected items from page to page, but that would appear to get ugly.
 i'm looking for pointers to other sites/code that might have already
 implemented this kind of scenario.
 
 thoughts/pointers would be appreciated...

Accumulate them in the session. When done, and before final action you
could let them view a summary of selected items and allow deletion of
any entries they don't want.

Cheers,
Rob.
-- 
http://www.interjinn.com
Application and Templating Framework for PHP


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



Re: [PHP] Re: strtotime

2008-11-08 Thread Lester Caine

Ashley Sheridan wrote:

I'll translate

In PHP4, strtotime works fine

in PHP5 strtotime gives a result of 19700101 when the data entered was
strtotime(20080950)

  

What does work fine mean?  20080950 isn't normal, so what is the
expected result?



Well, for starts Micah is right, your date string will be interpreted as
the 50th of September, 2008, which isn't valid and defaults to the time
represented by the timestamp 0. If you want to turn 8-digit number
strings into timestamps, make sure of two things:

1.It's actually a string and not a number
2.The string is in the format mmdd

The strings can be a variety of formats, all found at
http://www.gnu.org/software/shishi/manual/html_node/Date-input-formats.html 
which is a link available on the strtotime manual page.


I seem to remember a previous discussion about this 'bug' but I can't track 
the notes. Is it not the case that you can simply add days or months to the 
'number' and then use strtotime to output the 'normalised' date. So adding 30 
to 20th Sept would return 20th October. This very useful feature was corrected 
as a bug in the rewrite of Date in PHP5.1?

Reason for looking for the notes was to remember how one has to do it now 

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/lsces/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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