Re: [PHP-DEV] Fix for bug 19207 (change of cgi behaviour in PHP 4.3.0)

2002-11-22 Thread Edin Kadribasic
On Friday 22 November 2002 04:18, Jani Taskinen wrote:
 I can't remember that discussion..but why do we need
 yet another ini option? If the current behaviour is incorrect,
 and you can fix it..why do you even ask here? :)

FYI:
http://www.phpbuilder.com/mail/php-developer-list/2002092/0238.php
http://bugs.php.net/bug.php?id=19207

Edin

P.S. I don't like adding ini setting either, but I see no other way of solving 
the issue.

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




Re: [PHP-DEV] Fix for bug 19207 (change of cgi behaviour in PHP4.3.0)

2002-11-22 Thread Jani Taskinen
On Fri, 22 Nov 2002, Edin Kadribasic wrote:

On Friday 22 November 2002 04:18, Jani Taskinen wrote:
 I can't remember that discussion..but why do we need
 yet another ini option? If the current behaviour is incorrect,
 and you can fix it..why do you even ask here? :)

FYI:
http://www.phpbuilder.com/mail/php-developer-list/2002092/0238.php
http://bugs.php.net/bug.php?id=19207

Edin

P.S. I don't like adding ini setting either, but I see no other way of solving 
the issue.


Ah, I see..well, as long as the current behaviour stays as
the default one, feel free to commit your changes. :)

--Jani



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




Re: [PHP-DEV] zend_API.c patch

2002-11-22 Thread Derick Rethans
On Thu, 21 Nov 2002, Marcus Börger wrote:

 In zend_API.c we do not initialize is_static for the registered function.
 Therefore sometime they are static and sometimes not. We must
 make those non static or provide the information in the call. Non static
 is required for things like ext/domxml.

Committed.

Derick

-- 

---
 Derick Rethans   http://derickrethans.nl/ 
 JDI Media Solutions
--[ if you hold a unix shell to your ear, do you hear the c? ]-


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




[PHP-DEV] when will php5 rc be out?

2002-11-22 Thread Crispin Fütterer
we are planning to rewrite our system completely from the scratch and for
that it would be very useful to know when you are going to release the first
version of php5.

is there any announcement or some rumors about a rc?




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




RE: [PHP-DEV] [PATCH] Redirect on Error

2002-11-22 Thread James Aylett
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On

What is so hard to understand in word 'FATAL'?
If your script doesn't work, what use is it to make it
show the cryptic 500 error??

I'm -10 for adding anything like this, even if and
even more then if it's optional.

Returning a 500 is one of the easiest ways to automatically audit of fatal
problems in your script, because it is (usually) pretty trivial to grab such
status codes out of the access log. This is incredibly useful in build and
test environments (we have automated processes trawling the logs on our dev,
stage and production servers looking for problems). Indeed, you could go a
step further with an ISAPI or Apache custom error handler (and presumably
NSAPI, which I don't have experience of) to have immediate notification
(useful if you've got a bunch of non-technical people testing out an
interface).

From a user point of view, you can return an entity (say, an HTML page) with
a 500 error. Yes, this requires output buffering, but since this is all
being mooted as an optional variant on error handling, that really shouldn't
be counted against it. From the point of view of a non-human agent accessing
such a page, you really /should/ return 500 so it's obvious that the request
wasn't serviced properly. Returning an unparseable mess of pseudo-HTML
really isn't useful in that many circumstances.

I'm not qualified to comment on how feasible this sort of thing is for PHP,
especially on all the SAPIs it supports, but as a user of PHP it is an
option I'd be interested in.

Cheers,
James
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.370 / Virus Database: 205 - Release Date: 05/06/2002



This e-mail has been scanned for all viruses by Star Internet. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk


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




Re: [PHP-DEV] when will php5 rc be out?

2002-11-22 Thread Derick Rethans
On Fri, 22 Nov 2002, Crispin Fütterer wrote:

 we are planning to rewrite our system completely from the scratch and for
 that it would be very useful to know when you are going to release the first
 version of php5.

When it's ready :)

 is there any announcement or some rumors about a rc?

No, not at all. It's even possible that there will be a PHP 4.4 between 
PHP 4.3 and PHP 5. 

Derick

-- 

---
 Derick Rethans   http://derickrethans.nl/ 
 JDI Media Solutions
--[ if you hold a unix shell to your ear, do you hear the c? ]-


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




Re: [PHP-DEV] [PATCH] Redirect on Error

2002-11-22 Thread Melvyn Sopacua
At 00:42 11/22/2002 +0200, Jani Taskinen wrote:


  What is so hard to understand in word 'FATAL'?


Fatal what? [1]


  If your script doesn't work, what use is it to make it
   show the cryptic 500 error??


+1 on that.

Let's concentrate on the issue:
parse errors belong in 'lint'.
I still think it should be a function, because not only can one verify 
files, before
'include', but also uploaded php scripts, in some kind of WebDav/CMS 
environment.

[1] The annoying thing is that FATAL errors can't be handled by an error 
handler
and can have numerous causes. Same annoying thing as resource temporarily
unavailable in CGI environments I'm tracking down at the moment.

I don't like the 500 way either, because you simply loose the entire 
environment
the bug occured in.


Met vriendelijke groeten / With kind regards,

Webmaster IDG.nl
Melvyn Sopacua

@Logan I spent a minute looking at my own code by accident.
@Logan I was thinking What the hell is this guy doing?


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



[PHP-DEV] [PATCH] New function file_put_contents()

2002-11-22 Thread Christian Schneider
Ok, I try again to submit the patch and a test script for it :-)

