Re: [PHP] Is this a bug?

2008-08-29 Thread T Lensselink
Catalin Zamfir Alexandru, DATAGRAM SRL wrote:
 Hello guys,

 I've been stalking on the list for some time. Didn't have
 anything to report/talk, until now. I have a code like this, maybe you guys
 can reproduce it, with output buffering started:

 Echo 'something';

 Echo 'another thing';

 Echo 'something br /'\;

  

 What happens is that ANYTHING that was echo'ed until that \,
 will not reach the buffer. Although, this should actually be a Parse Error,
 it isn't, it just echoes what was echoed after the god damned \. It took me
 two hours to find this typo in the code .

  

 Can you guys reproduce the error? I can actually give you a
 link to the server where this code runs.


   
The script doesn't cause a parse error Instead it throws a warning.

'PHP Warning:  Unexpected character in input:  '\' (ASCII=92) state=1 in'

Don't think it's a bug. And the reason there's no syntax error is
because the \ is a PHP
escape character.



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



Re: [PHP] Since APC is no longer supported on Windows, can anyone else make php_apc.dll for the newest 5.2.6 non-thread-safe?

2008-07-26 Thread T Lensselink
steve wrote:
 Since APC is no longer supported on Windows, I can't download it from
 php.net. Can anyone else make php_apc.dll for the newest 5.2.6
 non-thread-safe windows version?

 Many thanks in advance...

   
I never heard anything about dropping support for windows.
And on pecl4win there is still a apc dll for the 5_2 branch..

http://pecl4win.php.net/ext.php/php_apc.dll

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



Re: [PHP] uploading big files with PHP

2008-07-25 Thread T Lensselink
Michael Kubler wrote:
 There are other ways to upload files.
 I know if you use Google Gears http://code.google.com/apis/gears/
 (requires a plugin for your web browser), then you can easily have the
 file split up http://code.google.com/apis/gears/api_workerpool.html
 (client side) and sent in chunks, e.g 500Kb, and if the upload fails
 then only that chunk gets affected, you can then resume the uploading
 and the client only has to re-upload from that failed chunk.
 I saw this being demo'd at the Google developer conference in Sydney,
 not sure if it is part of the publicly available release as yet,
 however I have seen similar things done on some websites. I think
 Flickr have similar functionality using AJAX calls... but I might be
 wrong.
You are right on this. There are some other great methods for uploading.
I just meant that in PHP there is not much more options. Of course in
combination with other technologies you can do some pretty cool stuff.
You could use some Java applet, Flash, or like you said Ajax in
combination with PHP.

 Michael Kubler
 *G*rey *P*hoenix *P*roductions http://www.greyphoenix.biz



 Thijs Lensselink wrote:
 Quoting Angelo Zanetti [EMAIL PROTECTED]:



 -Original Message-
 From: Thijs Lensselink [mailto:[EMAIL PROTECTED]
 Sent: 25 July 2008 12:08
 To: php-general@lists.php.net
 Subject: Re: [PHP] uploading big files with PHP

 Quoting Angelo Zanetti [EMAIL PROTECTED]:

 Hi all

 We are pitching to develop a website where the admin has to upload big
 video
 files but I'm not sure how this can be done as the file upload will
 most
 probably time out.

 How do current websites do it? Is there somehow a way to make use
 of FTP
 to
 transfer the files?

 Any links, help, advice will be appreciated.

 Thanks in advance

 Angelo
 http://www.elemental.co.za



 Uploading big files should not be a problem. Make sure the some .ini
 settings are correct for you:

 max_execution_time = 30 ; Maximum execution time of each script, in
 seconds
 max_input_time = 60; Maximum amount of time each script may spend
 parsing request data
 max_input_nesting_level = 64 ; Maximum input variable nesting level

 ; Maximum size of POST data that PHP will accept.
 post_max_size = 8M

 The first 3 you can set with ini_set. You could of course use the ftp
 functionality available in PHP.

 http://nl3.php.net/ftp

 -


 Thanks Thijs,

 It does make sense to change the post_max_size value. But what if
 the file
 is for example a 100MB file or bigger. This probably isn't the best
 way to
 handle this?

 I'm trying to find the best practices to do this or is this totally the
 wrong way to go about this?

 Thanks again!
 Angelo


 If the file is located on the client side. Then form based upload
 over HTTP is your only option really. FTP only comes in handy when
 the file in question resides on the server.






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



Re: [PHP] What font/size do you use for programming?

2008-07-10 Thread T Lensselink
tedd wrote:
 Hi gang:

 I'm running a Mac (so I know mine is a bit different size wise) but
 I'm currently using Veranda at 14 point for coding.

 Just out of curiosity, what font and size do you ppls use for your
 programming?

 Cheers,

 tedd

Envy Code R (Still in beta i believe) 10pt

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



Re: [PHP] unset and circular references

2008-06-27 Thread T Lensselink
Abu Warez wrote:
 --- On Fri, 6/27/08, Thijs Lensselink [EMAIL PROTECTED] wrote:
   
 From: Thijs Lensselink [EMAIL PROTECTED]
 Subject: Re: [PHP] unset and circular references
 To: php-general@lists.php.net
 Date: Friday, June 27, 2008, 5:21 PM
 Quoting Abu Warez [EMAIL PROTECTED]:

 

   
 I think this happens because there is still a reference to
 
  the B object.
   
 According to the manual :

 The destructor method will be called as soon as all
 references to a 
 particular object are removed or when the object is
 explicitly 
 destroyed or in any order in shutdown sequence.

 So as long as A has a reference to B the __destructor will
 not be called.
 

 I think you mean: As long as B has a ref to A (which, indeed, creates B),
 the destructor of A will not be called.
   
My bad. that's what i meant.
 I agree with that, but in this case the garbage collector should detect
 that the reference to object $a is from an object $m_b which is created (and 
 maintained) again by the first object $a. In other words, if object $a is not 
 needed then its member $m_b (which has a reference to $a) is not needed 
 neither. So in this case, in my opinion, if one wants to destory object $a 
 then the reference from $m_b to $a should not count.
   
That would still leave a reference from B to A. That's why it doesn't
get unset. If you unset B before unsetting A the problem is resolved.
 This issue is really frustrating because because in my code I have something 
 like (where $a is of type class A):

 for ( $id ... )
 {
 $a = daoMyClass-LoadById( $id );
  modify $a ...
 /* persist modified $a */
 daoMyClass-Update( $a );
 unset( $a );
 }

 unset, as stated, does not destroy $a and all the loaded $a's remain in
 memory until the script ends. Rising the memory limit is not a solution
 because the count of $a objects grows between script calls. Any ideas?

 Thx,
 Abu



   


   


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



Re: [PHP] extension=mssql.so vs. ;extension=php_mssql.dll

2008-06-16 Thread T Lensselink
Wei, Alice J. wrote:
 Hi,

   I am not sure what is exactly the problem with my configurations while I am 
 trying to configure Apache, PHP and FreeTDS throughout my attempts to install 
 these packages into my Linux.

  It appears that I am doing everything correctly as I am going through 
 listservs, forums and online articles for the configurations, but there is 
 something that goes wrong. So far I have noticed that in my phpinfo() page, I 
 still don't see the mssql packages listed as I should have.

   Some things I need to be clarified:


 1.  I noticed that in http://us.php.net/mssql, it mentioned how we are 
 supposed to add extension=mssql.so in the php.ini file, while in other places 
 I was told to uncomment extension=php_mssql.dll. It appears that this did not 
 give me the right configurations, still, even though the installation did 
 suggest that mssql support is yes.



 2.  I used the following to configure my PHP AFTER I had installed and 
 compiled FreeTDS like most of you said, ./configure 
 --with-mssql=/usr/local/freetds --prefix=/usr/local/php, but every single 
 time, it gives me this: Directory /usr/local/freetds is not a FreeTDS 
 installation directory



 Could this signify the reason why I cannot see PHP configured with MSSQL 
 connection? If yes, why is it possible that the support for MSSQL in the 
 php.ini file has been commented out?


 Thanks in advance.

 ---
 Alice Wei
 MIS 2009
 School of Library and Information Science
 Indiana University Bloomington
 [EMAIL PROTECTED]

   
I had the same problem trying to compile php 5.2.6 with freetds on
Ubutu. No matter what i tried it kept giving me the Directory
/usr/local/freetds is not a FreeTDS installation directory. I ended up
coping some files. wich resulted in a working mssql extension. It's a
hack. But for me it worked.

I configured freeTDS with the following config options:
./configure --with-tdsver=7.0 --enable-msdblib --enable-dbmfix
--with-gnu-ld --enable-shared --enable-static --prefix=/usr/local/freetds

And after make  make install; i copied the following files.

cp [tds source]/include/tds.h /usr/local/freetds/include
cp [tds source]src/tds/.libs/libtds.a /usr/local/freetds/lib

Then i configured php with --with-mssql=shared,/usr/local/freetds

Hope it helps.

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



Re: [PHP] How to look for unused methods/functions and variables/constants.

2007-12-12 Thread T . Lensselink
On Wed, 12 Dec 2007 10:21:58 +0100, Mathijs van Veluw
[EMAIL PROTECTED] wrote:
 Hello there,
 
 We have a large project with lots of classes.
 Now i am wondering if there is a way to let something check all those
 files and tell me which methods/functions variables/constants etc..
 arn't used anymore.
 
 Or even which files arn't used anymore.
 
 Is there already something like this?
 
 Thx in advance.
 
 Mathijs
 

You could use Xdebug's Code_Coverage. Or the Analyze code feature 
in Zend Studio if you're using that :)

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



Re: [PHP] How to look for unused methods/functions and variables/constants.

2007-12-12 Thread T . Lensselink
On Wed, 12 Dec 2007 10:21:58 +0100, Mathijs van Veluw
[EMAIL PROTECTED] wrote:
 Hello there,
 
 We have a large project with lots of classes.
 Now i am wondering if there is a way to let something check all those
 files and tell me which methods/functions variables/constants etc..
 arn't used anymore.
 
 Or even which files arn't used anymore.
 
 Is there already something like this?
 
 Thx in advance.
 
 Mathijs
 

Somehow my subject got stripped. I hope this reply doesn't break the
thread.

You can use Xdebug's Code_Coverage. 
Or the Analyze code feature in Zend Studio if you're using that.

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



Re: [PHP] One more data formatting question

2007-11-29 Thread T . Lensselink
On Thu, 29 Nov 2007 07:53:56 -0700, Jon Westcot [EMAIL PROTECTED] wrote:
 Hi all:
 
 I'm trying to parse out some HTML code back into regular string
 values and I keep getting tripped up by the non-breaking space value
 ( ).  I see that html_decode_entities() can be used to convert this
 back to a viewable space, but the documentation tells me that the space
 value it uses is not the same as a TRIMable space (i.e., ASCII 32).
 
 Is there a quick, fast, and easily implemented way to convert any
 non-breaking space found in a string back to the ASCII 32 space value?  I
 suspect that one of those amazing POSIX expressions could do it, but I'm
 having trouble wrapping my head around them at this early hour.
 
 Any help you all can provide will be extremely appreciated!
 
 Thanks,
 
 Jon

str_replace should do the trick.

str_replace('nbsp;', chr(32), $string);
or
str_replace('nbsp;', ' ', $string);

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



Re: [PHP] Structured Code vs. Performance

2007-11-29 Thread T . Lensselink
On Thu, 29 Nov 2007 14:54:43 +0100, Jochem Maas [EMAIL PROTECTED]
wrote:
 [EMAIL PROTECTED] wrote:
 Just to be curious:

 when something like

 if (defined('FOO')  FOO) {
   class foo{};
   function foo(){};
 }

 is parsed and FOO is not defined, will the code inside be parsed
 nevertheless? Or is anything inside skipped, leading to a (fragments of
 microseconds) faster handling of the code? Thus to go to my original
 question concerning speed: Would I save time with this construct as I
 would
 save it with skipping an include()?
 
 no. regardless of whether that is actually true, still no.
 it's crufty.
 
 they have a word very suitable to this situation in dutch 'mierenneuken',
 personally I'd stick with pretty girls.

mierenneuker :)

