Re: [PHP-DEV] cvs: php4 /main/main.c [[Re: [PHP-DEV] ErrorLog problem]]

2002-03-30 Thread Jan Pavlík

PHP 4.1.2 - it works fine. Sorry for my seek... It will be better to develop
it only for me. I really don't know, that some functions in C can't be
used

JP

Markus Fischer [EMAIL PROTECTED] píse v diskusním príspevku
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 4. It's not conditional and who says everthing likes it that
 way just becayse you want it that way? Hmm ...

 My opinion is this patch/method shouldn't be considered at
 all. First discuss implementation issues better...

 On Sat, Mar 30, 2002 at 12:56:11PM +0100, [EMAIL PROTECTED] wrote :
  Hello,
 
  1. this patch doesn't work with thread safety, 2. It doesn't use the PHP
  coding standards and 3. it uses GOTO. I don't think this should have
been
  committed at all.
 
  Derick
 
 
 
  On Sat, 30 Mar 2002, Jan Pavlík wrote:
 
   rootshell  Fri Mar 29 23:13:29 2002 CET
  
 Modified files:
/php4/main/main.c
 Log:
   lot of same errors are logged as one, cleans errorlog
  
  
  
   Index: php4/main/main.c
   diff -u php4/main/main.c:1.404.2.5 php4/main/main.c:1.404.2.6
   --- php4/main/main.c:1.404.2.5 Mon Dec 17 22:19:51 2001
   +++ php4/main/main.c Fri Mar 29 23:11:03 2002
   @@ -18,11 +18,12 @@
  
+--+
*/
  
   -/* $Id: main.c,v 1.404.2.5 2001/12/17 21:19:51 derick Exp $ */
   +/* $Id: main.c,v 1.404.2.6 2002/03/29 23:10:05 rootshell Exp $ */
  
/* {{{ includes
 */
#include stdio.h
   +#include string.h
#include php.h
#ifdef PHP_WIN32
#include win32/time.h
   @@ -83,6 +84,9 @@
PHPAPI int core_globals_id;
#endif
  
   +static char _err_buf[1024];
   +#define MAX_ERR_LENGTH (buffer_len  sizeof(_err_buf) ?
sizeof(_err_buf) :
   buffer_len)
   +
static void php_build_argv(char *s, zval *track_vars_array
TSRMLS_DC);
  
  
   @@ -417,6 +421,9 @@
   char *append_string = INI_STR(error_append_string);
   char *error_format;
  
   +   if(!strncmp(buffer, _err_buf, MAX_ERR_LENGTH)) goto _away;
   +   else strncpy(_err_buf, buffer, MAX_ERR_LENGTH);
   +
   error_format = PG(html_errors) ?
br\nb%s/b:  %s in b%s/b on line b%d/bbr\n
: \n%s: %s in %s on line %d\n;
   @@ -437,6 +444,7 @@
   if (append_string) {
PUTS(append_string);
   }
   +_away:
  }
#if ZEND_DEBUG
  {
  
  
  
  
  
  
  
   --
   PHP Development Mailing List http://www.php.net/
   To unsubscribe, visit: http://www.php.net/unsub.php
  
 
  ---
PHP: Scripting the Web - [EMAIL PROTECTED]
  All your branches are belong to me!
  SRM: Script Running Machine - www.vl-srm.net
  ---
 
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php

 --
 Please always Cc to me when replying to me on the lists.
 GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
 Mind if I MFH ? What QA did you do on it? the usual? ah... none :)



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




[PHP-DEV] ErrorLog problem

2002-03-29 Thread Jan Pavlík

Hi,
I have problems with logging events in PHP. When some user write example
script from PHP.NET:

$fd = fopen (/tmp/nonexists.txt, r);
while (!feof ($fd)) {
$buffer = fgets($fd, 4096);
echo $buffer;
}
fclose ($fd);

And when the file not exists, it run 30 seconds and the ended, but my
errorlog is full with one errormesage about nonexistent handler $fd Can
PHP log only first error and the next (the same, copy of the first) throw
out?

P.S. Sorry for my English :)
--
Jan PAVLIK
[EMAIL PROTECTED]
ICQ 6611951
ROOTSHELL.CZ - Make it easy and better!



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




Re: [PHP-DEV] ErrorLog problem

2002-03-29 Thread Jan Pavlík

I know it, but we're freewebhosting with 10.000 users... and when do users
it?

Sorry, I will write to general!