Prototype:
int file_put_contents(string filename, mixed data [, string mode])

It takes a filename (URL wrappers supported), the data to be written and 
a mode for the file. The data can be either a string or an array (which 
is like using join(, $data) first and can be used to write data read 
by the file() function). The mode can be a or ab to append to a file 
and defaults to wb. The function returns the number of bytes written 
to the stream.

- Chris
Index: ext/standard/basic_functions.c
===
RCS file: /repository/php4/ext/standard/basic_functions.c,v
retrieving revision 1.528
diff -u -r1.528 basic_functions.c
--- ext/standard/basic_functions.c  6 Oct 2002 17:04:10 -   1.528
+++ ext/standard/basic_functions.c  16 Oct 2002 01:48:48 -
@@ -625,6 +625,7 @@
PHP_STATIC_FE(tmpfile,php_if_tmpfile,
 NULL)
PHP_FE(file,   
 NULL)
PHP_FE(file_get_contents,  
 NULL)
+   PHP_FE(file_put_contents,  
+ NULL)
PHP_FE(stream_select, 
first_through_third_args_force_ref)
PHP_FE(stream_context_create,  
 NULL)
PHP_FE(stream_context_set_params,  
 NULL)
Index: ext/standard/file.c
===
RCS file: /repository/php4/ext/standard/file.c,v
retrieving revision 1.270
diff -u -r1.270 file.c
--- ext/standard/file.c 15 Oct 2002 16:45:26 -  1.270
+++ ext/standard/file.c 16 Oct 2002 01:48:49 -
@@ -452,6 +452,79 @@
 }
 /* }}} */
 
+/* {{{ proto int file_put_contents(string filename, mixed data [, string mode])
+   Write an entire string or array to a file and return length written */
+PHP_FUNCTION(file_put_contents)
+{
+   size_t ret = 0;
+   char *filename;
+   int filename_len;
+   char *data = NULL;
+   int data_len;
+   zval *arr = NULL;
+   char *mode = wb;
+   int mode_len;
+   HashPosition pos;
+   zval **tmp = NULL;
+   php_stream *stream;
+
+   /* Parse arguments */
+   if ((zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() 
+TSRMLS_CC, ss|s,
+ filename, 
+filename_len, data, data_len, mode, mode_len) == FAILURE) 
+   (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, sa|s,
+   filename, filename_len, arr, mode, mode_len) == 
+FAILURE)) {
+   return;
+   }
+
+   stream = php_stream_open_wrapper(filename, mode,
+   ENFORCE_SAFE_MODE | REPORT_ERRORS,
+   NULL);
+   if (!stream) {
+   RETURN_FALSE;
+   }
+
+   if (arr) {
+   zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(arr), pos);
+
+   if (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void **)tmp, 
+pos) == SUCCESS) {
+   convert_to_string_ex(tmp);
+   data = Z_STRVAL_PP(tmp);
+   data_len = Z_STRLEN_PP(tmp);
+   }
+   }
+
+   while (data) {
+   char *buffer = NULL;
+
+   if (PG(magic_quotes_runtime)) {
+   buffer = estrndup(data, data_len);
+   php_stripslashes(buffer, data_len TSRMLS_CC);
+   }
+
+   ret += php_stream_write(stream, buffer ? buffer : data, data_len);
+   if (buffer) {
+   efree(buffer);
+   }
+
+   data = NULL;
+
+   if (arr) {
+   zend_hash_move_forward_ex(Z_ARRVAL_P(arr), pos);
+
+   if (zend_hash_get_current_data_ex(Z_ARRVAL_P(arr), (void 
+**)tmp, pos) == SUCCESS) {
+   convert_to_string_ex(tmp);
+   data = Z_STRVAL_PP(tmp);
+   data_len = Z_STRLEN_PP(tmp);
+   }
+   }
+   }
+
+   php_stream_close(stream);
+
+   RETURN_LONG(ret);
+}
+/* }}} */
+
 /* {{{ proto array file(string filename [, bool use_include_path])
Read entire file into an array */
 