Pretty girls over crufty code any day of the week!

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



[PHP] Seeking PHP developer in / near Amsterdam, Netherlands

2007-11-28 Thread T . Lensselink
If interested! Pls contact me off list.

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



Re: [PHP] question regarding type hinting parameters of php functions

2007-11-26 Thread T . Lensselink
On Mon, 26 Nov 2007 10:29:40 +0100, Dirk Thomas / 4wd media
[EMAIL PROTECTED] wrote:
 Hi,
 
 i have tried a current snapshot of PHP 5.3 and have a question regarding
 type hinting.
 
 For example when using the function
 array_slice(array $array, int $offset, int $length)
 with a non-integer length parameter, what is the desired behavior?
 
 When calling
array_slice($array, 0, (float)2);
the resulting array is EMPTY.
 When using the right type
array_slice($array, 0, (int)2);
it works as expected.
 
 Shouldn't there be a notice/warning than just a wrong return value?
 In my case there is neither a warning nor does it work as expected.
 (perhaps it do something wrong?)
 
 Of course i can use int's, but in my opinion either a warning should be
 given or the function should gracefully handle the wrong typed parameter.
 
 Thank you for any feedback,
 Dirk
 

I think there should at least be a notice. It's propably better to ask this
on the internals list.

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



Re: [PHP] uploading files... necessary Ajax?

2007-11-21 Thread T . Lensselink
On Wed, 21 Nov 2007 14:06:17 +0100, Jochem Maas [EMAIL PROTECTED]
wrote:
 pere roca wrote:
 Hi, a basic question:
 I want to send a CSV file and some other parameters. In my FORM I have
 method=POST input type=file and action=http://php;; It sends it
 to
 the php file but I don't want the php to be visualized (in fact it just
 works with the data  and inserts in database). I want to keep the
 original
 HTML and the php working in the background.

 Is for that absolutely necessary Ajax?
 
 no.
 have a look at the various HTTP status codes you can return to the
 browser:
 
   http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
 
 one of the following should do it, although a little further discussion
as
 to which is the best choice (and/or the correct choice) might be
 worthwhile:
 
 204 No Content
 202 Accepted
 
 one of the following probably will do it too, although I don't think
 that their use in the described context is as correct as 204 or 202.
 
 304 Not Modified
 201 Created
 

Jochem,

Just out of interest! How would the upload be performed in the background
by sending an HTTP status code?
It would still require the page to reload. Wich will not keep the current
HTML displayed in the browser. 
Seems to me Pere want's to do an upload without reloading the whole page.

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



RE: [PHP] uploading files... necessary Ajax?

2007-11-21 Thread T . Lensselink
On Wed, 21 Nov 2007 08:38:18 -0600, Jay Blanchard [EMAIL PROTECTED]
wrote:
 [snip]
 Seems to me Pere want's to do an upload without reloading the whole
 page.
 [/snip]
 
 The problem is that you cannot upload files using Ajax alone. But you
 can do it without a reload, requires an invisible IFRAME and a little
 technique. Search Google for several different articles on this.

Indeed uploading with only Ajax is not possible.
The already named iframe technique was the only thing i could think of.
I was just curious if Jochem knew some other way of tackling this problem.

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



Re: [PHP] How does the PHP website colorize the code snippets?

2007-11-15 Thread T . Lensselink
On Wed, 14 Nov 2007 23:45:40 -0800, Daevid Vincent [EMAIL PROTECTED]
wrote:
 I want to put a code snippet section on my site and want to colorize them
 like the user comments on any PHP site page.
 
 http://www.php.net/manual/en/language.operators.arithmetic.php
 
 What's the easiest way to do that?
 
 I've used Geshi, but that seems a lot of overhead just to colorize a wee
 bit-o-PHP code.
 
 http://daevid.com
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Take a look at highlight_string or highlight_file. 

http://nl3.php.net/manual/en/function.highlight-string.php
http://nl3.php.net/manual/en/function.highlight-file.php

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



RE: [PHP] How does the PHP website colorize the code snippets?

2007-11-15 Thread T . Lensselink
On Thu, 15 Nov 2007 03:40:32 -0800, Daevid Vincent [EMAIL PROTECTED]
wrote:
 -Original Message-
 From: T.Lensselink [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, November 15, 2007 12:05 AM
 
 On Wed, 14 Nov 2007 23:45:40 -0800, Daevid Vincent [EMAIL PROTECTED]
 wrote:
  I want to put a code snippet section on my site and want to 
  colorize them like the user comments on any PHP site page.
  
  http://www.php.net/manual/en/language.operators.arithmetic.php
  
  What's the easiest way to do that?
  
  I've used Geshi, but that seems a lot of overhead just to 
  colorize a wee bit-o-PHP code.
 
 Take a look at highlight_string or highlight_file. 
 
 http://nl3.php.net/manual/en/function.highlight-string.php
 http://nl3.php.net/manual/en/function.highlight-file.php
 
 
 Worked pretty good. It seems to have trouble with the \ and \\ chars for
 some reason, but close enough for jazz as they say... (notice the array
has
 \\ when it should only be a single one, however if I get that to work,
then
 the color coding after it is messed up and the \n don't show up. Grr.)
 
 Czech out http://daevid.com  Free Code  Code Snippets

Looks good. I also didn't get the exact result i was looking for. But hey..
it's a start.

 
 I think the little curled corners are slick too!
 PHP.net, you're free to borrow my idea/CSS for your website if you like
:D

Dragable boxes are nice. Wish i had some time to work on my site :)

 
 Now if only the colorize/highlight functions worked on other types of
 source code (ruby, bash, procmail, etc)... Maybe I'll just have to use
 Geshi afterall...

If you are looking for code highlighting for all those languages maybe take
a look at
http://www.gnu.org/software/src-highlite/.

 
 D.Vin

gr,
Thijs

 
 --
 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] Cannot send a hyperlink