JP
- Original Message -
From: Markus Fischer [EMAIL PROTECTED]
To: Jan Pavlík [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Sent: Friday, March 29, 2002 10:18 AM
Subject: Re: [PHP-DEV] ErrorLog problem


 Your code is simply broken. You have to make sure $fd is a
 proper file handle before you try to use it:

 if ($fd = @fopen($filename, 'r')) {
   while(!feof($fd)) {
 ...
   }
   fclose($fd);
 }

 Btw, next time please ask on php-general@

 - Markus

 On Fri, Mar 29, 2002 at 08:47:27AM +0100, Jan Pavlík wrote :
  Hi,
  I have problems with logging events in PHP. When some user write example
  script from PHP.NET:
 
  $fd = fopen (/tmp/nonexists.txt, r);
  while (!feof ($fd)) {
  $buffer = fgets($fd, 4096);
  echo $buffer;
  }
  fclose ($fd);
 
  And when the file not exists, it run 30 seconds and the ended, but my
  errorlog is full with one errormesage about nonexistent handler $fd
Can
  PHP log only first error and the next (the same, copy of the first)
throw
  out?
 
  P.S. Sorry for my English :)
  --
  Jan PAVLIK
  [EMAIL PROTECTED]
  ICQ 6611951
  ROOTSHELL.CZ - Make it easy and better!
 
 
 
  --
  PHP Development Mailing List http://www.php.net/
  To unsubscribe, visit: http://www.php.net/unsub.php

 --
 Please always Cc to me when replying to me on the lists.
 GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc

 Mind if I MFH ? What QA did you do on it? the usual? ah... none :)



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




Re: [PHP-DEV] ErrorLog problem

2002-03-29 Thread Jan Pavlík

That not help to me ;)
I will rewrite PHP to log only ONE error when the next errors are the same.
But I ask only, PHP developers think, that will be better make it as
standart.

I will send the patch here for PHP 4.1.2...

JP

Markus Fischer [EMAIL PROTECTED] píse v diskusním príspevku
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Fri, Mar 29, 2002 at 10:30:18AM +0100, Jan Pavlík wrote :
  I know it, but we're freewebhosting with 10.000 users... and when do
users
  it?

 That's a general problem of vhosting and allowing user to
 write/execute arbitrary code if any kind of language.

 (I *have* a reason not being in that business ;-)

 - Markus

 --
 Please always Cc to me when replying to me on the lists.
 GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc

 Mind if I MFH ? What QA did you do on it? the usual? ah... none :)



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




Re: [PHP-DEV] ErrorLog problem

2002-03-29 Thread Jan Pavlík

Sure :)

JP

Markus Fischer [EMAIL PROTECTED] píse v diskusním príspevku
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 On Fri, Mar 29, 2002 at 10:43:17AM +0100, Jan Pavlík wrote :
  That not help to me ;)
  I will rewrite PHP to log only ONE error when the next errors are the
same.
  But I ask only, PHP developers think, that will be better make it as
  standart.
 
  I will send the patch here for PHP 4.1.2...

 Only against CVS head and only in unified diff please.

 --
 Please always Cc to me when replying to me on the lists.
 GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
 Mind if I MFH ? What QA did you do on it? the usual? ah... none :)



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




[PHP-DEV] cvs: php4 /main/main.c [[Re: [PHP-DEV] ErrorLog problem]]

2002-03-29 Thread Jan Pavlík

rootshell  Fri Mar 29 23:13:29 2002 CET

  Modified files:
 /php4/main/main.c
  Log:
lot of same errors are logged as one, cleans errorlog



Index: php4/main/main.c
diff -u php4/main/main.c:1.404.2.5 php4/main/main.c:1.404.2.6
--- php4/main/main.c:1.404.2.5 Mon Dec 17 22:19:51 2001
+++ php4/main/main.c Fri Mar 29 23:11:03 2002
 -18,11 +18,12 
+--+
 */

-/* $Id: main.c,v 1.404.2.5 2001/12/17 21:19:51 derick Exp $ */
+/* $Id: main.c,v 1.404.2.6 2002/03/29 23:10:05 rootshell Exp $ */

 /* {{{ includes
  */
 #include stdio.h
+#include string.h
 #include php.h
 #ifdef PHP_WIN32
 #include win32/time.h
 -83,6 +84,9 
 PHPAPI int core_globals_id;
 #endif

+static char _err_buf[1024];
+#define MAX_ERR_LENGTH (buffer_len  sizeof(_err_buf) ? sizeof(_err_buf) :
buffer_len)
+
 static void php_build_argv(char *s, zval *track_vars_array TSRMLS_DC);


 -417,6 +421,9 
char *append_string = INI_STR(error_append_string);
char *error_format;

+   if(!strncmp(buffer, _err_buf, MAX_ERR_LENGTH)) goto _away;
+   else strncpy(_err_buf, buffer, MAX_ERR_LENGTH);
+
error_format = PG(html_errors) ?
 br\nb%s/b:  %s in b%s/b on line b%d/bbr\n
 : \n%s: %s in %s on line %d\n;
 -437,6 +444,7 
if (append_string) {
 PUTS(append_string);
}
+_away:
   }
 #if ZEND_DEBUG
   {







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