Index: ext/standard/file.h
===
RCS file: /repository/php4/ext/standard/file.h,v
retrieving revision 1.70
diff -u -r1.70 file.h
--- ext/standard/file.h 28 Sep 2002 

Re: [PHP-DEV] ZE2 + F3P

2002-11-22 Thread Marcus Börger
At 03:59 22.11.2002, Marcus Börger wrote:

In the following link you will find final, public, protected and private 
(f + 3p) for ZE2:
http://marcus-boerger.de/php/ext/ze2/

What it does:

(...)

- 'speed guys' continued: during compile time (zend_compile.c)


Forgot to complete this section :-)

In function Zend/zend_compile.c/zend_do_inheritance() where functions are 
inherited i added
additional checks. The old code simple merged the hash tables. I added:
1) for each inherited method: 1*call + 1*comparision + 1*ored_assignment + 
1 jump
2) for each overloaded method: 1*call + 3 check blocks
Without errors these blocks do:
2 assignments + 3*jump + 3*test + 3*logical_op
+ optional: 3*test + 1*logical_op + 3*jumps
+ optional: 1* logical_op + 1*ored_assignment

For an *optimizing* compiler and an Intel CPU  PII each number above 
result in one single instruction.
But you will have to add the stack frames for the calls and assignments 
require more operations than one
operation.

Above countings are without guarantee because i simply counted what i would 
expect from expirience

Optional means when using 3p in certain situations. In other words when not 
using 3p those are
not executed so i guess the overhead is acceptable.




(...)
- i store abstract in fn_flags to disallow overloading a method with an 
abstract method. There is no
  further change in abstract.

By storing abstract in fn_flags we can have is_abstract($obj). The 
current implementation does not
allow this check.



(...)

What's left:

- create a global scope with a name that can be referred by the error 
message. Not doing this will
  either result in errors when working with dynaming function call by 
name (i guess so) or we have
  to check or skip class/namespace names in error messages.


The easiest way would be to avoid problems in error messages would be to 
use a define
#define SCOPE_NAME(scope) (scope ? scope-name : )



(...)
- more than i know yet - i guess :-)


is_abstract($obj_or_class_or_method)
is_final($obj_or_class_or_method)
is_private($method)
is_protected($method)
is_public($method)

But those are easy to implement :-)

marcus


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




[PHP-DEV] Re: Problem with a php function

2002-11-22 Thread Maxim Maletsky

Mike,

I am not really the person to ask about the parse_ini_file functionality.
I remind, though, that just the other day there was something discussed
on PHP-DEV list regarding it.

Therefore, I CC this mail to the DEV list hoping there is any interest
regarding your problem. Chances are it is a bug of some kind.

--
Maxim Maletsky
[EMAIL PROTECTED]



Mike [EMAIL PROTECTED] wrote... :

 Hi,
 
 I have a question to you.
 I use a function named parse_ini_file but I think this is perhaps bugged
 let me explain to you :
 
 I have a spool directory , I put in file with .txt extension .
 My script despool the directory and rename the .txt to .ini
 After I use parse_ini_file() to parse the file and get all information
 
 Something (lot of time) parse_ini_file()  give a array empty !
 But there are something in my file ( perhaps I try it on the same file)
 
 So I use strace to see what happens with it  and I get this :
 
 1037980915.096081 ioctl(8, TCGETS, 0xbfffce9c) = -1 ENOTTY (Inappropriate
 ioctl for device) 0.10
 1037980915.096165 read(8,
 \0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
 0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
 0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
 0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\
 0\0\0\0\0\0, 8192) = 157 0.31
 1037980915.096529 read(8, , 8035) = 0 0.09
 1037980915.097249 read(8, , 8192) = 0 0.09
 1037980915.097325 ioctl(8, TCGETS, 0xbfffc338) = -1 ENOTTY (Inappropriate
 ioctl for device) 0.09
 1037980915.097395 close(8)  = 0 0.11
 
 You can seen that parse_ini_file()  use ioctl() but this function is not
 appropriate for this utilisation.
 
 cf man ioctl :
 
 ENOTTY d error is :  is  not  associated  with  a  character  special
 device.
 
 
 
 and sometimes the ioctl function return -1 code and nothing in the array .
 So I ask me why coder have been used ioctl and why the coder don't get
 the -1 error and put a php warning or other thing.
 
 Can you foward this mail to the parse_ini_file()  coder and telle him to
 contact me to say me if I m in the wrong way ?
 
 
 Best regards,
 
 
 Michaël F.
 
 WEB / PHP Developer.
 Mobileway
 (+33) 1 41 44 46 21
  [EMAIL PROTECTED]
 
 
 
 
 
 
 
 
 
 
 
 


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