2007-11-15 Thread T . Lensselink
On Thu, 15 Nov 2007 09:58:59 -0500, Brad [EMAIL PROTECTED] wrote:
 Still parsing as text and not html!
 
 a href=http://www.zoneofsuccessclub.com;link /a
 //a href=http://www.zoneofsuccessclub.com;link /a
 
 $email = $_REQUEST['email'] ;
 $fromaddress .= '[EMAIL PROTECTED]';
 $fromname .= 'Zone of success Club';
 $eol=\r\n;
 $headers  = From: .$fromname..$fromaddress..$eol;
 $headers .= Reply-To: .$fromname..$fromaddress..$eol;
 $headers .= Return-Path: .$fromname..$fromaddress..$eol;
 $headers .= Message-ID: .time().-.$fromaddress..$eol;
 $headers .= X-Mailer: PHP .phpversion().$eol;
 $body .= --.$htmlalt_mime_boundary.$eol;
 $body .= Content-Type: text/html; charset=iso-8859-1.$eol;
 $body .= Content-Transfer-Encoding: 8bit.$eol.$eol;
 $body = a href=\http://www.zoneofsuccessclub.com\;link /a\n;
 mail($email, $subject, $body, $headers);
 
 -Original Message-
 From: Per Jessen [mailto:[EMAIL PROTECTED] 
 Sent: Thursday, November 15, 2007 9:48 AM
 To: php-general@lists.php.net
 Subject: RE: [PHP] Cannot send a hyperlink
 
 Brad wrote:
 
 Beginning with
 $headers .= --.$htmlalt_mime_boundary.$eol;
 It starts to read it as text and not html??
 
 Could this be a server side problem?
 
 Nope.
 
 $email = $_REQUEST['email'] ;
 $fromaddress .= '[EMAIL PROTECTED]';
 $fromname .= 'Zone of success Club';
 $eol=\r\n;
 $headers  = From: .$fromname..$fromaddress..$eol;
 $headers .= Reply-To: .$fromname..$fromaddress..$eol;
 $headers .= Return-Path: .$fromname..$fromaddress..$eol;
 $headers .= Message-ID: .time().-.$fromaddress..$eol;
 $headers .= X-Mailer: PHP .phpversion().$eol;
 $headers .= --.$htmlalt_mime_boundary.$eol;
 $headers .= Content-Type: text/html; charset=iso-8859-1.$eol;
 $headers .= Content-Transfer-Encoding: 8bit.$eol.$eol;
 $body = a href=\http://www.zoneofsuccessclub.com\;link /a\n;
 
 You have a MIME boundary where it doesn't belong.  MIME boundaries are
 for the body, not the header. 
 
 
 /Per Jessen, Zürich

Exactly. The boundry should be part of the body. And i agree with stut.
Just use 
PHPMailer for this stuff. That's what it's for.

When sending mail from PHP i always make sure there is a fallback for
clients
that don't accept HTML mail. When using your snippet my mail ends up in the
junkmail
box. And it's not HTML either. The headers are messed up. So a small
example:

$boundary = md5(uniqid(rand(), true));

$headers = From: name [EMAIL PROTECTED]\r\n;
$headers .= To: name [EMAIL PROTECTED]\r\n;
$headers .= Subject: some subject\r\n;
$headers .= MIME-Version: 1.0\r\n;
$headers .= Content-Type: multipart/alternative; boundary= . $boundary .
\r\n;

$body = \r\n\r\n-- . $boundary . \r\n;
$body .= Content-Type: text/plain; charset=iso-8859-1\r\n\r\n;

$body .= ... plain text test version ;

$body .= \r\n\r\n-- . $boundary . \r\n;
$body .= Content-Type: text/richtext; charset=iso-8859-1\r\n;

$body .=  richtext test version ...;

$body .= \r\n\r\n-- . $boundary . \r\n;
$body .= Content-Type: text/html; charset=iso-8859-1\r\n;

$body .=  HTML version ...;

$body .= \r\n\r\n-- . $boundary . --\r\n;

mail([EMAIL PROTECTED], (some subject), $body, $headers);

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



Re: [PHP] Maximum function nesting level of '100' reached

2007-10-26 Thread T . Lensselink


On Fri, 26 Oct 2007 14:32:42 +0200, Jochem Maas [EMAIL PROTECTED]
wrote:
 Paul Scott wrote:
 On Fri, 2007-10-26 at 12:52 +0200, Jochem Maas wrote:

 since when is there an arbitrary maximum recursion limit???

 Since forever... ;)
 
 thats you think, personally I test this kind of thing when Im
 not sure:
 
 php -r 'function foo() { static $x = 1; echo foo , $x++, \n; foo(); }
 foo();'
 
 which proves quite adequately that there is no function recursion limit
as
 such,
 and that the error message is simply 'Segmentation Fault' as opposed to
 some message
 about recursion limit being reached.
 
 therefore the recursion limit, whether in defined in php source or in
user
 land code
 is something specific to the XML extension/code the OP was using.
 

 I thought that it was at 60 though...

 --Paul



 

 All Email originating from UWC is covered by disclaimer
 http://www.uwc.ac.za/portal/public/portal_services/disclaimer.htm
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Running your code shows that there is a limit. Although it doesn't throw an
error.
It just stops after n recursive calls:

php4 recursive calls:   796
php5 recursive calls: 49841
php6 recursive calls:  6007

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



Re: [PHP] Maximum function nesting level of '100' reached

2007-10-26 Thread T . Lensselink


On Fri, 26 Oct 2007 16:12:25 +0200, Jochem Maas [EMAIL PROTECTED]
wrote:
 T.Lensselink wrote:

 On Fri, 26 Oct 2007 14:32:42 +0200, Jochem Maas [EMAIL PROTECTED]
 wrote:
 Paul Scott wrote:
 On Fri, 2007-10-26 at 12:52 +0200, Jochem Maas wrote:

 since when is there an arbitrary maximum recursion limit???
 Since forever... ;)
 thats you think, personally I test this kind of thing when Im
 not sure:

 
 php -r 'function foo() { static $x = 1; echo foo , $x++, \n; foo(); }
 foo();'
 
 ...
 

 Running your code shows that there is a limit. Although it doesn't throw
 an
 error.
 It just stops after n recursive calls:

 php4 recursive calls:   796
 php5 recursive calls: 49841
 php6 recursive calls:  6007
 
 A. this is not the output of the script

That's true. i never said it was... or did i?

 
 B. do you think these numbers are the same for everyone?
 heck they're not even garanteed to be the same between 2 runs
 on the same machine with the same php binary.

No i don't think it will be the same on all systems. I also didn't say
that.
You make to much assumptions.

 
 C. it doesn't just stop, a segmentation fault occurs.

No it doesn't segfault. Well atleast it doesn't here. 
error_reporting on. Xdebug enabled... No segfaults.. It just stops after
(n) recursions.

 
 e.g.:
 
 last 2 lines of output for 4.3.10-19:
 
   foo 11137
   foo Segmentatie fout
 
 last 2 lines of output for 4.3.10-19:
 
   foo 11147
   foo Segmentatie fout
 
 last 2 lines of output for 5.1.1:
 
   foo 37435
   foo Segmentation fault
 
 last 2 lines of output for 5.1.1:
 
   foo 37436
   foo Segmentation fault
 
 last 2 lines of output for 5.1.2:
 
   foo 30795
   foo Segmentatie fout
 
 last 2 lines of output for 5.1.2:
 
   foo 30787
   foo Segmentatie fout
 
 
 Therfore there is NO recursion limit in php (not withstanding a specific
 limit
 in functions belonging to an XML extention). the percieved limit is php
 running
 out of memory ... as long as there is memory php will continue to
recurse.

I didn't say there is a recursion limit. I just confirmed the output of
running your test script.

 
 --
 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] Undefined class constant

2007-09-19 Thread T . Lensselink
On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc [EMAIL PROTECTED] wrote:
 Hi everyone,
 
 I'm having a hard time dealing with an error that appeared overnight
 in one of my PHP script:
 
 Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
 /#/classes/framework/HTML/HTMLForm.php on line 120
 
 HTMLForm.php snippet:
 
 .
 // Creates the HTMLFormFields
 foreach ($this-Record-Columns as $_column)
 {
   // Add only visible columns
   if ($_column-IsVisible)
   {
   // Default field type
   $_type=HTMLFormField::ELEMENT_TYPE_TEXT ;
 
  // Adjust default type based on Column type
  switch ($_column-Type)
  {
   case Column::TYPE_AUTONUMBER:
 
 $_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
break;
 
   case Column::TYPE_BOOLEAN :
$_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX ;
break;
  default:
break;
 117:   }
 118:
 119:  // Add the column to the list of fields
 120:  $this-Fields[$_column-Name]=new
 121:  HTMLFormField($this-Name,$_column,$_type);
 122:
 123:  }
 
 }
 
 As you can see there is no refference to any TYPE_HIDDEN constant
 at line 120, nor in the HTMLFormField's constructor.
 
 I searched the net, but I just can't find the reason of this.
 Can someone please help me ?
 
 Thanks,
 Puiu

When the error happens. What are the contents of 120: $_column-Name ?

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



Re: [PHP] Page Numbering

2007-09-19 Thread T . Lensselink
On Wed, 19 Sep 2007 10:05:40 -0400, Dan Shirah [EMAIL PROTECTED]
wrote:
 Hello all,
 
 I am having a problem with trying to display a set amount of records from
 my
 result.
 I have verified that the correct values for my variables are being passed
 to
 the query.
 The calculation for the records that should be displayed per page is
 correct.
 The total number of records returned from my query is correct.
 And the calculated number of total pages to be displayed is correct.
 
 So, initially it displays the first 10 results as it should, and has the
 pages numbers at the bottom.  The problem is, when I click on a different
 page number the same 10 results are ALWAYS displayed.  Even though my
 $page
 variable IS being updated.
 
 Any ideas why my results are not reflecting the page I select?
 
 
 ?php
 if(!isset($_GET['page'])){
 $page = 1;
  } else {
 $page = $_GET['page'];
  }
  // Define the number of results per page
  $max_results = 10;
  // Figure out the limit for the query based
  // on the current page number.
  $from = (($page * $max_results) - $max_results);
  echo $from.FROM;
  $page_results = $max_results + $from;
  echo $page_results.PAGE RESULTS;
   // Query the table and load all of the records into an array.
$sql = SELECT DISTINCT * FROM (
 SELECT TOP $max_results Value1, Value2 FROM (
  SELECT TOP $page_results Value1,
  FROM my_table
  WHERE my_table.column = 'P'
 ) as newtbl order by credit_card_id desc
) as newtbl2 order by credit_card_id asc;
 
 print_r ($sql);
   $result = mssql_query($sql) or die(mssql_error());
  //print_r ($result);
   $number_rows = mssql_num_rows($result);
 ?
 table width='780' border='1' align='center' cellpadding='2'
 cellspacing='2'
 bordercolor='#00'
 ?php
 if(!empty($result)) {
  while ($row = mssql_fetch_array($result)) {
   $id = $row['credit_card_id'];
   $dateTime = $row['date_request_received'];
   //print_r ($id_child);
 ?
 tr
 td width='88' height='13' align='center' class='tblcell'div
 align='center'?php echo a href='javascript:editRecord($id)'$id/a
 ?/div/td
 td width='224' height='13' align='center' class='tblcell'div
 align='center'?php echo $dateTime ?/div/td
 td width='156' height='13' align='center' class='tblcell'div
 align='center'?php echo To Be Processed ?/div/td
 td width='156' height='13' align='center' class='tblcell'div
 align='center'?php echo Last Processed By ?/div/td
 /tr
 ?php
  }
 }
 ?
 /table
 table align=center width=780 cellpadding=2 cellspacing=2
 border=0
 tr
 td width='780' height='15' align='center' class='tblcell'div
 align='center'strongResults: /strong?php echo $number_rows;
 ?/div/td
 /tr
 /table
 ?php
 // Figure out the total number of results in DB:
 $sql_total= SELECT * FROM my_table WHERE my_table.column = 'P';
 $tot_result = mssql_query($sql_total) or die(mssql_error());
 $total_results = mssql_num_rows($tot_result) or die(mssql_error());
 // Figure out the total number of pages. Always round up using ceil()
 $total_pages = ceil($total_results / $max_results);
 echo $max_results.Results;
 echo $total_results.Total;
 echo $total_pages.pages;
 // Build Page Number Hyperlinks
 echo centerSelect a Pagebr /;
 // Build Previous Link
 if($page  1){
 $prev = ($page - 1);
 echo a href=\.$_SERVER['PHP_SELF'].?page=$prev\Previous/a
 ;
 }
 
 for($i = 1; $i = $total_pages; $i++){
 if(($page) == $i){
 echo $i ;
 } else {
 echo a href=\.$_SERVER['PHP_SELF'].?page=$i\$i/a ;
 }
 }
 // Build Next Link
 if($page  $total_pages){
 $next = ($page + 1);
 echo a href=\.$_SERVER['PHP_SELF'].?page=$next\Next/a;
 }
 echo /center;
 ?

I think it returns the same 10 records because of TOP $max_results. 
This will always get the first 10 records. Probably better to use LIMIT.

Why are there so much subqueries needed to get the result set?
Why not something like this:

SELECT DISTINCT * FROM my_table WHERE my_table.column = 'p' ORDER BY
credit_card_id DESC LIMIT $page_results, $max_results

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



Re: [PHP] Page Numbering

2007-09-19 Thread T . Lensselink
On Wed, 19 Sep 2007 10:23:58 -0400, Dan Shirah [EMAIL PROTECTED]
wrote:
 Becase I am using MSSQL not MYSQL.  MSSQL does not have anything easy to
 use
 like LIMIT in MYSQL. So, to achieve the same functionality you have to
use
 the subqueries.
 
 Having the largest number as the inner most subquery value tells the
query
 to retrieve the records that are equal to that number minus 10(my results
 per page)
 
 So, if the inner most query has has a value of 30, the outer query will
 select records 21-30.
 
 And, it does this just fine because if I echo out my variables I see the
 numbers changing. But for whatever reason, the data being displayed is
not
 changing.
 
 
 On 9/19/07, T. Lensselink [EMAIL PROTECTED] wrote:

 On Wed, 19 Sep 2007 10:05:40 -0400, Dan Shirah [EMAIL PROTECTED]
 wrote:
  Hello all,
 
  I am having a problem with trying to display a set amount of records
 from
  my
  result.
  I have verified that the correct values for my variables are being
 passed
  to
  the query.
  The calculation for the records that should be displayed per page is
  correct.
  The total number of records returned from my query is correct.
  And the calculated number of total pages to be displayed is correct.
 
  So, initially it displays the first 10 results as it should, and has
 the
  pages numbers at the bottom.  The problem is, when I click on a
 different
  page number the same 10 results are ALWAYS displayed.  Even though my
  $page
  variable IS being updated.
 
  Any ideas why my results are not reflecting the page I select?
 
 
  ?php
  if(!isset($_GET['page'])){
  $page = 1;
   } else {
  $page = $_GET['page'];
   }
   // Define the number of results per page
   $max_results = 10;
   // Figure out the limit for the query based
   // on the current page number.
   $from = (($page * $max_results) - $max_results);
   echo $from.FROM;
   $page_results = $max_results + $from;
   echo $page_results.PAGE RESULTS;
// Query the table and load all of the records into an array.
 $sql = SELECT DISTINCT * FROM (
  SELECT TOP $max_results Value1, Value2 FROM (
   SELECT TOP $page_results Value1,
   FROM my_table
   WHERE my_table.column = 'P'
  ) as newtbl order by credit_card_id desc
 ) as newtbl2 order by credit_card_id asc;
 
  print_r ($sql);
$result = mssql_query($sql) or die(mssql_error());
   //print_r ($result);