[PHP-DEV] readfile() suggestion

2002-11-22 Thread Steve Alberty

Hi,

i've a small suggestion to improve the behavior of the readfile() 
function.

First, since the command use the php streams, sometimes php crashes,
especially with big files (10MB).

Also, if you output a file with readfile(), the memory consumption is
excacly the same as the reading file.

I using the readfile command to deliver files with a typical
content-disposition header, but since i have some 'big' files, i've
change the delivering to this small code:

?php
$filename='megafile.txt';

$fh=fopen($filename, 'rb');
if ($fh!=false){
while (!feof($fh)  !connection_aborted()) echo fread ($fh, 
8192);
fclose($fh);
}
?

On a 2 MB file, this script needs 35KB (test is with a php_memory log)
and the readfile version needs 2MB.

I think it is also possible to reduce the memory consume in the
readfile() command, because it is not required to read the complete
file first and than output it.

The problem is in the php_stream_passthru function. We need a
sapi_flush(TSRMLS_C) or php_end_ob_buffer(1, 1 TSRMLS_CC) call.

Not only the readfile command is affected, also the gzpassthru command.

Any comments?

Best regards,

Steve

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




[PHP-DEV] Patch for gd.c

2002-11-22 Thread Moriyoshi Koizumi
Hi,

This tiny patch prevents the warnings when applying imagecolordeallocate() 
on true colour values. I suppose this new behaviour would be more 
consistent because we can use imagecolorallocate() with true colour images.

Then what do you guys think about this issue?

Moriyoshi


Index: ext/gd/gd.c
===
RCS file: /repository/php4/ext/gd/gd.c,v
retrieving revision 1.223
diff -u -r1.223 gd.c
--- ext/gd/gd.c 14 Nov 2002 15:09:53 -  1.223
+++ ext/gd/gd.c 22 Nov 2002 20:59:19 -
@@ -1874,6 +1874,11 @@
gdImageColorDeallocate(im, col);
RETURN_TRUE;
} else {
+#if HAVE_LIBGD20
+   if (gdImageTrueColor(im)) {
+   RETURN_TRUE;
+   }
+#endif 
php_error_docref(NULL TSRMLS_CC, E_WARNING, Color index %d out of 
range,  col);
RETURN_FALSE;
}

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


[PHP-DEV] php4.3 and zend2

2002-11-22 Thread michel 'ziobudda' morelli
Hi, and sorry for the question: I have lost the cvs string to get last
php4-dev with ze2. Does some1 give me it ?

tnx and sorry.

--
Michel ZioBudda Morelli   [EMAIL PROTECTED]

ICQ UIN: 58351764   PR of Linux in Italy
http://www.ziobudda.net http://www.phpdev.it


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




Re: [PHP-DEV] php4.3 and zend2

2002-11-22 Thread Derick Rethans
On 22 Nov 2002, michel 'ziobudda' morelli wrote:

 Hi, and sorry for the question: I have lost the cvs string to get last
 php4-dev with ze2. Does some1 give me it ?

cvs -d :pserver:[EMAIL PROTECTED]:/repository co php4-ze2

Derick

-- 

---
 Derick Rethans   http://derickrethans.nl/ 
 JDI Media Solutions
--[ if you hold a unix shell to your ear, do you hear the c? ]-


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




[PHP-DEV] I need to search in my files

2002-11-22 Thread William Stark
Hi everyone,
I need to search for a string in all the html files of a directory.
The problem is that i have to program this to be multi-plattform, so i cant
use linux commands.
I cant find any PHP native function to do this easily.
What can i do?
I thought about going like this...
/*read all files to an array*/

foreach($files as $file)
{
$fp=fopen($file,filesize);
$file_string=fread($fp,filesize);

/*search for the string in $file_string*/

if found {return xxx; exit;}
fclose($file);
}