$number_rows = mssql_num_rows($result);
  ?
  table width='780' border='1' align='center' cellpadding='2'
  cellspacing='2'
  bordercolor='#00'
  ?php
  if(!empty($result)) {
   while ($row = mssql_fetch_array($result)) {
$id = $row['credit_card_id'];
$dateTime = $row['date_request_received'];
//print_r ($id_child);
  ?
  tr
  td width='88' height='13' align='center' class='tblcell'div
  align='center'?php echo a
 href='javascript:editRecord($id)'$id/a
  ?/div/td
  td width='224' height='13' align='center' class='tblcell'div
  align='center'?php echo $dateTime ?/div/td
  td width='156' height='13' align='center' class='tblcell'div
  align='center'?php echo To Be Processed ?/div/td
  td width='156' height='13' align='center' class='tblcell'div
  align='center'?php echo Last Processed By ?/div/td
  /tr
  ?php
   }
  }
  ?
  /table
  table align=center width=780 cellpadding=2 cellspacing=2
  border=0
  tr
  td width='780' height='15' align='center' class='tblcell'div
  align='center'strongResults: /strong?php echo $number_rows;
  ?/div/td
  /tr
  /table
  ?php
  // Figure out the total number of results in DB:
  $sql_total= SELECT * FROM my_table WHERE my_table.column = 'P';
  $tot_result = mssql_query($sql_total) or die(mssql_error());
  $total_results = mssql_num_rows($tot_result) or die(mssql_error());
  // Figure out the total number of pages. Always round up using ceil()
  $total_pages = ceil($total_results / $max_results);
  echo $max_results.Results;
  echo $total_results.Total;
  echo $total_pages.pages;
  // Build Page Number Hyperlinks
  echo centerSelect a Pagebr /;
  // Build Previous Link
  if($page  1){
  $prev = ($page - 1);
  echo a
 href=\.$_SERVER['PHP_SELF'].?page=$prev\Previous/a
  ;
  }
 
  for($i = 1; $i = $total_pages; $i++){
  if(($page) == $i){
  echo $i ;
  } else {
  echo a href=\.$_SERVER['PHP_SELF'].?page=$i\$i/a
 ;
  }
  }
  // Build Next Link
  if($page  $total_pages){
  $next = ($page + 1);
  echo a href=\.$_SERVER['PHP_SELF'].?page=$next\Next/a;
  }
  echo /center;
  ?

 I think it returns the same 10 records because of TOP $max_results.
 This will always get the first 10 records. Probably better to use LIMIT.

 Why are there so much subqueries needed to get the result set?
 Why not something like this:

 SELECT DISTINCT * FROM my_table WHERE my_table.column = 'p' ORDER BY
 credit_card_id DESC LIMIT $page_results, $max_results


Dan,

Thanx for the explenation. I should have asked what DB you are using.

So if you wanna select rows from 10 to 20

Re: [PHP] Undefined class constant

2007-09-19 Thread T . Lensselink
On Wed, 19 Sep 2007 17:13:02 +0300, Puiu Hrenciuc [EMAIL PROTECTED] wrote:
 Here are the content for all used variables:
 
 $_this-Name: (string) FilterForm
 $_column:
 StringColumn Object
 (
  [Table] = Roles
  [Name] = RoleName
  [Function] = like
  [Type] = 4
  [Min] =
  [Max] =
  [RegEx] =
  [AllowedValues] = Array
  (
  )
 
  [IsValid] =
  [IsVisible] = 1
  [Sorted] = 0
  [Primary] =
  [Foreign] =
  [Negated] =
  [GroupBy] =
  [Aggregate] =
  [_value:protected] =
 )
 
 $_type: (int) 1
 
 T . Lensselink wrote:
 On Wed, 19 Sep 2007 15:56:22 +0300, Puiu Hrenciuc [EMAIL PROTECTED]
 wrote:
 Hi everyone,

 I'm having a hard time dealing with an error that appeared overnight
 in one of my PHP script:

 Fatal error: Undefined class constant 'self::TYPE_HIDDEN' in
 /#/classes/framework/HTML/HTMLForm.php on line 120

 HTMLForm.php snippet:

 .
 // Creates the HTMLFormFields
 foreach ($this-Record-Columns as $_column)
 {
 // Add only visible columns
 if ($_column-IsVisible)
 {
 // Default field type
 $_type=HTMLFormField::ELEMENT_TYPE_TEXT ;

  // Adjust default type based on Column type
  switch ($_column-Type)
  {
 case Column::TYPE_AUTONUMBER:
   
 $_type=HTMLFormField::ELEMENT_TYPE_HIDDEN ;
break;

 case Column::TYPE_BOOLEAN :
$_type=HTMLFormField::ELEMENT_TYPE_CHECKBOX
 ;
break;
  default:
break;
 117:   }
 118:
 119:// Add the column to the list of fields
 120:$this-Fields[$_column-Name]=new
 121:HTMLFormField($this-Name,$_column,$_type);
 122:
 123:}

 }

 As you can see there is no refference to any TYPE_HIDDEN constant
 at line 120, nor in the HTMLFormField's constructor.

 I searched the net, but I just can't find the reason of this.
 Can someone please help me ?

 Thanks,
 Puiu

 When the error happens. What are the contents of 120: $_column-Name ?

What happens inside the constructor when you create a new instance of
HTMLFormField?
Maybe the $_type is validated there. Or i'm missing something in this
snippet.

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



Re: [PHP] Page Numbering

2007-09-19 Thread T . Lensselink
On Wed, 19 Sep 2007 10:48:20 -0400, Dan Shirah [EMAIL PROTECTED]
wrote:
 Actually, the query you mentioned will select records 11-20 because it
 counts 10 records backwards starting with record 20.
 
 print_r($result) onyl returns Resource id #3 and not the actual data.
 
 
 On 9/19/07, T. Lensselink [EMAIL PROTECTED] wrote:

 On Wed, 19 Sep 2007 10:23:58 -0400, Dan Shirah [EMAIL PROTECTED]
 wrote:
  Becase I am using MSSQL not MYSQL.  MSSQL does not have anything easy
 to
  use
  like LIMIT in MYSQL. So, to achieve the same functionality you have to
 use
  the subqueries.
 
  Having the largest number as the inner most subquery value tells the
 query
  to retrieve the records that are equal to that number minus 10(my
 results
  per page)
 
  So, if the inner most query has has a value of 30, the outer query
 will
  select records 21-30.
 
  And, it does this just fine because if I echo out my variables I see
 the
  numbers changing. But for whatever reason, the data being displayed is
 not
  changing.
 
 
  On 9/19/07, T. Lensselink [EMAIL PROTECTED] wrote:
 
  On Wed, 19 Sep 2007 10:05:40 -0400, Dan Shirah
 [EMAIL PROTECTED]
  wrote:
   Hello all,
  
   I am having a problem with trying to display a set amount of
 records
  from
   my
   result.
   I have verified that the correct values for my variables are being
  passed
   to
   the query.
   The calculation for the records that should be displayed per page
 is
   correct.
   The total number of records returned from my query is correct.
   And the calculated number of total pages to be displayed is
 correct.
  
   So, initially it displays the first 10 results as it should, and
 has
  the
   pages numbers at the bottom.  The problem is, when I click on a
  different
   page number the same 10 results are ALWAYS displayed.  Even though
 my
   $page
   variable IS being updated.
  
   Any ideas why my results are not reflecting the page I select?
  
  
   ?php
   if(!isset($_GET['page'])){
   $page = 1;
} else {
   $page = $_GET['page'];
}
// Define the number of results per page
$max_results = 10;
// Figure out the limit for the query based
// on the current page number.
$from = (($page * $max_results) - $max_results);
echo $from.FROM;
$page_results = $max_results + $from;
echo $page_results.PAGE RESULTS;
 // Query the table and load all of the records into an array.
  $sql = SELECT DISTINCT * FROM (
   SELECT TOP $max_results Value1, Value2 FROM (
SELECT TOP $page_results Value1,
FROM my_table
WHERE my_table.column = 'P'
   ) as newtbl order by credit_card_id desc
  ) as newtbl2 order by credit_card_id asc;
  
   print_r ($sql);
 $result = mssql_query($sql) or die(mssql_error());
//print_r ($result);
 $number_rows = mssql_num_rows($result);
   ?
   table width='780' border='1' align='center' cellpadding='2'
   cellspacing='2'
   bordercolor='#00'
   ?php
   if(!empty($result)) {
while ($row = mssql_fetch_array($result)) {
 $id = $row['credit_card_id'];
 $dateTime = $row['date_request_received'];
 //print_r ($id_child);
   ?
   tr
   td width='88' height='13' align='center' class='tblcell'div
   align='center'?php echo a
  href='javascript:editRecord($id)'$id/a
   ?/div/td
   td width='224' height='13' align='center' class='tblcell'div
   align='center'?php echo $dateTime ?/div/td
   td width='156' height='13' align='center' class='tblcell'div
   align='center'?php echo To Be Processed ?/div/td
   td width='156' height='13' align='center' class='tblcell'div
   align='center'?php echo Last Processed By ?/div/td
   /tr
   ?php
}
   }
   ?
   /table
   table align=center width=780 cellpadding=2 cellspacing=2
   border=0
   tr
   td width='780' height='15' align='center' class='tblcell'div
   align='center'strongResults: /strong?php echo $number_rows;
   ?/div/td
   /tr
   /table
   ?php
   // Figure out the total number of results in DB:
   $sql_total= SELECT * FROM my_table WHERE my_table.column = 'P';
   $tot_result = mssql_query($sql_total) or die(mssql_error());
   $total_results = mssql_num_rows($tot_result) or die(mssql_error());
   // Figure out the total number of pages. Always round up using
 ceil()
   $total_pages = ceil($total_results / $max_results);
   echo $max_results.Results;
   echo $total_results.Total;
   echo $total_pages.pages;
   // Build Page Number Hyperlinks
   echo centerSelect a Pagebr /;
   // Build Previous Link
   if($page  1){
   $prev = ($page - 1);
   echo a
  href=\.$_SERVER['PHP_SELF'].?page=$prev\Previous/a
   ;
   }
  
   for($i = 1; $i = $total_pages; $i++){
   if(($page) == $i){
   echo $i ;
   } else {
   echo a
 href=\.$_SERVER['PHP_SELF'].?page=$i\$i/a
  ;
   }
   }
   // Build Next Link
   if($page  $total_pages){
   $next = ($page + 1);
   echo a
 href=\.$_SERVER['PHP_SELF'].?page=$next\Next/a;
   }
   echo /center

Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)

2007-09-14 Thread T . Lensselink
On Fri, 14 Sep 2007 11:09:36 +0200, Per Jessen [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
 
 On Fri, 14 Sep 2007 10:10:09 +0200, Per Jessen [EMAIL PROTECTED]
 wrote:
 Per Jessen wrote:
 
 To let a user script bring down the host environment is just not
 acceptable. IMHO.
 
 Here's an example from this morning - I have a situation where all I
 need to do is add a single superfluous double quote, and I get a
 segfault.  Is that not poor error handling somewhere?
 
 
 Would love to see the code that caused this.
 
 http://jessen.ch/files/php-problem-sep2007.tar.gz
 
 
 /Per Jessen, Zürich
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

Don't really see what i has to do with a double quote.

When i run the script it segfaults on windows with php 4.x and 5.x. That's
weird.
On linux the script runs fine.

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



Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)

2007-09-14 Thread T . Lensselink
On Fri, 14 Sep 2007 11:09:36 +0200, Per Jessen [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
 
 On Fri, 14 Sep 2007 10:10:09 +0200, Per Jessen [EMAIL PROTECTED]
 wrote:
 Per Jessen wrote:
 
 To let a user script bring down the host environment is just not
 acceptable. IMHO.
 
 Here's an example from this morning - I have a situation where all I
 need to do is add a single superfluous double quote, and I get a
 segfault.  Is that not poor error handling somewhere?
 
 
 Would love to see the code that caused this.
 
 http://jessen.ch/files/php-problem-sep2007.tar.gz
 
 
 /Per Jessen, Zürich
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

It's the call to virtual() that causes the segfault on windows.

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



Re: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)

2007-09-14 Thread T . Lensselink
On Fri, 14 Sep 2007 12:00:19 +0200, Per Jessen [EMAIL PROTECTED] wrote:
 T.Lensselink wrote:
 
 Would love to see the code that caused this.
 
 http://jessen.ch/files/php-problem-sep2007.tar.gz
 
 
 /Per Jessen, Zürich
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php
 
 It's the call to virtual() that causes the segfault on windows.
 
 Interesting - I know the problem is in the virtual() call, but it
 doesn't manifest itself till the problem stylesheet is loaded.
 
 
 /Per Jessen, Zürich
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

You are right. It segfaults only if the virtual() call comes before 
creating the XSLTProcessor instance.

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



RE: [PHP] PHP 5.2.3 - Segmentation fault (core dumped)

2007-09-14 Thread T . Lensselink
On Fri, 14 Sep 2007 08:10:56 -0500, Jay Blanchard [EMAIL PROTECTED]
wrote:
 [snip]
 You are right. It segfaults only if the virtual() call comes before 
 creating the XSLTProcessor instance.
 [/snip]
 
 I cannot replicate the problem on Linux.  
 
 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php

In one of the other messages i stated the script works fine on linux.
But PHP on windows seems to have a problem with virtual(). Even without
creating an instance of the XSLProcessor class.

But dropping virtual() for include() or require() solves the problem.

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



Re: [PHP] Javascript and $_POST

2007-02-08 Thread T . Lensselink
There is nothing wrong with the way you want to submit this form.
Although it's JS :) The sample code you posted was broken in some ways...

missing document. in JS en missing input field to check.

This sample works fine ... 

test.html

script language=JavaScript
function checkForm() {

if (document.inputForm.cc_phone_number.value == ) {
alert( Please enter a phone number. );
document.inputForm.cc_phone_number.focus();
return;
}

document.inputForm.submit();
}

/script
title/title
LINK rel=stylesheet type=text/css href=../../CSS/background.css
/head
body
div align=center 
h2/h2
h3Submit a New Payment./h3
/div

form name=inputForm action=save.php method=post 
enctype=multipart/form-data
input type=text name=cc_phone_number value=8756765756757 /
table align=center border=0 cellpadding=0 cellspacing=0 width=680
tr
td width=64 align=lefta href=javascript:checkForm() 
title=SaveSave/a/td
td width=616 align=lefta href=javascript:closeThis() 
title=CloseClose/a/td
/tr
/table
/form

/body
/html

save.phhp

?php print_r($_POST); ?

Think some other code or JS errors might stop the form from sending data.



On Thu, 8 Feb 2007 09:09:34 -0500, Dan Shirah [EMAIL PROTECTED] wrote:
 Nope, same result unfortunately.
 
 On 2/8/07, Németh Zoltán [EMAIL PROTECTED] wrote:

 On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote:
  Okay, I'll try your spacer solution.   Where do you think I should add
  it?

 I put it right before the /form tag, but I think you could put it
 anywhere between the form and the /form

 greets
 Zoltán Németh

 
  On 2/8/07, Németh Zoltán [EMAIL PROTECTED] wrote:
  On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
   I should not need an actual Button if my link to checkForm()
  ends with
   document.inputForm.submit(); which tells the form to submit,
  right?
 
  well, you should be right...
  but I remember a year ago or so I had a similar problem and
  the image
  input solved it... but I'm not sure whether it was exactly the
  same
  problem or not, so it might be complete bullshit ;)
 
  greets
  Zoltán Németh
 
  
   On 2/8/07, Németh Zoltán [EMAIL PROTECTED] wrote:
   On cs, 2007-02-08 at 08:14 -0500, Dan Shirah wrote:
Okay, I edited my page per some suggestions
  here.  Below is
   what I now have:
   
   
script language=JavaScript
function checkForm() {
   
 // ** START **
  if (inputForm.cc_phone_number.value == ) {
alert( Please enter a phone number. );
inputForm.cc_phone_number.focus();
return;
  }
   
**Lots of other checks here, just left out for
   length**
   
   document.inputForm.submit();
}
   
/script
title/title
LINK rel=stylesheet type=text/css
   href=../../CSS/background.css
/head
body
div align=center h2/h2
   h3Submit a New Payment./h3
/div
form name=inputForm action=save.php
  method=post
enctype=multipart/form-data
   
**Lots of form data here**
   
table align=center border=0 cellpadding=0
   cellspacing=0
width=680
 tr
 td width=64 align=lefta
   href=javascript:checkForm()
title=SaveSave/a/td
 td width=616 align=lefta
   href=javascript:closeThis()
title=CloseClose/a/td
 /tr
/table
/form
/body
/html
   
Now when I submit my page it still perfroms all of
  the
   javascript checks
correctly, but once it gets to the
   document.inputForm.submit(); part it
returns the following error.
   
Error: Object doesn't support this property or
  method.
Code: 0
   
  
   maybe because you don't have submit button in the
  form?
   try to include something like this
   input type=image src=./images/spacer.gif
   where spacer.gif is an 1x1 blank image
  
   I remember some similar 

Re: [PHP] Javascript and $_POST

2007-02-08 Thread T . Lensselink
Don't see how this can pass the check without document.

if (inputForm.cc_phone_number.value == ) {
alert( Please enter a phone number. );
inputForm.cc_phone_number.focus();
return;
}

Comming to this check already gives an error.
Maybe ask on some Javascript list.

P.s. reply to the list please. 