but i dont like this... it sounds slow and not proffessional...
any ideas?

Thank u all.
William Stark



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




Re: [PHP-DEV] I need to search in my files

2002-11-22 Thread Derick Rethans
On Fri, 22 Nov 2002, William Stark wrote:

 Hi everyone,
 I need to search for a string in all the html files of a directory.
 The problem is that i have to program this to be multi-plattform, so i cant
 use linux commands.
 I cant find any PHP native function to do this easily.
 What can i do?
 I thought about going like this...
 /*read all files to an array*/
 
 foreach($files as $file)
 {
 $fp=fopen($file,filesize);
 $file_string=fread($fp,filesize);
 
 /*search for the string in $file_string*/
 
 if found {return xxx; exit;}
 fclose($file);
 }
 
 but i dont like this... it sounds slow and not proffessional...
 any ideas?

php.net/glob, but this list is not for support questions, you can better 
ask those on the [EMAIL PROTECTED] mailinglist.

Derick

-- 

---
 Derick Rethans   http://derickrethans.nl/ 
 JDI Media Solutions
--[ if you hold a unix shell to your ear, do you hear the c? ]-


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




[PHP-DEV] PHP Magick version 0.4a Released!

2002-11-22 Thread Michael Montero
Just released the next version of magick, the PHP ImageMagick extension.  
It's now available as this URL:

http://magick.communityconnect.com/

Here are the latest changes:

o functions added:
magick_writeimages()
magick_destroyhandle()
magick_image2blob()
magick_drawarc()
magick_drawcircle()
magick_drawpoint()
magick_border()
magick_frame()
magick_raise()
magick_getwidth()
magick_getheight()
magick_getmimetype()
magick_setfillcolor()
magick_setfontface()
magick_charcoal()
magick_implode()
magick_oilpaint()
magick_solarize()
magick_swirl()
magick_wave()
o more preparation for image lists
o fixed incorrect comments in some examples
o fixed incorrect calls to magick_failedreason() and
  magick_faileddescription() in most examples
o a number of examples weren't exiting properly on errors,
  that's been fixed
o phpinfo() now displays available font family and font names
o coolest function so far: magick_oilpaint().  The output is
  awesome!
o added MaxRGB to phpinfo() section

Got through quite a few things today.  Shooting for beta release by the 
end of next week.


-- 
Michael C. Montero
Chief Technology Officer
Community Connect Inc. Co-founder
[EMAIL PROTECTED]

-=-=-=-=-=  Community Connect Inc.  -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

The Premier Source of Interactive Online Communities149 Fifth Avenue
http://www.CommunityConnectInc.com/ New York, NY 10010

http://www.AsianAvenue.com/ http://www.BlackPlanet.com/
Click into Asian AmericaThe World Is Yours

http://www.MiGente.com/ http://www.DiversityJobMarket.com/
The Power of LatinosIn partnership with The New
York Times

-  Your Message May Appear Below This Line



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




[PHP-DEV] [PATCH] Fix to dns_get_record

2002-11-22 Thread Pollita
Thanks for your modifications to dns_get_record Marcus, but an extra
change or two needs to be throw in to get it working just right.  Here's a
tiny patch to avoid inserting random values as subarrays (leading to a
segfault) and properly dispose of resolv resources between queries.

Trouble is, the function as I had it WOULDN'T get unexpected records (see
this shouldn't happen comment), but your changes made that a possibility
and allowed php_parserr to return without ever properly setting *subarray.

It dosen't help that the unexpected condition wasn't dealing with it's
potentiality right to begin with... :)

-Pollita


Index: dns.c
===
RCS file: /repository/php4/ext/standard/dns.c,v
retrieving revision 1.45
diff -u -r1.45 dns.c
--- dns.c   19 Nov 2002 02:34:13 -  1.45
+++ dns.c   22 Nov 2002 22:14:34 -
@@ -331,8 +331,9 @@
GETLONG(ttl, cp);
GETSHORT(dlen, cp);
if (type_to_fetch != T_ANY  type != type_to_fetch) {
-   /* Should never actually occour */
-   return NULL;
+   *subarray = NULL;
+   cp += dlen;
+   return cp;
}

if (!store) {
@@ -576,6 +577,7 @@

zend_hash_next_index_insert(HASH_OF(return_value), (void
*)subarray[current_subarray], sizeof(zval *), NULL);
current_subarray++;
}
+   res_nclose(res);
}
}