On Thu, 8 Feb 2007 09:45:59 -0500, Dan Shirah [EMAIL PROTECTED] wrote:
 Okay, here is ALL of my checkForm() function.
 
 
 function checkForm() {
 
 ***This check passes***
   if (inputForm.cc_phone_number.value == ) {
 alert( Please enter a phone number. );
 inputForm.cc_phone_number.focus();
 return;
   }
 
 
 ***This check passes***
if (inputForm.receipt.value == ) {
 alert( Please select whether or not a receipt was requested. );
 inputForm.receipt.focus();
 return;
   }
 
 
 ***This check passes***
   if (inputForm.case_number.value == ) {
 alert( Please enter a case number. );
 inputForm.case_number.focus();
 return;
   }
 
 
 ***This check passes***
   if (inputForm.cc_first_name.value == ) {
 alert( Please enter a first name. );
 inputForm.cc_first_name.focus();
 return;
   }
 
 
 ***This check passes***
   if (inputForm.cc_last_name.value == ) {
 alert( Please enter a last name. );
 inputForm.cc_last_name.focus();
 return;
   }
 
 
 ***This check passes***
   if (inputForm.cc_middle_name.value == ) {
 alert( Please enter a middle name. );
 inputForm.cc_middle_name.focus();
 return;
   }
 
 
 ***This check passes***
  if (!(document.inputForm.cc_comments.value ==)) {
   if (document.inputForm.cc_comments.value.length  250)
   {
 alert(The Comments must be less than 250 characters.\nIt is currently
 
 + document.inputForm.window_name.value.length +  characters.);
document.inputForm.window_name.focus();
return;
   }
  }
 
 
 
 ***Error: Object doesn't support this property or method.
 Code: 0***
  document.inputForm.submit();
 }
 
 //--
 /script
 
 
 
 On 2/8/07, T. Lensselink [EMAIL PROTECTED] wrote:

 There is nothing wrong with the way you want to submit this form.
 Although it's JS :) The sample code you posted was broken in some
 ways...

 missing document. in JS en missing input field to check.

 This sample works fine ...

 test.html

 script language=JavaScript
 function checkForm() {

 if (document.inputForm.cc_phone_number.value == ) {
alert( Please enter a phone number. );
document.inputForm.cc_phone_number.focus();
return;
 }

 document.inputForm.submit();
 }

 /script
 title/title
 LINK rel=stylesheet type=text/css href=../../CSS/background.css
 /head
 body
 div align=center
 h2/h2
 h3Submit a New Payment./h3
 /div

 form name=inputForm action=save.php method=post
 enctype=multipart/form-data
 input type=text name=cc_phone_number value=8756765756757 /
 table align=center border=0 cellpadding=0 cellspacing=0
 width=680
 tr
td width=64 align=lefta href=javascript:checkForm()
 title=SaveSave/a/td
td width=616 align=lefta href=javascript:closeThis()
 title=CloseClose/a/td
 /tr
 /table
 /form

 /body
 /html

 save.phhp

 ?php print_r($_POST); ?

 Think some other code or JS errors might stop the form from sending
 data.



 On Thu, 8 Feb 2007 09:09:34 -0500, Dan Shirah [EMAIL PROTECTED]
 wrote:
  Nope, same result unfortunately.
 
  On 2/8/07, Németh Zoltán [EMAIL PROTECTED] wrote:
 
  On cs, 2007-02-08 at 08:56 -0500, Dan Shirah wrote:
   Okay, I'll try your spacer solution.   Where do you think I should
 add
   it?
 
  I put it right before the /form tag, but I think you could put it
  anywhere between the form and the /form
 
  greets
  Zoltán Németh
 
  
   On 2/8/07, Németh Zoltán [EMAIL PROTECTED] wrote:
   On cs, 2007-02-08 at 08:41 -0500, Dan Shirah wrote:
I should not need an actual Button if my link to
 checkForm()
   ends with
document.inputForm.submit(); which tells the form to
 submit,
   right?
  
   well, you should be right...
   but I remember a year ago or so I had a similar problem and
   the image
   input solved it... but I'm not sure whether it was exactly
 the
   same
   problem or not, so it might be complete bullshit ;)
  
   greets
   Zoltán Németh
  
   
On 2/8/07, Németh Zoltán [EMAIL PROTECTED]
 wrote:
On cs, 2007-02-08 at 08:14 -0500, Dan Shirah
 wrote:
 Okay, I edited my page per some suggestions
   here.  Below is
what I now have:


 script language=JavaScript
 function checkForm() {

  // ** START **
   if (inputForm.cc_phone_number.value == ) {
 alert( Please enter a phone number. );
 inputForm.cc_phone_number.focus();
 return

Re: [PHP] is_dir reading a folder with a space in the name?

2007-02-08 Thread T . Lensselink
OS? PHP version?

Tested with PHP4 on Win and *nix : works 

On Thu, 08 Feb 2007 16:47:26 +0200, Angelo Zanetti [EMAIL PROTECTED] wrote:
 Hi All.
 
 
 I am reading directories and one of the directories has a space in it so
 when I run:
 
 if (is_dir($dir))
 
 
 it returns false. But I know the folder exists, so is there a way to
 force the read? Or what else should I do? rename it and then read it?
 
 Thanks in advance.
 
 
 --
 
 Angelo Zanetti
 Systems developer
 
 
 *Telephone:* +27 (021) 469 1052
 *Mobile:*   +27 (0) 72 441 3355
 *Fax:*+27 (0) 86 681 5885
 *
 Web:* http://www.zlogic.co.za
 *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 
 --
 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] is_dir reading a folder with a space in the name?

2007-02-08 Thread T . Lensselink
Like Roman said. I also don't see this behaviour.
Although my test is a lot more simple :)

?php
$dir = test dir;

if (is_dir($dir)) {
echo It's a dir :);
}
?

On Thu, 08 Feb 2007 17:24:33 +0200, Angelo Zanetti [EMAIL PROTECTED] wrote:
 its running on a linux server PHP 4.3.x
 
 What i mean is that the directory name has a space in it eg:
 srv/www/htdocs/site/Broker details/
 
 
 
 T.Lensselink wrote:
 
OS? PHP version?

Tested with PHP4 on Win and *nix : works

On Thu, 08 Feb 2007 16:47:26 +0200, Angelo Zanetti [EMAIL PROTECTED]
 wrote:


Hi All.


I am reading directories and one of the directories has a space in it so
when I run:

if (is_dir($dir))


it returns false. But I know the folder exists, so is there a way to
force the read? Or what else should I do? rename it and then read it?

Thanks in advance.


--

Angelo Zanetti
Systems developer


*Telephone:* +27 (021) 469 1052
*Mobile:*   +27 (0) 72 441 3355
*Fax:*+27 (0) 86 681 5885
*
Web:* http://www.zlogic.co.za
*E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]

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





 
 --
 
 Angelo Zanetti
 Systems developer
 
 
 *Telephone:* +27 (021) 469 1052
 *Mobile:*   +27 (0) 72 441 3355
 *Fax:*+27 (0) 86 681 5885
 *
 Web:* http://www.zlogic.co.za
 *E-Mail:* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
 
 --
 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] phpmyadmin mysql extensions

2007-01-18 Thread T . Lensselink
Move your dll's to C:\PHP\ext and restart apache... 

On Thu, 18 Jan 2007 10:20:23 -, Ross [EMAIL PROTECTED] wrote:
  did the following...
 
 -installed apache
 -installed php (C:\PHP) with the windows installer
 -moved my websites to the htdocs folder..so far so good can access pages
 - downlaoded php my admin to htdocs
 -downloaded the FULL php version
 -copied the extensions folder (C:\PHP\ext)
 -changd the line in php.ini
 
 extension_dir = C:\PHP\ext
 
 
 - the extensions in .ini look like this
 
 
 ;extension=php_mbstring.dll
 ;extension=php_bz2.dll
 ;extension=php_curl.dll
 ;extension=php_dba.dll
 ;extension=php_dbase.dll
 ;extension=php_exif.dll
 ;extension=php_fdf.dll
 ;extension=php_filepro.dll
 ;extension=php_gd2.dll
 ;extension=php_gettext.dll
 ;extension=php_ifx.dll
 ;extension=php_imap.dll
 ;extension=php_interbase.dll
 ;extension=php_ldap.dll
 ;extension=php_mcrypt.dll
 ;extension=php_mhash.dll
 ;extension=php_mime_magic.dll
 ;extension=php_ming.dll
 extension=php_mssql.dll
 extension=php_msql.dll
 extension=php_mysql.dll
 ;extension=php_oci8.dll
 ;extension=php_openssl.dll
 ;extension=php_oracle.dll
 ;extension=php_pgsql.dll
 ;extension=php_shmop.dll
 ;extension=php_snmp.dll
 ;extension=php_sockets.dll
 ;extension=php_sqlite.dll
 ;extension=php_sybase_ct.dll
 ;extension=php_tidy.dll
 ;extension=php_xmlrpc.dll
 ;extension=php_xsl.dll
 
 The .dll file is  in C:\PHP\ext\mysql
 
 
 Phpmyadmin cannot load I get the error  Cannot load mysql extension. 
 
 --
 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] Need help with RegEx