Index: dns.c
===
RCS file: /repository/php4/ext/standard/dns.c,v
retrieving revision 1.45
diff -u -r1.45 dns.c
--- dns.c   19 Nov 2002 02:34:13 -  1.45
+++ dns.c   22 Nov 2002 22:14:34 -
@@ -331,8 +331,9 @@
GETLONG(ttl, cp);
GETSHORT(dlen, cp);
if (type_to_fetch != T_ANY  type != type_to_fetch) {
-   /* Should never actually occour */
-   return NULL;
+   *subarray = NULL;
+   cp += dlen;
+   return cp;
}
 
if (!store) {
@@ -576,6 +577,7 @@

zend_hash_next_index_insert(HASH_OF(return_value), (void 
*)subarray[current_subarray], sizeof(zval *), NULL);
current_subarray++;
}
+   res_nclose(res);
}
}
 


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


[PHP-DEV] CVS Account Request: bar3

2002-11-22 Thread bar3
hloo

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




Re: [PHP-DEV] Patch for gd.c

2002-11-22 Thread Rasmus Lerdorf
I have committed this, sort of anyway.  I moved the check up as there is
really no reason to go through and even try to do the deallocate on a
truecolour image.

-Rasmus

On Sat, 23 Nov 2002, Moriyoshi Koizumi wrote:

 Hi,

 This tiny patch prevents the warnings when applying imagecolordeallocate()
 on true colour values. I suppose this new behaviour would be more
 consistent because we can use imagecolorallocate() with true colour images.

 Then what do you guys think about this issue?

 Moriyoshi




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




RE: [PHP-DEV] PHP 4.3 ToDo

2002-11-22 Thread Steven Roussey

Georg,

That sounds great. There was a memory leak fix in that function for some
users of unbuffered queries that you might want to leave in. I propose
the following function which is also a placeholder/reminder for the
future:


/* {{{ _restore_connection_defaults
 */
static int _restore_connection_defaults(zend_rsrc_list_entry *rsrc
TSRMLS_DC)
{
php_mysql_conn *link;

/* check if its a persistent link */
if (Z_TYPE_P(rsrc) != le_plink) 
return 0;

link = (php_mysql_conn *) rsrc-ptr;

/* Find the active result set and free it */
if (link-active_result_id) {
int type;
MYSQL_RES *mysql_result;

mysql_result = (MYSQL_RES *)
zend_list_find(link-active_result_id, type);
if (mysql_result  type==le_result) {
zend_list_delete(link-active_result_id);
link-active_result_id = 0;
}
}

/* reset the persistent connection */
/*mysql_reset_connection(link-conn) -- TODO */
/*   - not yet available in mysqllib */
/*   - needed for bug #12513 */
return 0;   
}
/* }}} */


PHP_RSHUTDOWN_FUNCTION(mysql) 
{
zend_hash_apply(EG(persistent_list),
(apply_func_t)_restore_connection_defaults TSRMLS_CC);

...

I don't use unbuffered queries, so I really don't care either way. But
in my haste to get rid of that function, I don't want to be responsible
for the removal of other unrelated fixes.

Sincerely,
Steven Roussey
http://Network54.com/ 


 -Original Message-
 From: Georg Richter [mailto:[EMAIL PROTECTED]]
 On Thursday 14 November 2002 19:58, Steven Roussey wrote:
  Personally, I'd like to see the MySQL extension work again.
 
  The issue: persistent connections are broken when used heavily.
 
  Simple fix: _restore_connection_defaults() can be eliminated until
fixed
  properly.
 
 As discussed with Derick and Zak we will remove this stuff and wait
until
 a
 resolution inside the api is available (new api-function:
 mysql_reset_connection). To unset all these things (and we can't unset
 all)
 needs more time than to establish a new connection.
 
 Additionally we should add some warnings into the mysql_pconnect
chapter.
 
 Regards
 
 Georg


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




[PHP-DEV] CVS Account Request: egnited

2002-11-22 Thread Richard Udovich
I am developing a graph creation module for PEAR, QUICKGRAPH for which i already have 
an account with pear but i belive i need also a cvs account.

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




Re: [PHP-DEV] [PATCH] Fix to dns_get_record

2002-11-22 Thread Marcus Börger
Don't you have a cvs account right now to apply that yourself?

marcus

At 23:50 22.11.2002, Pollita wrote:

Thanks for your modifications to dns_get_record Marcus, but an extra
change or two needs to be throw in to get it working just right.  Here's a
tiny patch to avoid inserting random values as subarrays (leading to a
segfault) and properly dispose of resolv resources between queries.

Trouble is, the function as I had it WOULDN'T get unexpected records (see
this shouldn't happen comment), but your changes made that a possibility
and allowed php_parserr to return without ever properly setting *subarray.

It dosen't help that the unexpected condition wasn't dealing with it's
potentiality right to begin with... :)