2006-12-11 Thread T . Lensselink
I'm no regex guru but something goes wrong here.

First of you miss the second parameter in preg_match

int preg_match ( string pattern, string subject [, array matches [, int flags 
[, int offset]]] )

If you need the text from two unique tags it should not be to hard:

$test = tag lang='ttt'THIS IS A TEST/tag;
preg_match(/tag lang='ttt'(.+?)\/tag/, $test, $matches);
print_r($matches);

Thijs

On Mon, 11 Dec 2006 02:02:46 -0600, Anthony Papillion [EMAIL PROTECTED] 
wrote:
 Hello Everyone,
 
 I am having a bit of problems wrapping my head around regular expressions.
 I
 thought I had a good grip on them but, for some reason, the expression
 I've
 created below simply doesn't work! Basically, I need to retreive all of
 the
 text between two unique and specific tags but I don't need the tag text.
 So
 let's say that the tag is
 
 tag lang='ttt'THIS IS A TEST/tag
 
 I would need to retreive THIS IS A TEST only and nothing else.
 
 Now, a bit more information: I am using cURL to retreive the entire
 contents
 of a webpage into a variable. I am then trying to perform the following
 regular expression on the retreived text:
 
 $trans_text = preg_match(\/div id=result_box dir=ltr(.+?)\/div/);
 
 The problem is that when I echo the value of $trans_text variable, I end
 up
 with the entire HTML of the page.
 
 Can anyone clue me in to what I am doing wrong?
 
 Thanks,
 Anthony
 
 --
 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] Fatal error: Call to a member function on a non-object

2006-12-07 Thread T . Lensselink
Not only that. think you are also passing the wrong parameters to the 
constructor.

On Thu, 07 Dec 2006 15:48:10 +1030, Ryan Creaser [EMAIL PROTECTED] wrote:
 
 XeRnOuS ThE wrote:

 First, if a fatal error is occurring on line 24, why is it executing
 line 24 successfully and returning data?
 Second, if there’s a fatal error on line 24, why is line 25 still
 processed?

 
 Maybe because you're running it twice? Line 41 with the $this-Auth( ...
 seems to be running the constructor again, it might be failing there?
 
 - rjc
 
 --
 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] recursive function problem

2006-12-07 Thread T . Lensselink
If you show some code maybe somebody on the list can help you.

On Thu, 7 Dec 2006 13:41:00 +0100, Sjef [EMAIL PROTECTED] wrote:
 Hello!
 I wrote a recursive function, but when running the function appache
 stalls,
 the error log says:
 
 module mod_php4.c is already running, skipping
 
 Is this a bug, or am I doing something wrong?
 
 Thanxs, Sjef
 
 --
 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] Reading and changing XML

2006-12-06 Thread T . Lensselink
If you want to do some simple XML handeling you could go for simpleXML : 
http://nl3.php.net/manual/en/ref.simplexml.php
For the more advanced XML handeling i would go for DOM : 
http://nl3.php.net/manual/en/ref.dom.php

On Wed, 6 Dec 2006 12:47:01 +0200, Rosen [EMAIL PROTECTED] wrote:
 Hi,
 I need some help. Which is the best way to parse XML file ( reading some
 fields ) and change some of them ?
 
 Thanks in advance,
 Rosen
 
 --
 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] Send emails from PHP ... in a secure way

2006-12-05 Thread T . Lensselink
You can store the emails in a database or textfile when an error occurs.
And use crontab to check the stored messages and send them to the mailserver.

On Tue, 05 Dec 2006 10:55:50 +0100, Ruben Rubio [EMAIL PROTECTED] wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1
 
 clive escribió:
 Ruben Rubio wrote:
 -BEGIN PGP SIGNED MESSAGE-
 Hash: SHA1

 the MTA then something is very wrong

 Why cant you save the email in a file or a database and then send it
 later your self?
 
 Because if Mail server has a problem like server is down, or is busy, or
 has too many concurrent connections ... it will reject temporary the
 email. But that the email sent from php application _NEVER_ will try to
 resend the email. Temporary problem, is an error for the log ... but the
 email is lost.
 
 In that case, It would be interesting save temporary the email in order
 to be able to resend it later.
 

 clive

 
 -BEGIN PGP SIGNATURE-
 Version: GnuPG v1.4.2.2 (GNU/Linux)
 Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
 
 iD8DBQFFdUImIo1XmbAXRboRAkajAJ92ziV90uB7A9SQwlq7HnCAq/eWBwCgqobh
 ie72JNl+RNjKq9V1TfweAJY=
 =XVCd
 -END PGP SIGNATURE-
 
 --
 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] Error with array and include

2006-12-05 Thread T . Lensselink
How can you use an array as string in the include statement and two lines lower 
as array?
Think it echo's 'S' because it see's $lang as a string and not an array.

On Tue, 05 Dec 2006 13:11:12 -0200, Fernando M. M. [EMAIL PROTECTED] wrote:
 Hi,
 
 I'm having a strange problem when trying to show a array after its value
 was defined on a file that was included. Something like this:
 
 ?php
 $lang = 'pt_BR';
 
 include('lang/'. $lang .'/login.php');
 
 echo $lang['Username'];
 ?
 
 On the file lang/pt_BR/login.php i have this...
 
 ?php
 $lang['Username'] = 'Usuário';
 ?
 
 But the result of the first script is 'S' (without quotes).
 
 If i change lang/pt_BR/login.php to
 
 ?php
 $lang['Username'] = 'Usuário';
 
 echo $lang['Username'];
 ?
 
 I get 'Usuário' (without quotes again).
 
 Why does this happens?
 
 Thanks,
 
 Fernando.
 
 --
 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] Sending E-mail

2006-12-04 Thread T . Lensselink
Without any error messages it will be hard to resolve..
Try to provide some more information about the problem.

On Mon, 04 Dec 2006 09:11:05 -0500, Janet Smith [EMAIL PROTECTED] wrote:
 We have an application using PHP. If users have forgotten their
 password, they click on the link 'Forgot Password' and enter this e-mail
 address. This is suppose to send their new password to the e-mail
 address provided. We can not get the e-mail to be sent. I have changed
 the php.ini file to include the SMTP, the sendmail_from and the
 sendmail_path. Does anyone have any suggestions as to what else I need
 to look at?
 
 Thanks
 
 Jan Smith
 Programmer Analyst
 Indiana State University
 Terre Haute, Indiana
 Phone: (812) 237-8593
 Email: [EMAIL PROTECTED]
 
 ***
 This email, and any attachments, thereto, is intended only for use by
 the addressee(s) named herein and may contain privileged and/or
 confidential information.  If you are not the intended recipient of this
 email, you are hereby notified that any dissemination, distribution or
 copying of this email, and any attachments thereto, is strictly
 prohibited.
 ***
 
 --
 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] hiding passwd in cmdlines that appear in the process list

2006-12-04 Thread T . Lensselink
Doesn't it show up on the phpinfo(); page under Environment when
using the putenv(); call?

On Mon, 04 Dec 2006 13:55:56 +0100, Jochem Maas [EMAIL PROTECTED] wrote:
 [EMAIL PROTECTED] wrote:
 If you did use ENV to set the username and password, you could always
 unset it using the same method after you ran the mysql command.  So it'd
 only be exposed for a very brief period of time and slightly less
 accessible than just running a process list.

 
 indeed I do the following directly after the relevant call to exec() :
 

 putenv('MYSQL_PLESK_PWD=doreallythinkIwouldleavethispwdfloatingaroundinashellenv?');
 
 It still falls under the category of security through obscurity which
 isn't a best practice scenario.  But I can't think of another way to run
 mysql under these circumstances that's any better.
 
 but given that the ENV var is only available to the shell php in currently
 running in (and any subshells) so
 the script is only vulnerable to mistakes/attacks from 'inside' the script
 - basically I'm assuming that
 whatever is stored in the ENV of a shell is not accessible/visible to
 other users on the given system.
 
 is that assumption correct?
 

 -TG

 = = = Original message = = =

 On Thu, November 30, 2006 12:29 pm, Edwin Barrios wrote:
 This is not triue because a shell vars declered on a shell is only
 exposed
 to its subshells, that means that only exec's and system functions
 calls
 into the php itself resive those vars declared into the php !

 You can see this argument in the following code

 ?php
   error_reporting(E_ALL);


   echo OLD pre;
   system(env);
   echo /pre;

   putenv(DBNAME=sidf);
   putenv(DBUSER=p);
   putenv(DBPASSWD=p);

   echo NEW pre;
   system(env);
   echo /pre;

 ?

 and reloading these a couple of times.

 My point was that somebody who was doing:
 system(env);
 in a different part of the script, to debug something else, will
 expose the password, probably without even realizing it.

 
 --
 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