-Pollita


Index: dns.c
===
RCS file: /repository/php4/ext/standard/dns.c,v
retrieving revision 1.45
diff -u -r1.45 dns.c
--- dns.c   19 Nov 2002 02:34:13 -  1.45
+++ dns.c   22 Nov 2002 22:14:34 -
@@ -331,8 +331,9 @@
GETLONG(ttl, cp);
GETSHORT(dlen, cp);
if (type_to_fetch != T_ANY  type != type_to_fetch) {
-   /* Should never actually occour */
-   return NULL;
+   *subarray = NULL;
+   cp += dlen;
+   return cp;
}

if (!store) {
@@ -576,6 +577,7 @@

zend_hash_next_index_insert(HASH_OF(return_value), (void
*)subarray[current_subarray], sizeof(zval *), NULL);
current_subarray++;
}
+   res_nclose(res);
}
}




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



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




[PHP-DEV] Re: [PHP-CVS] cvs: php4 /main streams.c

2002-11-22 Thread Marcus Börger
I thought there was another error somewhere but it seems it
was the efree and then requesting the memory. Without the
patch i simply got *RECURSION* out of php. Anybody able
to explain this?

marcus

At 02:24 23.11.2002, Marcus Boerger wrote:

helly   Fri Nov 22 20:24:08 2002 EDT

  Modified files:
/php4/main  streams.c
  Log:
  MFB: Fix memleak in debug mode


Index: php4/main/streams.c
diff -u php4/main/streams.c:1.130 php4/main/streams.c:1.131
--- php4/main/streams.c:1.130   Mon Nov 18 12:23:21 2002
+++ php4/main/streams.c Fri Nov 22 20:24:08 2002
@@ -20,7 +20,7 @@
+--+
  */

-/* $Id: streams.c,v 1.130 2002/11/18 17:23:21 helly Exp $ */
+/* $Id: streams.c,v 1.131 2002/11/23 01:24:08 helly Exp $ */

 #define _GNU_SOURCE
 #include php.h
@@ -2317,7 +2317,7 @@
return stream;
case PHP_STREAM_RELEASED:
 #if ZEND_DEBUG
-   newstream-__orig_path = copy_of_path;
+   newstream-__orig_path = 
estrdup(copy_of_path);
 #endif
return newstream;
default:



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


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




Re: [PHP-DEV] [PATCH] Fix to dns_get_record

2002-11-22 Thread Sara
Wasn't aware I had the karma to make commits yet.  I'm also the type to
tread lightly being new to this sandbox.  Patch is applied along with
documentation in phpdoc.

Thanks again.

 Don't you have a cvs account right now to apply that yourself?

 marcus

 At 23:50 22.11.2002, Pollita wrote:
Thanks for your modifications to dns_get_record Marcus, but an extra
 change or two needs to be throw in to get it working just right.
 Here's a tiny patch to avoid inserting random values as subarrays
 (leading to a segfault) and properly dispose of resolv resources
 between queries.

Trouble is, the function as I had it WOULDN'T get unexpected records
 (see this shouldn't happen comment), but your changes made that a
 possibility and allowed php_parserr to return without ever properly
 setting *subarray.

It dosen't help that the unexpected condition wasn't dealing with
 it's potentiality right to begin with... :)

-Pollita


Index: dns.c
=== RCS
 file: /repository/php4/ext/standard/dns.c,v
retrieving revision 1.45
diff -u -r1.45 dns.c
--- dns.c   19 Nov 2002 02:34:13 -  1.45
+++ dns.c   22 Nov 2002 22:14:34 -
@@ -331,8 +331,9 @@
 GETLONG(ttl, cp);
 GETSHORT(dlen, cp);
 if (type_to_fetch != T_ANY  type != type_to_fetch) {
-   /* Should never actually occour */
-   return NULL;
+   *subarray = NULL;
+   cp += dlen;
+   return cp;
 }

 if (!store) {
@@ -576,6 +577,7 @@

zend_hash_next_index_insert(HASH_OF(return_value), (void
*)subarray[current_subarray], sizeof(zval *), NULL);
 current_subarray++;
 }
+   res_nclose(res);
 }
 }




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




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




Re: [PHP-DEV] Patch for gd.c

2002-11-22 Thread Moriyoshi Koizumi
Thanks!

Moriyoshi

Rasmus Lerdorf [EMAIL PROTECTED] wrote:

 I have committed this, sort of anyway.  I moved the check up as there is
 really no reason to go through and even try to do the deallocate on a
 truecolour image.
 
 -Rasmus
 
 On Sat, 23 Nov 2002, Moriyoshi Koizumi wrote:
 
  Hi,
 
  This tiny patch prevents the warnings when applying imagecolordeallocate()
  on true colour values. I suppose this new behaviour would be more
  consistent because we can use imagecolorallocate() with true colour images.
 
  Then what do you guys think about this issue?
 
  Moriyoshi
 
 
 
 
 -- 
 PHP Development Mailing List http://www.php.net/
 To unsubscribe, visit: http://www.php.net/unsub.php
 


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




[PHP-DEV] Patch for range()

2002-11-22 Thread Moriyoshi Koizumi
Hi,

I've just found range() behaves unexpectedly in some special cases.

For instance, please try the following script.

?php
echo count(range('a', 'z', 12));
?

will give 45 while it should return an array that consists of 3 elements. 
That is because the counting may exceed the upper limit of positive char 
value during the loop.

The attached patch is a fix for this issue. I'll commit this if there are 
no objections.

Moriyoshi


Index: ext/standard/array.c
===
RCS file: /repository/php4/ext/standard/array.c,v
retrieving revision 1.201
diff -u -r1.201 array.c
--- ext/standard/array.c15 Nov 2002 02:16:41 -  1.201
+++ ext/standard/array.c23 Nov 2002 06:20:16 -
@@ -1435,19 +1435,29 @@
 
/* If the range is given as strings, generate an array of characters. */
if (Z_TYPE_P(zlow) == IS_STRING  Z_TYPE_P(zhigh) == IS_STRING) {
-   char *low, *high;
+   unsigned char *low, *high;
 
convert_to_string_ex(zlow);
convert_to_string_ex(zhigh);
-   low = Z_STRVAL_P(zlow);
-   high = Z_STRVAL_P(zhigh);
+   low = (unsigned char *)Z_STRVAL_P(zlow);
+   high = (unsigned char *)Z_STRVAL_P(zhigh);
 
if (*low  *high) { /* Negative steps */
-   for (; *low = *high; (*low) -= step) {
+   if (*low - *high  step || step  0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, step 
+exceeds the specified range);
+   zval_dtor(return_value);
+   RETURN_FALSE;
+   }
+   for (; *low = *high; (*low) -= (unsigned int)step) {
add_next_index_stringl(return_value, low, 1, 1);
}
} else {/* Positive steps */
-   for (; *low = *high; (*low) += step) {
+   if (*high - *low  step || step  0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, step 
+exceeds the specified range);
+   zval_dtor(return_value);
+   RETURN_FALSE;
+   }
+   for (; *low = *high; (*low) += (unsigned int)step) {
add_next_index_stringl(return_value, low, 1, 1);
}
}
@@ -1460,10 +1470,20 @@
high = Z_LVAL_P(zhigh);
 
if (low  high) {   /* Negative steps */
+   if (low - high  step || step  0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, step 
+exceeds the specified range);
+   zval_dtor(return_value);
+   RETURN_FALSE;
+   }
for (; low = high; low -= step) {
add_next_index_long(return_value, low);
}   
} else {/* Positive steps */
+   if (high - low  step || step  0) {
+   php_error_docref(NULL TSRMLS_CC, E_WARNING, step 
+exceeds the specified range);
+   zval_dtor(return_value);
+   RETURN_FALSE;
+   }
for (; low = high; low += step) {
add_next_index_long(return_value, low);
}   

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


Re: [PHP-DEV] Patch for range()

2002-11-22 Thread Jon Parise
On Sat, Nov 23, 2002 at 03:37:29PM +0900, Moriyoshi Koizumi wrote:

 I've just found range() behaves unexpectedly in some special cases.
 
 For instance, please try the following script.
 
 ?php
 echo count(range('a', 'z', 12));
 ?
 
 will give 45 while it should return an array that consists of 3 elements. 
 That is because the counting may exceed the upper limit of positive char 
 value during the loop.
 
 The attached patch is a fix for this issue. I'll commit this if there are 
 no objections.
 
No objections (although I haven't actually applied and run your
patch).  Thanks for investigating this.  I should have tested a wider
set of step values in my original tests.

-- 
Jon Parise ([EMAIL PROTECTED]) :: The PHP Project (http://www.php.net/)

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