Re: [PHP-DEV] Streams are here!

2002-03-16 Thread Stefan Roehrich

On 2002-03-16 01:11:11, Wez Furlong wrote:
 Can you tell me which include files are needed to correct
 the build on your system?
 Then I can fix it :-)

Your fix to the .h file helped (even without the (long) change).

Maybe we can use a configure check for ptrdiff_t like in
ext/bcmath/libbcmath, so we can avoid the (long) workaround.

  Stefan

-- 
Stefan Röhrich   [EMAIL PROTECTED], [EMAIL PROTECTED]
 http://www.roehri.ch/~sr/

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




[PHP-DEV] Part run script shutdown

2002-03-16 Thread Dave Brotherstone

Hi,
   I'm trying to find out whether PHP_RSHUTDOWN_FUNCTION is called when a
browser session is killed mid-script.  If not, is there any way an extension
can detect the output socket is closed?

I've found a potential gotcha in the Sybase module, to do with locking, and
the locks never being released if the script doesn't finish.  I'm still
digging about with it, so I'm not 100% sure what's going on yet


Thanks,
Dave.


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




Re: [PHP-DEV] Additional warning for mail()

2002-03-16 Thread Sander Roobol

On 2002.03.16 06:14 Jon Parise wrote:
 On Sat, Mar 16, 2002 at 03:15:07AM +0100, Markus Fischer wrote:
 
  If no one objects I'ld like to commit the following patch
  which raises an extra warning message when using mail() on
  unix systems and the shell required for popen() can't be
  executed (tested on linux/freebsd).
 
 No objection here.

+1 for this (makes debugging easier).

Sander

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




[PHP-DEV] streams crash

2002-03-16 Thread sesser

following little script crashes now:

?
$myftp = ftp_connect(ftp.mutt.org);
?

it crashes in fflush() of libc and backtrace shows
that its called by php_stdiop_flush, which is called
from php_stream_flush, php_stream_free, 

Stefan


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




[PHP-DEV] CVS Account Request: costello

2002-03-16 Thread Gai Shaked

translating PHP manual to hebrew

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




Re: [PHP-DEV] Streams are here!

2002-03-16 Thread Wez Furlong

Yes; I'm not happy with (long).
Apparently, some systems have ptrdiff_t in malloc.h rather than
stddef.h.

I'll see what I can do, but it's tricky when working blind
like this :-/

--Wez.

On 16/03/02, Stefan Roehrich [EMAIL PROTECTED] wrote:
 On 2002-03-16 01:11:11, Wez Furlong wrote:
  Can you tell me which include files are needed to correct
  the build on your system?
  Then I can fix it :-)
 
 Your fix to the .h file helped (even without the (long) change).
 
 Maybe we can use a configure check for ptrdiff_t like in
 ext/bcmath/libbcmath, so we can avoid the (long) workaround.
 
   Stefan
 
 -- 
 Stefan Röhrich   [EMAIL PROTECTED], [EMAIL PROTECTED]
  http://www.roehri.ch/~sr/




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




Re: [PHP-DEV] streams crash

2002-03-16 Thread Sander Roobol

Apache crashes when running _any_ script (even phpinfo(); segfaults). 
CLI works fine.

Backtrace:
#0  0x400e7476 in fflush () from /lib/libc.so.6
#1  0x402ff5b7 in php_stdiop_flush (stream=0x8169bc4)
 at /home/sander/php/head/php4/main/streams.c:500
#2  0x402fee39 in php_stream_flush (stream=0x8169bc4)
 at /home/sander/php/head/php4/main/streams.c:186
#3  0x402feb76 in php_stream_free (stream=0x8169bc4, call_dtor=1)
 at /home/sander/php/head/php4/main/streams.c:70
#4  0x402a44b2 in _file_stream_dtor (rsrc=0x8169c3c)
 at /home/sander/php/head/php4/ext/standard/file.c:116
#5  0x4031f56d in list_entry_destructor (ptr=0x8169c3c)
 at /home/sander/php/head/php4/Zend/zend_list.c:177
#6  0x4031f742 in zend_destroy_rsrc_list (ht=0x4043f3dc)
 at /home/sander/php/head/php4/Zend/zend_list.c:248
#7  0x40311417 in shutdown_executor ()
 at /home/sander/php/head/php4/Zend/zend_execute_API.c:196
#8  0x40319c46 in zend_deactivate () at 
/home/sander/php/head/php4/Zend/zend.c:596
#9  0x402f7d2b in php_request_shutdown (dummy=0x0)
 at /home/sander/php/head/php4/main/main.c:795
#10 0x403321b3 in apache_php_module_main (r=0x81647cc, 
display_source_mode=0)
 at /home/sander/php/head/php4/sapi/apache/sapi_apache.c:96
#11 0x40332c5e in send_php (r=0x81647cc, display_source_mode=0, 
filename=0x0)
 at /home/sander/php/head/php4/sapi/apache/mod_php4.c:575
#12 0x40332cc2 in send_parsed_php (r=0x81647cc)
 at /home/sander/php/head/php4/sapi/apache/mod_php4.c:590
#13 0x08075999 in ap_invoke_handler ()
#14 0x0808a7cf in process_request_internal ()
#15 0x0808a836 in ap_process_request ()
#16 0x080816f6 in child_main ()
#17 0x080818b1 in make_child ()
#18 0x08081a2c in startup_children ()
#19 0x080820bd in standalone_main ()
#20 0x0808291c in main ()
#21 0x4009f65f in __libc_start_main () from /lib/libc.so.6

Sander

On 2002.03.16 12:13 [EMAIL PROTECTED] wrote:
 following little script crashes now:
 
 ?
   $myftp = ftp_connect(ftp.mutt.org);
 ?
 
 it crashes in fflush() of libc and backtrace shows
 that its called by php_stdiop_flush, which is called
 from php_stream_flush, php_stream_free, 
 
 Stefan
 
 
 --
 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] Streams are here!

2002-03-16 Thread Derick Rethans

Markus,

please use tabs for indentation, and favor this:

if (set) {
function();
}

above this:

if (set) function();

this makes the PHP C source more consistent.

Derick

On Sat, 16 Mar 2002, Marcus Börger wrote:

 To have image.c work i had to correct the php_stream_seek and php_stream_getc
 calls. Seek caals had wrong parameter arragement - but nowhere else in code...
 getc see below...
 
 I changed both functions later.
 
 in php_stream_getc i return buf  0xFF because otherwise i get 0xFFxx 
 in return.
 
 in php_stream_seek i added code to make it much faster
 
 and i couldn't compile php_stdiop_read see diff
 
 marcus
 
 diff -u -w -r1.11 streams.c
 --- main/streams.c  16 Mar 2002 00:05:47 -  1.11
 +++ main/streams.c  16 Mar 2002 02:28:55 -
 @@ -132,7 +132,7 @@
  char buf;
 
  if (php_stream_read(stream, buf, 1)  0) {
 -   return buf;
 +   return buf  0xFF;
  }
  return EOF;
   }
 @@ -204,17 +204,19 @@
 
   PHPAPI int php_stream_seek(php_stream *stream, off_t offset, int whence)
   {
 +   static char tmp[1024];
 +
  if (stream-ops-seek) {
  return stream-ops-seek(stream, offset, whence);
  }
 
  /* emulate forward moving seeks with reads */
  if (whence == SEEK_CUR  offset  0) {
 -   while(offset--  0) {
 -   if (php_stream_getc(stream) == EOF) {
 -   return -1;
 -   }
 +   while (offset=sizeof(tmp)) {
 +   php_stream_read(stream,tmp,sizeof(tmp));
 +   offset -= sizeof(tmp);
  }
 +   if (offset) php_stream_read(stream,tmp,offset);
  return 0;
  }
 
 @@ -447,7 +449,7 @@
 
   static size_t php_stdiop_read(php_stream *stream, char *buf, size_t count)
   {
 -   php_stdio_stream_data * ata = (php_stdio_stream_data*)stream-abstract;
 +   php_stdio_stream_data * data = 
 (php_stdio_stream_data*)stream-abstract;
 
  if (buf == NULL  count == 0)  {
  /* check for EOF condition */
 
 
 At 22:12 15.03.2002, Wez Furlong wrote:
 Well, PHP finally supports fopen(https://...;) :-)
 
 Please please please test the following things in particular
 as I can't compile them or verify them here:
 
 hyperwave:
 hw_new_document_from_file
 
 gd:
 functions that create images from files.
 In particular, try creating from wrapped files over
 http, ftp etc.
 
 pfsockopen()
 copy() - particularly with wrapped source/dest
 gzopen (and friends)
 gzfile
 
 If you have a system where HAVE_FLUSHIO is important,
 please let me know if plain files work correctly when
 switching between read and write.
 
 If you have things in Pear/PECL or a third party
 extension that used the old FP_XXX or php_file_le_fopen(),
 please contact me and I can help you update your code for
 streams (it's easy).
 
 I'll check back in a couple of hours to see if anyone
 has found show stoppers; otherwise I'll be signing off
 till the morning (it is Friday after all!)
 
 --Wez.
 
 
 --
 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
 

Derick Rethans

-
PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
All your branches are belong to me!
SRM: Site Resource Manager - www.vl-srm.net
-


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




Re: [PHP-DEV] Additional warning for mail()

2002-03-16 Thread Derick Rethans

On Sat, 16 Mar 2002, Markus Fischer wrote:

 Hi,
 
 If no one objects I'ld like to commit the following patch
 which raises an extra warning message when using mail() on
 unix systems and the shell required for popen() can't be
 executed (tested on linux/freebsd).

Go ahead...

Derick

-
PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
All your branches are belong to me!
SRM: Site Resource Manager - www.vl-srm.net
-


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




Re: [PHP-DEV] streams crash

2002-03-16 Thread Wez Furlong

Hi Sander,

I've added some asserts and removed a bogus php_stream_flush
call; update your streams.c let me know how you get on :-)

If this doesn't work, then it's probably to do with the
resource management in main/main.c fopen_wrapper_for_zend :-/

--Wez.

On 16/03/02, Sander Roobol [EMAIL PROTECTED] wrote:
 Apache crashes when running _any_ script (even phpinfo(); segfaults). 
 CLI works fine.
 
 Backtrace:
 #0  0x400e7476 in fflush () from /lib/libc.so.6
 #1  0x402ff5b7 in php_stdiop_flush (stream=0x8169bc4)
  at /home/sander/php/head/php4/main/streams.c:500
 #2  0x402fee39 in php_stream_flush (stream=0x8169bc4)
  at /home/sander/php/head/php4/main/streams.c:186
 #3  0x402feb76 in php_stream_free (stream=0x8169bc4, call_dtor=1)
  at /home/sander/php/head/php4/main/streams.c:70
 #4  0x402a44b2 in _file_stream_dtor (rsrc=0x8169c3c)
  at /home/sander/php/head/php4/ext/standard/file.c:116
 #5  0x4031f56d in list_entry_destructor (ptr=0x8169c3c)
  at /home/sander/php/head/php4/Zend/zend_list.c:177
 #6  0x4031f742 in zend_destroy_rsrc_list (ht=0x4043f3dc)
  at /home/sander/php/head/php4/Zend/zend_list.c:248
 #7  0x40311417 in shutdown_executor ()
  at /home/sander/php/head/php4/Zend/zend_execute_API.c:196
 #8  0x40319c46 in zend_deactivate () at 
 /home/sander/php/head/php4/Zend/zend.c:596
 #9  0x402f7d2b in php_request_shutdown (dummy=0x0)
  at /home/sander/php/head/php4/main/main.c:795
 #10 0x403321b3 in apache_php_module_main (r=0x81647cc, 
 display_source_mode=0)
  at /home/sander/php/head/php4/sapi/apache/sapi_apache.c:96
 #11 0x40332c5e in send_php (r=0x81647cc, display_source_mode=0, 
 filename=0x0)
  at /home/sander/php/head/php4/sapi/apache/mod_php4.c:575
 #12 0x40332cc2 in send_parsed_php (r=0x81647cc)
  at /home/sander/php/head/php4/sapi/apache/mod_php4.c:590
 #13 0x08075999 in ap_invoke_handler ()
 #14 0x0808a7cf in process_request_internal ()
 #15 0x0808a836 in ap_process_request ()
 #16 0x080816f6 in child_main ()
 #17 0x080818b1 in make_child ()
 #18 0x08081a2c in startup_children ()
 #19 0x080820bd in standalone_main ()
 #20 0x0808291c in main ()
 #21 0x4009f65f in __libc_start_main () from /lib/libc.so.6
 
 Sander
 
 On 2002.03.16 12:13 [EMAIL PROTECTED] wrote:
  following little script crashes now:
  
  ?
  $myftp = ftp_connect(ftp.mutt.org);
  ?
  
  it crashes in fflush() of libc and backtrace shows
  that its called by php_stdiop_flush, which is called
  from php_stream_flush, php_stream_free, 
  
  Stefan
  
  
  --
  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 Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] streams crash

2002-03-16 Thread Sander Roobol

Hello,

Unfortunately, it still fails. Configures  compiles fine, but crashes 
Apache. The backtrace is still the same.

Sander

On 2002.03.16 12:25 Wez Furlong wrote:
 Hi Sander,
 
 I've added some asserts and removed a bogus php_stream_flush
 call; update your streams.c let me know how you get on :-)
 
 If this doesn't work, then it's probably to do with the
 resource management in main/main.c fopen_wrapper_for_zend :-/
 
 --Wez.
 
 On 16/03/02, Sander Roobol [EMAIL PROTECTED] wrote:
  Apache crashes when running _any_ script (even phpinfo();
 segfaults).
  CLI works fine.
 
  Backtrace:
  #0  0x400e7476 in fflush () from /lib/libc.so.6
  #1  0x402ff5b7 in php_stdiop_flush (stream=0x8169bc4)
   at /home/sander/php/head/php4/main/streams.c:500
  #2  0x402fee39 in php_stream_flush (stream=0x8169bc4)
   at /home/sander/php/head/php4/main/streams.c:186
  #3  0x402feb76 in php_stream_free (stream=0x8169bc4, call_dtor=1)
   at /home/sander/php/head/php4/main/streams.c:70
  #4  0x402a44b2 in _file_stream_dtor (rsrc=0x8169c3c)
   at /home/sander/php/head/php4/ext/standard/file.c:116
  #5  0x4031f56d in list_entry_destructor (ptr=0x8169c3c)
   at /home/sander/php/head/php4/Zend/zend_list.c:177
  #6  0x4031f742 in zend_destroy_rsrc_list (ht=0x4043f3dc)
   at /home/sander/php/head/php4/Zend/zend_list.c:248
  #7  0x40311417 in shutdown_executor ()
   at /home/sander/php/head/php4/Zend/zend_execute_API.c:196
  #8  0x40319c46 in zend_deactivate () at
  /home/sander/php/head/php4/Zend/zend.c:596
  #9  0x402f7d2b in php_request_shutdown (dummy=0x0)
   at /home/sander/php/head/php4/main/main.c:795
  #10 0x403321b3 in apache_php_module_main (r=0x81647cc,
  display_source_mode=0)
   at /home/sander/php/head/php4/sapi/apache/sapi_apache.c:96
  #11 0x40332c5e in send_php (r=0x81647cc, display_source_mode=0,
  filename=0x0)
   at /home/sander/php/head/php4/sapi/apache/mod_php4.c:575
  #12 0x40332cc2 in send_parsed_php (r=0x81647cc)
   at /home/sander/php/head/php4/sapi/apache/mod_php4.c:590
  #13 0x08075999 in ap_invoke_handler ()
  #14 0x0808a7cf in process_request_internal ()
  #15 0x0808a836 in ap_process_request ()
  #16 0x080816f6 in child_main ()
  #17 0x080818b1 in make_child ()
  #18 0x08081a2c in startup_children ()
  #19 0x080820bd in standalone_main ()
  #20 0x0808291c in main ()
  #21 0x4009f65f in __libc_start_main () from /lib/libc.so.6
 
  Sander
 
  On 2002.03.16 12:13 [EMAIL PROTECTED] wrote:
   following little script crashes now:
  
   ?
 $myftp = ftp_connect(ftp.mutt.org);
   ?
  
   it crashes in fflush() of libc and backtrace shows
   that its called by php_stdiop_flush, which is called
   from php_stream_flush, php_stream_free, 
  
   Stefan
  
  
   --
   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 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] Return object by reference

2002-03-16 Thread Klaus Reimer

Hi,

I have an array with object references stored in it. Now I want to write a 
function which returns one of those references. I'm browsing through this 
array with the zval_hash_*() functions until I have the correct reference in 
the Variable **data. But how can I return this value by reference? The only 
way I found to return the value at all (without a segfault) is this:

  *return_value=**data;
  zval_copy_ctor(return_value);
  return;

But this returns a copy of the object. If I just leave out the 
zval_copy_ctor() call I get a segfault. What do I need to do to return a 
correct object-reference?

BTW: Is there somewhere a good Zend API documentation on the net? I only know 
http://www.zend.com/apidoc/ and this documentation isn't answering all of my 
questions. That's why I am bothering you with all these beginner questions ;-)

-- 
Bye, K http://www.ailis.de/~k/
[A735 47EC D87B 1F15 C1E9  53D3 AA03 6173 A723 E391]
(Finger [EMAIL PROTECTED] to get public key)

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




Re: [PHP-DEV] streams crash

2002-03-16 Thread Wez Furlong

Sander,

in main/main.c on line 576 there is a ZEND_REGISTER_RESOURCE
call.  Can you comment out that line and try again?
I'd expect a leak instead of a crash now.

We need a cleaner solution for this anyway :-/

--Wez.

On 16/03/02, Sander Roobol [EMAIL PROTECTED] wrote:
 Hello,
 
 Unfortunately, it still fails. Configures  compiles fine, but crashes 
 Apache. The backtrace is still the same.
 
 Sander
 
 On 2002.03.16 12:25 Wez Furlong wrote:
  Hi Sander,
  
  I've added some asserts and removed a bogus php_stream_flush
  call; update your streams.c let me know how you get on :-)
  
  If this doesn't work, then it's probably to do with the
  resource management in main/main.c fopen_wrapper_for_zend :-/
  
  --Wez.
  
  On 16/03/02, Sander Roobol [EMAIL PROTECTED] wrote:
   Apache crashes when running _any_ script (even phpinfo();
  segfaults).
   CLI works fine.
  
   Backtrace:
   #0  0x400e7476 in fflush () from /lib/libc.so.6
   #1  0x402ff5b7 in php_stdiop_flush (stream=0x8169bc4)
at /home/sander/php/head/php4/main/streams.c:500
   #2  0x402fee39 in php_stream_flush (stream=0x8169bc4)
at /home/sander/php/head/php4/main/streams.c:186
   #3  0x402feb76 in php_stream_free (stream=0x8169bc4, call_dtor=1)
at /home/sander/php/head/php4/main/streams.c:70
   #4  0x402a44b2 in _file_stream_dtor (rsrc=0x8169c3c)
at /home/sander/php/head/php4/ext/standard/file.c:116
   #5  0x4031f56d in list_entry_destructor (ptr=0x8169c3c)
at /home/sander/php/head/php4/Zend/zend_list.c:177
   #6  0x4031f742 in zend_destroy_rsrc_list (ht=0x4043f3dc)
at /home/sander/php/head/php4/Zend/zend_list.c:248
   #7  0x40311417 in shutdown_executor ()
at /home/sander/php/head/php4/Zend/zend_execute_API.c:196
   #8  0x40319c46 in zend_deactivate () at
   /home/sander/php/head/php4/Zend/zend.c:596
   #9  0x402f7d2b in php_request_shutdown (dummy=0x0)
at /home/sander/php/head/php4/main/main.c:795
   #10 0x403321b3 in apache_php_module_main (r=0x81647cc,
   display_source_mode=0)
at /home/sander/php/head/php4/sapi/apache/sapi_apache.c:96
   #11 0x40332c5e in send_php (r=0x81647cc, display_source_mode=0,
   filename=0x0)
at /home/sander/php/head/php4/sapi/apache/mod_php4.c:575
   #12 0x40332cc2 in send_parsed_php (r=0x81647cc)
at /home/sander/php/head/php4/sapi/apache/mod_php4.c:590
   #13 0x08075999 in ap_invoke_handler ()
   #14 0x0808a7cf in process_request_internal ()
   #15 0x0808a836 in ap_process_request ()
   #16 0x080816f6 in child_main ()
   #17 0x080818b1 in make_child ()
   #18 0x08081a2c in startup_children ()
   #19 0x080820bd in standalone_main ()
   #20 0x0808291c in main ()
   #21 0x4009f65f in __libc_start_main () from /lib/libc.so.6
  
   Sander
  
   On 2002.03.16 12:13 [EMAIL PROTECTED] wrote:
following little script crashes now:
   
?
$myftp = ftp_connect(ftp.mutt.org);
?
   
it crashes in fflush() of libc and backtrace shows
that its called by php_stdiop_flush, which is called
from php_stream_flush, php_stream_free, 
   
Stefan
   
   
--
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 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 Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] streams crash

2002-03-16 Thread Sander Roobol

Hello Wez,

You hack makes it work again. It doesn't crash anymore.

Tnx,
Sander

On 2002.03.16 12:56 Wez Furlong wrote:
 Sander,
 
 in main/main.c on line 576 there is a ZEND_REGISTER_RESOURCE
 call.  Can you comment out that line and try again?
 I'd expect a leak instead of a crash now.
 
 We need a cleaner solution for this anyway :-/
 
 --Wez.
 
 On 16/03/02, Sander Roobol [EMAIL PROTECTED] wrote:
  Hello,
 
  Unfortunately, it still fails. Configures  compiles fine, but
 crashes
  Apache. The backtrace is still the same.
 
  Sander
 
  On 2002.03.16 12:25 Wez Furlong wrote:
   Hi Sander,
  
   I've added some asserts and removed a bogus php_stream_flush
   call; update your streams.c let me know how you get on :-)
  
   If this doesn't work, then it's probably to do with the
   resource management in main/main.c fopen_wrapper_for_zend :-/
  
   --Wez.
  
   On 16/03/02, Sander Roobol [EMAIL PROTECTED] wrote:
Apache crashes when running _any_ script (even phpinfo();
   segfaults).
CLI works fine.
   
Backtrace:
#0  0x400e7476 in fflush () from /lib/libc.so.6
#1  0x402ff5b7 in php_stdiop_flush (stream=0x8169bc4)
 at /home/sander/php/head/php4/main/streams.c:500
#2  0x402fee39 in php_stream_flush (stream=0x8169bc4)
 at /home/sander/php/head/php4/main/streams.c:186
#3  0x402feb76 in php_stream_free (stream=0x8169bc4,
 call_dtor=1)
 at /home/sander/php/head/php4/main/streams.c:70
#4  0x402a44b2 in _file_stream_dtor (rsrc=0x8169c3c)
 at /home/sander/php/head/php4/ext/standard/file.c:116
#5  0x4031f56d in list_entry_destructor (ptr=0x8169c3c)
 at /home/sander/php/head/php4/Zend/zend_list.c:177
#6  0x4031f742 in zend_destroy_rsrc_list (ht=0x4043f3dc)
 at /home/sander/php/head/php4/Zend/zend_list.c:248
#7  0x40311417 in shutdown_executor ()
 at /home/sander/php/head/php4/Zend/zend_execute_API.c:196
#8  0x40319c46 in zend_deactivate () at
/home/sander/php/head/php4/Zend/zend.c:596
#9  0x402f7d2b in php_request_shutdown (dummy=0x0)
 at /home/sander/php/head/php4/main/main.c:795
#10 0x403321b3 in apache_php_module_main (r=0x81647cc,
display_source_mode=0)
 at /home/sander/php/head/php4/sapi/apache/sapi_apache.c:96
#11 0x40332c5e in send_php (r=0x81647cc, display_source_mode=0,
filename=0x0)
 at /home/sander/php/head/php4/sapi/apache/mod_php4.c:575
#12 0x40332cc2 in send_parsed_php (r=0x81647cc)
 at /home/sander/php/head/php4/sapi/apache/mod_php4.c:590
#13 0x08075999 in ap_invoke_handler ()
#14 0x0808a7cf in process_request_internal ()
#15 0x0808a836 in ap_process_request ()
#16 0x080816f6 in child_main ()
#17 0x080818b1 in make_child ()
#18 0x08081a2c in startup_children ()
#19 0x080820bd in standalone_main ()
#20 0x0808291c in main ()
#21 0x4009f65f in __libc_start_main () from /lib/libc.so.6
   
Sander
   
On 2002.03.16 12:13 [EMAIL PROTECTED] wrote:
 following little script crashes now:

 ?
   $myftp = ftp_connect(ftp.mutt.org);
 ?

 it crashes in fflush() of libc and backtrace shows
 that its called by php_stdiop_flush, which is called
 from php_stream_flush, php_stream_free, 

 Stefan


 --
 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 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 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] make crashing on libmysql

2002-03-16 Thread Andrey Hristov

 With latest CVS php4-200203160300.tar.gz
and
./configure --enable-wddx --enable-sysvsem  --enable-sysvshm --enable-static 
--with-apxs=/usr/samba/users/andy/apache/bin/apxs --wit
hout-pear --with-openssl --with-bz 
--with-iconv=/usr/samba/users/andy/413dev/php4-200203140300/ext/iconv
and then making -  I get this

blablah
 Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo 
Zend/zend_ini_scanner.lo Zend/zend_alloc.lo
Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo 
Zend/zend_execute_API.lo Zend/zend_highlight.lo
Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo 
Zend/zend_stack.lo Zend/zend_variables.lo
Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo 
Zend/zend_list.lo Zend/zend_indent.lo
Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo 
Zend/zend_qsort.lo Zend/zend_execute.lo sapi/cli/php_cli.lo
sapi/cli/getopt.lo main/internal_functions_cli.lo -lpam -lcrypt -lssl -lcrypto 
-lresolv -lm -ldl -lnsl -lresolv -lcrypt -ldl -o
sapi/cli/php
ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
ext/mysql/libmysql/my_tempnam.lo(.text+0x5c): the use of `tempnam' is dangerous, 
better use `mkstemp'

Andrey


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




[PHP-DEV] ext/ming doesn't compile..

2002-03-16 Thread Jani Taskinen


I noticed that you didn't convert ext/ming to this
streams thingie yet. It doesn't compile now.

--Jani


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




[PHP-DEV] QA help needed

2002-03-16 Thread James Cox

firstly, apologies for the cross post, but I urgently need a Windows 98 /
PHP / PWS environment to test an issue on.

if anyone could help out with that, please email me back directly.

Thanks,

James

--
James Cox :: [EMAIL PROTECTED] :: Landonize It! http://landonize.it/
Was I helpful?  http://www.amazon.co.uk/exec/obidos/wishlist/23IVGHQ61RJGO/


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




[PHP-DEV] Re: ext/ming doesn't compile..

2002-03-16 Thread Wez Furlong

I don't have ming, so I can't test it :-/
I do remember changing some parts; could you send me the
error messages and I'll try and fix it up.

--Wez.

On 16/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
 I noticed that you didn't convert ext/ming to this
 streams thingie yet. It doesn't compile now.
 
 --Jani




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




[PHP-DEV] why tempnam is used in libmysql bundleld with php

2002-03-16 Thread Andrey Hristov

 I cannot compile the CVS because gcc complains about using function tempnam()
In the man tempnam i found that:
BUGS
   The precise meaning of `appropriate' is undefined; it is unspecified how 
accessibility of a directory is determined.  Never
use this func­tion. Use mkstemp(3) instead.




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




Re: [PHP-DEV] why tempnam is used in libmysql bundleld with php

2002-03-16 Thread derick

On Sat, 16 Mar 2002, Andrey Hristov wrote:

  I cannot compile the CVS because gcc complains about using function tempnam()
 In the man tempnam i found that:
 BUGS
The precise meaning of `appropriate' is undefined; it is unspecified how 
accessibility of a directory is determined.  Never
 use this func­tion. Use mkstemp(3) instead.

It only gives a warning while linking, it should compile fine.

Derick


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




Re: [PHP-DEV] Re: ext/ming doesn't compile..

2002-03-16 Thread Jani Taskinen


ext/ming/ming.c: In function `NewSWFInput_sock':
ext/ming/ming.c:221: warning: implicit declaration of function `SOCK_FREAD'
ext/ming/ming.c: In function `GetInput':
ext/ming/ming.c:239: `PHP_STREAM_AS_STDIO_FILE' undeclared (first use in this function)
ext/ming/ming.c:239: (Each undeclared identifier is reported only once
ext/ming/ming.c:239: for each function it appears in.)
ext/ming/ming.c: In function `Destroy_SWFFont_resource':
ext/ming/ming.c:1204: warning: implicit declaration of function `DestroySWFBlock'
ext/ming/ming.c: In function `Zif_swfmovie_save':
ext/ming/ming.c:1622: parse error before )'
ext/ming/ming.c:1630: `File' undeclared (first use in this function)
ext/ming/ming.c: At top level:
ext/ming/ming.c:209: warning: `NewSWFInput_sock' defined but not used
make: *** [ext/ming/ming.lo] Error 1



On Sat, 16 Mar 2002, Wez Furlong wrote:

I don't have ming, so I can't test it :-/
I do remember changing some parts; could you send me the
error messages and I'll try and fix it up.

--Wez.

On 16/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
 I noticed that you didn't convert ext/ming to this
 streams thingie yet. It doesn't compile now.
 
 --Jani






-- 


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




[PHP-DEV] RE: [PHP-QA] QA help needed

2002-03-16 Thread Liz

James,

Firstly I have a suggestion for you, I downloaded a copy of something
called VMWare, it allows you to install virtual machines, ie, depending
on your disk space you can run mutliple operating systems without multi
boot. It even has the ability to forget changes, so you can have a
stable build, and 'try' software on it - great for perfecting software
installation and so on.

It runs on windows and linux

Im not affiliated but it's a rocking product.  I don't however, curretly
have a Win98 setup on it, I have every other stupid form of windows bar
the 98/me/95 variety

They do a 30day eval version no other restrictions, its nice.

 -Original Message-
 From: James Cox [mailto:[EMAIL PROTECTED]] 
 Sent: Saturday, March 16, 2002 2:04 PM
 To: Php-Qa
 Cc: php-general; Php-Dev
 Subject: [PHP-QA] QA help needed
 
 
 firstly, apologies for the cross post, but I urgently need a 
 Windows 98 / PHP / PWS environment to test an issue on.
 
 if anyone could help out with that, please email me back directly.
 
 Thanks,
 
 James
 
 --
 James Cox :: [EMAIL PROTECTED] :: Landonize It! 
 http://landonize.it/ Was I helpful?  
http://www.amazon.co.uk/exec/obidos/wishlist/23IVGHQ61RJGO/


-- 
PHP Quality Assurance 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] Translation of PHP Docs To Hebrew

2002-03-16 Thread Hadar Porat








Hello to all,



I want to
start translate PHP Docs to Hebrew, but I don't know where to start.

I don't have
CVS access, so I can't upload translated files. I also don't know where to get
the source of the docs.



I have some
free time, and I know English and Hebrew languages very well.



Please guide
me how to start, and where to send the Hebrew Docs I made.

I want to
start today, so if someone can e-mail me (and not the list), it will be great.



Hadar Porat

[EMAIL PROTECTED]

http://www.igames.co.il














Re: [PHP-DEV] Re: ext/ming doesn't compile..

2002-03-16 Thread Wez Furlong

Hi Jani,

Please try my latest commit.

--Wez.

On 16/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
 ext/ming/ming.c: In function `NewSWFInput_sock':
 ext/ming/ming.c:221: warning: implicit declaration of function `SOCK_FREAD'
 ext/ming/ming.c: In function `GetInput':
 ext/ming/ming.c:239: `PHP_STREAM_AS_STDIO_FILE' undeclared (first use in this 
function)
 ext/ming/ming.c:239: (Each undeclared identifier is reported only once
 ext/ming/ming.c:239: for each function it appears in.)
 ext/ming/ming.c: In function `Destroy_SWFFont_resource':
 ext/ming/ming.c:1204: warning: implicit declaration of function `DestroySWFBlock'
 ext/ming/ming.c: In function `Zif_swfmovie_save':
 ext/ming/ming.c:1622: parse error before )'
 ext/ming/ming.c:1630: `File' undeclared (first use in this function)
 ext/ming/ming.c: At top level:
 ext/ming/ming.c:209: warning: `NewSWFInput_sock' defined but not used
 make: *** [ext/ming/ming.lo] Error 1
 
 
 
 On Sat, 16 Mar 2002, Wez Furlong wrote:
 
 I don't have ming, so I can't test it :-/
 I do remember changing some parts; could you send me the
 error messages and I'll try and fix it up.
 
 --Wez.
 
 On 16/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
  I noticed that you didn't convert ext/ming to this
  streams thingie yet. It doesn't compile now.
  
  --Jani
 
 
 
 
 
 
 --




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




Re: [PHP-DEV] make crashing on libmysql

2002-03-16 Thread Markus Fischer

And where's the crash ?

In fact, there is none. It's only a warning message and the
binaries are built.

On Sat, Mar 16, 2002 at 03:04:57PM +0200, Andrey Hristov wrote : 
  With latest CVS php4-200203160300.tar.gz
 and
 ./configure --enable-wddx --enable-sysvsem  --enable-sysvshm --enable-static 
--with-apxs=/usr/samba/users/andy/apache/bin/apxs --wit
 hout-pear --with-openssl --with-bz 
--with-iconv=/usr/samba/users/andy/413dev/php4-200203140300/ext/iconv
 and then making -  I get this
 
 blablah
  Zend/zend_language_parser.lo Zend/zend_language_scanner.lo Zend/zend_ini_parser.lo 
Zend/zend_ini_scanner.lo Zend/zend_alloc.lo
 Zend/zend_compile.lo Zend/zend_constants.lo Zend/zend_dynamic_array.lo 
Zend/zend_execute_API.lo Zend/zend_highlight.lo
 Zend/zend_llist.lo Zend/zend_opcode.lo Zend/zend_operators.lo Zend/zend_ptr_stack.lo 
Zend/zend_stack.lo Zend/zend_variables.lo
 Zend/zend.lo Zend/zend_API.lo Zend/zend_extensions.lo Zend/zend_hash.lo 
Zend/zend_list.lo Zend/zend_indent.lo
 Zend/zend_builtin_functions.lo Zend/zend_sprintf.lo Zend/zend_ini.lo 
Zend/zend_qsort.lo Zend/zend_execute.lo sapi/cli/php_cli.lo
 sapi/cli/getopt.lo main/internal_functions_cli.lo -lpam -lcrypt -lssl -lcrypto 
-lresolv -lm -ldl -lnsl -lresolv -lcrypt -ldl -o
 sapi/cli/php
 ext/mysql/libmysql/my_tempnam.lo: In function `my_tempnam':
 ext/mysql/libmysql/my_tempnam.lo(.text+0x5c): the use of `tempnam' is dangerous, 
better use `mkstemp'
 
 Andrey
 
 
 -- 
 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

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




Re: [PHP-DEV] Translation of PHP Docs To Hebrew

2002-03-16 Thread Sagi Bashari

Hi,

Some guys already started to translate the manual to hebrew.

See
http://www.guides.co.il/forums/index.php?board=3;action=display;threadid=56

Sagi

- Original Message -
From: Hadar Porat
To: [EMAIL PROTECTED]
Sent: Saturday, March 16, 2002 3:31 PM
Subject: [PHP-DEV] Translation of PHP Docs To Hebrew


Hello to all,

I want to start translate PHP Docs to Hebrew, but I don't know where to
start.
I don't have CVS access, so I can't upload translated files. I also don't
know where to get the source of the docs.

I have some free time, and I know English and Hebrew languages very well.

Please guide me how to start, and where to send the Hebrew Docs I made.
I want to start today, so if someone can e-mail me (and not the list), it
will be great.

Hadar Porat
[EMAIL PROTECTED]
http://www.igames.co.il



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




[PHP-DEV] PHP ftp extension and SSL

2002-03-16 Thread Wez Furlong

The new streams support in PHP make it easy to use SSL
for socket connections.

There is a feature request outstanding for the ftp extension
to make it support SSL ftp servers.

I'm not an FTP expert and I don't have any ftp servers setup
to test this, so I'm wondering if someone out there wouldn't
doing the work?

I will convert the ftp extension to use streams natively,
but then I need that someone to add the code for the protocol.
It sounds straightforward:
http://www.wu-ftpd.org/rfc/draft-murray-auth-ftp-ssl-05.txt

But it doesn't make sense to me, since I don't know the first
thing about the protocol :-)

--Wez.


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




[PHP-DEV] stream and interbase don't compile

2002-03-16 Thread Daniela Mariaschi

Hey Wez 
could you please  check the interbase module ?

I receive this error with  today CVS source and latest.tar.gz too :
/php4/ext/interbase/interbase.c: In function `zif_ibase_blob_import':
/php4/ext/interbase/interbase.c:2919: too many arguments to function
`php_stream_read'
make: *** [ext/interbase/interbase.lo] Error 1

I can change it but I think it's better if  you  make it, isn't it?

Daniela







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




[PHP-DEV] Coding around streams

2002-03-16 Thread Wez Furlong

Stig suggested that it would be a good idea to define
a cpp macro that identifies that the php streams are
present, so that extensions can do the right thing.

So, I'm adding HAVE_PHP_STREAM to php.h.
Should we bump the PHP_API_VERSION to refelect this?
If so, what are the rules? (it looks like an iso date
to me).

--Wez.


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




[PHP-DEV] memory streams

2002-03-16 Thread Marcus Boerger

At the moment i am working at memory-streams

If have the following problem left:
I must extend
struct _php_stream_ops
with ftell

by the way php_stream_tell is wrong because it relies on seek and
that does return either 0 on success or an erroecode

regards
marcus



- mailto:[EMAIL PROTECTED] 
 I don't want to start any blashphemous rumours
 but i think that god's got a sick sense of humor
 and when i die i expect to find him laughing.
  Depeche Mode
--- http://www.marcus-boerger.de ---


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




Re: [PHP-DEV] memory streams

2002-03-16 Thread Marcus Börger

At 18:58 16.03.2002, Marcus Boerger wrote:
At the moment i am working at memory-streams

If have the following problem left:
I must extend
struct _php_stream_ops
with ftell

by the way php_stream_tell is wrong because it relies on seek and
that does return either 0 on success or an erroecode

The following patch adds ftell as a stream function and changes the default
implementation.


diff -u -w -r1.13 php_streams.h
--- main/php_streams.h  16 Mar 2002 14:39:51 -  1.13
+++ main/php_streams.h  16 Mar 2002 18:48:47 -
@@ -47,6 +47,7 @@
 int(*flush)(php_stream *stream);
 /* these are optional */
 int(*seek)(php_stream *stream, off_t offset, int whence);
+   long   (*tell)(php_stream *stream);
 char *(*gets)(php_stream *stream, char *buf, size_t size);
 int (*cast)(php_stream *stream, int castas, void **ret);
 const char *label; /* label for this ops structure */
@@ -90,7 +91,7 @@

  PHPAPI int php_stream_seek(php_stream *stream, off_t offset, int whence);
  #define php_stream_rewind(stream)  php_stream_seek(stream, 0L, SEEK_SET)
-PHPAPI off_t php_stream_tell(php_stream *stream);
+PHPAPI long php_stream_tell(php_stream *stream);
  PHPAPI size_t php_stream_read(php_stream *stream, char *buf, size_t count);
  PHPAPI size_t php_stream_write(php_stream *stream, const char *buf, 
size_t count);
  #define php_stream_write_string(stream, str)   php_stream_write(stream, 
str, strlen(str))

diff -u -w -r1.21 streams.c
--- main/streams.c  16 Mar 2002 16:06:18 -  1.21
+++ main/streams.c  16 Mar 2002 18:48:48 -
@@ -197,12 +197,12 @@
 return stream-ops-write(stream, buf, count);
  }

-PHPAPI off_t php_stream_tell(php_stream *stream)
+PHPAPI long php_stream_tell(php_stream *stream)
  {
 off_t ret = -1;

-   if (stream-ops-seek) {
-   ret = stream-ops-seek(stream, 0, SEEK_CUR);
+   if (stream-ops-tell) {
+   ret = stream-ops-tell(stream);
 }
 return ret;
  }
@@ -539,6 +539,15 @@
 return fseek(data-file, offset, whence);
  }

+static long php_stdio_tell(php_stream *stream)
+{
+   php_stdio_stream_data *data = (php_stdio_stream_data*)stream-abstract;
+
+   assert(data != NULL);
+
+   return ftell(data-file);
+}
+
  static char *php_stdiop_gets(php_stream *stream, char *buf, size_t size)
  {
 php_stdio_stream_data *data = 
(php_stdio_stream_data*)stream-abstract;
@@ -583,7 +592,8 @@

  php_stream_ops php_stream_stdio_ops = {
 php_stdiop_write, php_stdiop_read,
-   php_stdiop_close, php_stdiop_flush, php_stdiop_seek,
+   php_stdiop_close, php_stdiop_flush,
+   php_stdiop_seek, php_stdio_tell,
 php_stdiop_gets, php_stdiop_cast,
 STDIO
  };



regards
marcus



- mailto:[EMAIL PROTECTED] 
 I don't want to start any blashphemous rumours
 but i think that god's got a sick sense of humor
 and when i die i expect to find him laughing.
  Depeche Mode
--- http://www.marcus-boerger.de ---


--
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: memory streams

2002-03-16 Thread Wez Furlong

Damn; you're half right :-)

Your seeker implementation should spot the offset=0 whence=SEEK_CUR
case and return the current position.
I've fixed the stdio stream implementation to do this.

Please don't change the php_stream_ops structure, as there is no
need.

How are your memory streams implemented? (I was about to start on
those!)

--Wez.

On 17/03/02, Marcus Boerger [EMAIL PROTECTED] wrote:
 At the moment i am working at memory-streams
 
 If have the following problem left:
 I must extend
 struct _php_stream_ops
 with ftell
 
 by the way php_stream_tell is wrong because it relies on seek and
 that does return either 0 on success or an erroecode
 
 regards
 marcus
 
 
 
 - mailto:[EMAIL PROTECTED] 
  I don't want to start any blashphemous rumours
  but i think that god's got a sick sense of humor
  and when i die i expect to find him laughing.
   Depeche Mode
 --- http://www.marcus-boerger.de ---




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




[PHP-DEV] Signing off for the evening

2002-03-16 Thread Wez Furlong

I hope that the streams have settled enough not to get in
the way of your plans;
I'm signing off for the evening, so I'm sorry if I can't respond
to any possible problems tonight.

--Wez.


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




Re: [PHP-DEV] Re: memory streams

2002-03-16 Thread Marcus Börger

At 19:53 16.03.2002, Wez Furlong wrote:
Damn; you're half right :-)

Your seeker implementation should spot the offset=0 whence=SEEK_CUR
case and return the current position.
I've fixed the stdio stream implementation to do this.

Please don't change the php_stream_ops structure, as there is no
need.

How are your memory streams implemented? (I was about to start on
those!)

See them attached, i will commit them as soon as they work

--Wez.

On 17/03/02, Marcus Boerger [EMAIL PROTECTED] wrote:
  At the moment i am working at memory-streams
 
  If have the following problem left:
  I must extend
  struct _php_stream_ops
  with ftell
 
  by the way php_stream_tell is wrong because it relies on seek and
  that does return either 0 on success or an erroecode
 
  regards
  marcus
 
 
 
  - mailto:[EMAIL PROTECTED] 
   I don't want to start any blashphemous rumours
   but i think that god's got a sick sense of humor
   and when i die i expect to find him laughing.
Depeche Mode
  --- http://www.marcus-boerger.de ---




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


/*
   +--+
   | PHP Version 4|
   +--+
   | Copyright (c) 1997-2002 The PHP Group|
   +--+
   | This source file is subject to version 2.02 of the PHP license,  |
   | that is bundled with this package in the file LICENSE, and is|
   | available at through the world-wide-web at   |
   | http://www.php.net/license/2_02.txt. |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to  |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
   | Author: Marcus Boerger [EMAIL PROTECTED]   |
   +--+
 */

#ifndef PHP_MEMORY_STREAM_H
#define PHP_MEMORY_STREAM_H

#include php_streams.h

PHPAPI php_stream *php_memory_stream_create();

#endif

/*
 * Local variables:
 * tab-width: 4
 * c-basic-offset: 4
 * End:
 * vim600: sw=4 ts=4 fdm=marker
 * vim600: sw=4 ts=4
 */


/*
   +--+
   | PHP Version 4|
   +--+
   | Copyright (c) 1997-2002 The PHP Group|
   +--+
   | This source file is subject to version 2.02 of the PHP license,  |
   | that is bundled with this package in the file LICENSE, and is|
   | available at through the world-wide-web at   |
   | http://www.php.net/license/2_02.txt. |
   | If you did not receive a copy of the PHP license and are unable to   |
   | obtain it through the world-wide-web, please send a note to  |
   | [EMAIL PROTECTED] so we can mail you a copy immediately.   |
   +--+
   | Author:  |
   | Marcus Boerger [EMAIL PROTECTED]   |
   +--+
 */

#define _GNU_SOURCE
#include php.h
#include php_streams.h

/* {{{ --- MEMORY stream implementation ---*/

typedef struct {
char*data;
size_t  fpos;
size_t  fsize;
} php_memory_stream_data;

static size_t php_memory_stream_write(php_stream *stream, const char *buf, size_t 
count) {/* {{{ */
php_memory_stream_data *ms;

assert(stream != NULL);
ms = stream-abstract;
assert(ms != NULL);
if ( ms-fpos + count  ms-fsize) {
char *tmp = erealloc( ms-data, ms-fpos + count);
if ( !tmp) {
count = ms-fsize - ms-fpos + 1;
} else {
ms-data = tmp;
}
}
if ( count) {
assert(buf!= NULL);
memcpy( (char*)buf, ms-data+ms-fpos, count);
ms-fpos += count;
}
return count;
} /* }}} */

static size_t php_memory_stream_read(php_stream *stream, char *buf, size_t count) {/* 
{{{ */
php_memory_stream_data *ms;


Re: [PHP-DEV] Re: memory streams

2002-03-16 Thread Marcus Börger

Little problem in php_stream_copy_to_stream:
When copying the whole fstream the result is zero - should be size
See patch.

marcus

diff -u -w -r1.23 streams.c
--- main/streams.c  16 Mar 2002 18:52:03 -  1.23
+++ main/streams.c  16 Mar 2002 19:45:31 -
@@ -377,8 +377,12 @@
 writeptr += didwrite;
 }
 } else {
+   if ( !maxlen) {
+   return haveread;
+   } else {
 return 0; /* error */
 }
+   }

 if (maxlen - haveread == 0) {
 break;



At 19:53 16.03.2002, Wez Furlong wrote:
Damn; you're half right :-)

Your seeker implementation should spot the offset=0 whence=SEEK_CUR
case and return the current position.
I've fixed the stdio stream implementation to do this.

Please don't change the php_stream_ops structure, as there is no
need.

How are your memory streams implemented? (I was about to start on
those!)

--Wez.

On 17/03/02, Marcus Boerger [EMAIL PROTECTED] wrote:
  At the moment i am working at memory-streams
 
  If have the following problem left:
  I must extend
  struct _php_stream_ops
  with ftell
 
  by the way php_stream_tell is wrong because it relies on seek and
  that does return either 0 on success or an erroecode
 
  regards
  marcus
 
 
 
  - mailto:[EMAIL PROTECTED] 
   I don't want to start any blashphemous rumours
   but i think that god's got a sick sense of humor
   and when i die i expect to find him laughing.
Depeche Mode
  --- http://www.marcus-boerger.de ---




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

2002-03-16 Thread Sebastian Bergmann

fsock.c
c:\home\php\php4\ext\standard\fsock.c(133): warning C4047: 'function':
Number of dereferences of 'void ***' and 'char [7]' different

c:\home\php\php4\ext\standard\fsock.c(133): warning C4022:
'zend_parse_parameters': Pointer type for parameter 2 does not match

c:\home\php\php4\ext\standard\fsock.c(133): warning C4047: 'function':
Number of dereferences of 'char *' and 'char **' different

c:\home\php\php4\ext\standard\fsock.c(133): warning C4024:
'zend_parse_parameters': Different types for formal and passed
parameter 3

c:\home\php\php4\ext\standard\fsock.c(196): warning C4761:
Size conflict in argument

-- 
  Sebastian Bergmann
  http://sebastian-bergmann.de/ http://phpOpenTracker.de/

  Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/

-- 
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-03-16 Thread Marcus Börger

SORRY

i checked and reloaded the file and i have no idea why whitespaces
have changed - maybe i will change my editor...

marcus

At 21:05 16.03.2002, you wrote:
helly   Sat Mar 16 15:05:08 2002 EDT

   Modified files:
 /php4/main  streams.c
   Log:
   -copy_stream_to_stream returns size if maxlen ==  PHP_STREAM_COPY_ALL
   #had to commit myself to do the rest...

Index: php4/main/streams.c
diff -u php4/main/streams.c:1.23 php4/main/streams.c:1.24
--- php4/main/streams.c:1.23Sat Mar 16 13:52:03 2002
+++ php4/main/streams.c Sat Mar 16 15:05:08 2002
 -83,14 +83,14 
 */
 return fclose(stream-stdiocast);
 }
-
+


bla


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




Re: [PHP-DEV] Streams are here!

2002-03-16 Thread Sebastian Bergmann

Wez Furlong wrote:
 gd:
 functions that create images from files.
 In particular, try creating from wrapped files over
 http, ftp etc.

  ext/gd does not compile on Win32:

gd.obj: error LNK2001: Unresolved external symbol:
_php_stream_stdio_ops

-- 
  Sebastian Bergmann
  http://sebastian-bergmann.de/ http://phpOpenTracker.de/

  Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/

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




[PHP-DEV] Streams

2002-03-16 Thread Marcus Boerger

Hi Wez,

i tried the streams and memory streams now in ext/exif.

What i do is check whether a stream is an stdio stream and if not
copy it to a memory stream and work with that. But before going
on using it i close/free the original stream.

I tested with http:... and the wrapper has destroy set to NULL.
But when closing the destroy is not NULL
To have it work i set it to NULL before closing it.
Do you have any ideas?

Test command for CLI was:
php -r 
'foreach(exif_read_data(http://marcus-boerger.de/php/ext/exif/test/kodak-dc210.jpg,,true)
 
as $sect=$data) foreach($data as $key=$val) echo $sect.$key: $val\n;'

Besides that it is working.

regards
marcus

have to go to party again now.


- mailto:[EMAIL PROTECTED] 
Wir sind allzumal Tiere unter Tieren, Kinder der Materie wie sie,
nur wehrloser. Doch da wir im Unterschied zu den Tieren wissen,
dass wir sterben muessen, wollen wir uns auf jenen Augenblick vorbereiten,
indem wir das Leben geniessen, das uns durch Zufall und vom Zufall gegeben 
ist.
Umberto Eco, Die Insel des vorigen Tages
--- http://www.marcus-boerger.de ---
-- Tel. 0241 / 874 09-7 ### 0179 / 29 14 980  --


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




[PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/standard fsock.c

2002-03-16 Thread Sebastian Bergmann

Harald Radi wrote:
 phanto  Sat Mar 16 17:08:24 2002 EDT

   Modified files:
 /php4/ext/standard  fsock.c
   Log:
   fixed TSRM build

  The

c:\home\php\php4\ext\standard\fsock.c(196): warning C4761:
Size conflict in argument

  warning persists, the others are gone.

-- 
  Sebastian Bergmann
  http://sebastian-bergmann.de/ http://phpOpenTracker.de/

  Did I help you? Consider a gift: http://wishlist.sebastian-bergmann.de/

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




Re: [PHP-DEV] Re: ext/ming doesn't compile..

2002-03-16 Thread Jani Taskinen


Compiles now nicely. (after my tiny typo fixes :)
btw. This streams stuff leaks a bit:

/main/streams.c(443) :  Freeing 0x0823EC1C (8 bytes)
/main/streams.c(52) :  Freeing 0x0834ADDC (48 bytes)

These are repeated few times.

(sorry, I don't know what is causing this..don't have time/energy 
to dig it up now..)

--Jani


On Sat, 16 Mar 2002, Wez Furlong wrote:

Hi Jani,

Please try my latest commit.

--Wez.

On 16/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
 ext/ming/ming.c: In function `NewSWFInput_sock':
 ext/ming/ming.c:221: warning: implicit declaration of function `SOCK_FREAD'
 ext/ming/ming.c: In function `GetInput':
 ext/ming/ming.c:239: `PHP_STREAM_AS_STDIO_FILE' undeclared (first use in this 
function)
 ext/ming/ming.c:239: (Each undeclared identifier is reported only once
 ext/ming/ming.c:239: for each function it appears in.)
 ext/ming/ming.c: In function `Destroy_SWFFont_resource':
 ext/ming/ming.c:1204: warning: implicit declaration of function `DestroySWFBlock'
 ext/ming/ming.c: In function `Zif_swfmovie_save':
 ext/ming/ming.c:1622: parse error before )'
 ext/ming/ming.c:1630: `File' undeclared (first use in this function)
 ext/ming/ming.c: At top level:
 ext/ming/ming.c:209: warning: `NewSWFInput_sock' defined but not used
 make: *** [ext/ming/ming.lo] Error 1
 
 
 
 On Sat, 16 Mar 2002, Wez Furlong wrote:
 
 I don't have ming, so I can't test it :-/
 I do remember changing some parts; could you send me the
 error messages and I'll try and fix it up.
 
 --Wez.
 
 On 16/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
  I noticed that you didn't convert ext/ming to this
  streams thingie yet. It doesn't compile now.
  
  --Jani
 
 
 
 
 
 
 --




-- 


-- 
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 network.c

2002-03-16 Thread Jim Winstead

Yasuo Ohgaki [EMAIL PROTECTED] wrote:
 Feel free to shoot me showing including stddef.h confirms
 ANSI C standard :)

the gnu c library documentation indicates that stddef.h and
ptrdiff_t are part of the ansi c standard.

http://www.aquaphoenix.com/ref/gnu_c_library/libc_483.html

jim

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




[PHP-DEV] Crypto++ extension happenings

2002-03-16 Thread J Smith


As I reluctantly mentioned a few weeks ago, I'm working on a PHP crypto 
extension that uses Crypto++, a C++ library that provides implementations 
for a bunch of crypto and hash algorithms. I was reluctant to bring it up 
because I didn't know if I was going to finish it at all, and I didn't want 
to get anybody's hopes up. The rationale behind the extension was partially 
because we need a crypto library at work that we can use on win32 platforms 
for a Windows Media Services plugin and one that PHP can use to create 
ciphertext compatible with the aforementioned plugin. Unfortunately, 
libmcrypt now requires cygwin on win32, and that sort of depedency would be 
hellish for a WMS plugin. Crypto++ works fine on Windows using VC++, and 
also works fine on UNIX systems using g++. Thus, a crypto extension for PHP 
that works on both major platforms.

Well, things have come along a bit further, and although the extension is 
still quite a way from being complete, it's getting there. The basic 
structure of the extension goes something like this:

- there's a base class in C++ that a template inherits from that provides 
the basic members and methods needed to encrypt and decrypt messages, along 
with all of the usual methods that allow you to set the IV for a crypto 
algorithm, the secret key, key length, mode (CBC, ECB, etc.), and 
plaintext. The base class is pure abstract virtual, as is the template that 
encapsulates it. (The template may seem a bit unnecessary, but it's used to 
set things like the block size for ciphers with variable block sizes and 
such. The base class it derives from makes things easier when dealing with 
C++'s templates, which allows it to compile on several compilers, like g++ 
and VC++, which all seem to disagree on how to use templates.)

- from there, there are a bunch of classes that provide interfaces to the 
various crypto algorithms, like Blowfish, 3-Way, Rijnadael, etc. So far, 
I've only implemented those three algorithms, but others will be done 
eventually, like the various CAST ciphers, RC5, etc. So far I've only 
worked with block ciphers -- I haven't started anything with the stream 
ciphers, like ARC4, WAKE, etc. All of the more popular block cipher modes 
are working, like OFB, CFB, several CBC padding modes, etc.

- on the hash side, there's a base hash class, from which various other 
classes derive that provide interfaces to the hash algorithms. So far, MD5, 
MD2, Panama and RIPEMD160 are the only hashes I've implemented; HAVAL and 
others will follow. (Although, for whatever reason, HAVAL is being a bitch 
and doesn't like compiling properly. Don't know why yet.)

Besides all of the C++ stuff, I've been working on C functions to access 
from the PHP code. (extern C stuff, that all jazz.) They're mostly 
complete for the cipher side; I haven't started on C stuff for the hashes 
yet.

I'm thinking the PHP fuctions themselves will work much like the mcrypt 
library, something like described below. These function names are all 
subject to change, obviously, since I haven't started writing this portion 
of the project yet. I may end up going the object oriented route using PHP 
classes; I'm not sure yet. Depends on feedback. (And more importantly, what 
work wants -- please remember, this extension is being worked on for my 
job; the fact that I can allow everyone else to use it as free software is 
a luxury.)


- resource cryptopp_create_cipher(int cipher) -- cipher is a constant that 
refers to the cipher algorithm, like CRYPTOPP_CIPHER_BLOWFISH, or 
CRYPTOPP_CIPHER_AES for AES/Rijnadael. The function returns a PHP resource 
that will be used for the other functions, or false on error.

- bool cryptopp_destroy_cipher(resource cipher) -- closes a cipher.

- bool cryptopp_set_rand_iv(resource cipher, int length [, int rand]) -- 
creates a random IV for cipher of the length specified. This is created via 
/dev/urandom or /dev/random on systems that support them; otherwise, it 
uses the standard rand() function. The rand argument can be used to specify 
the method used to create the IV, i.e. CRYPTOPP_RAND_URANDOM for 
/dev/urandom, CRYPTOPP_RAND_RAND for the rand() function, etc. Returns true 
on success, false on error. By default, win32 systems will likely use the 
rand() function, while systems that can provide either /dev/random or 
/dev/urandom will use one of them, preferably urandom.

- bool cryptopp_set_iv(resource cipher, string iv [, bool hex]) -- add a 
specific IV to the resource. hex is used to determine whether the IV being 
added is being given in hex or in binary, with binary being the default. 
True/false on success/error.

- string cryptopp_get_iv(resource cipher [, bool hex]) -- returns the IV of 
resource or false on error. hex specifies whether the IV should be returned 
in binary or in hex, with binary being the default. false on error.

- bool cryptopp_set_mode(resource cipher, int mode) -- sets the mode of the 
cipher, i.e. 

Re: [PHP-DEV] Crypto++ extension happenings

2002-03-16 Thread derick

Hello,

I'm currently designing a new 'encryption' extension which should be able 
to have different backend encryption libaries like mcrypt and crypto++. 
however this extension will be developped with an OO approach and for ZE2. 
Th eidea is only in my mind at this moment, but I'm sure we can get a API 
defined which supports both of these libraries. What do you think of this?

Derick

On Sat, 16 Mar 2002, J Smith wrote:

 
 As I reluctantly mentioned a few weeks ago, I'm working on a PHP crypto 
 extension that uses Crypto++, a C++ library that provides implementations 
 for a bunch of crypto and hash algorithms. I was reluctant to bring it up 
 because I didn't know if I was going to finish it at all, and I didn't want 
 to get anybody's hopes up. The rationale behind the extension was partially 
 because we need a crypto library at work that we can use on win32 platforms 
 for a Windows Media Services plugin and one that PHP can use to create 
 ciphertext compatible with the aforementioned plugin. Unfortunately, 
 libmcrypt now requires cygwin on win32, and that sort of depedency would be 
 hellish for a WMS plugin. Crypto++ works fine on Windows using VC++, and 
 also works fine on UNIX systems using g++. Thus, a crypto extension for PHP 
 that works on both major platforms.
 
 Well, things have come along a bit further, and although the extension is 
 still quite a way from being complete, it's getting there. The basic 
 structure of the extension goes something like this:
 
 - there's a base class in C++ that a template inherits from that provides 
 the basic members and methods needed to encrypt and decrypt messages, along 
 with all of the usual methods that allow you to set the IV for a crypto 
 algorithm, the secret key, key length, mode (CBC, ECB, etc.), and 
 plaintext. The base class is pure abstract virtual, as is the template that 
 encapsulates it. (The template may seem a bit unnecessary, but it's used to 
 set things like the block size for ciphers with variable block sizes and 
 such. The base class it derives from makes things easier when dealing with 
 C++'s templates, which allows it to compile on several compilers, like g++ 
 and VC++, which all seem to disagree on how to use templates.)
 
 - from there, there are a bunch of classes that provide interfaces to the 
 various crypto algorithms, like Blowfish, 3-Way, Rijnadael, etc. So far, 
 I've only implemented those three algorithms, but others will be done 
 eventually, like the various CAST ciphers, RC5, etc. So far I've only 
 worked with block ciphers -- I haven't started anything with the stream 
 ciphers, like ARC4, WAKE, etc. All of the more popular block cipher modes 
 are working, like OFB, CFB, several CBC padding modes, etc.
 
 - on the hash side, there's a base hash class, from which various other 
 classes derive that provide interfaces to the hash algorithms. So far, MD5, 
 MD2, Panama and RIPEMD160 are the only hashes I've implemented; HAVAL and 
 others will follow. (Although, for whatever reason, HAVAL is being a bitch 
 and doesn't like compiling properly. Don't know why yet.)
 
 Besides all of the C++ stuff, I've been working on C functions to access 
 from the PHP code. (extern C stuff, that all jazz.) They're mostly 
 complete for the cipher side; I haven't started on C stuff for the hashes 
 yet.
 
 I'm thinking the PHP fuctions themselves will work much like the mcrypt 
 library, something like described below. These function names are all 
 subject to change, obviously, since I haven't started writing this portion 
 of the project yet. I may end up going the object oriented route using PHP 
 classes; I'm not sure yet. Depends on feedback. (And more importantly, what 
 work wants -- please remember, this extension is being worked on for my 
 job; the fact that I can allow everyone else to use it as free software is 
 a luxury.)
 
 
 - resource cryptopp_create_cipher(int cipher) -- cipher is a constant that 
 refers to the cipher algorithm, like CRYPTOPP_CIPHER_BLOWFISH, or 
 CRYPTOPP_CIPHER_AES for AES/Rijnadael. The function returns a PHP resource 
 that will be used for the other functions, or false on error.
 
 - bool cryptopp_destroy_cipher(resource cipher) -- closes a cipher.
 
 - bool cryptopp_set_rand_iv(resource cipher, int length [, int rand]) -- 
 creates a random IV for cipher of the length specified. This is created via 
 /dev/urandom or /dev/random on systems that support them; otherwise, it 
 uses the standard rand() function. The rand argument can be used to specify 
 the method used to create the IV, i.e. CRYPTOPP_RAND_URANDOM for 
 /dev/urandom, CRYPTOPP_RAND_RAND for the rand() function, etc. Returns true 
 on success, false on error. By default, win32 systems will likely use the 
 rand() function, while systems that can provide either /dev/random or 
 /dev/urandom will use one of them, preferably urandom.
 
 - bool cryptopp_set_iv(resource cipher, string iv [, bool hex]) -- add a 
 

Re: [PHP-DEV] Crypto++ extension happenings

2002-03-16 Thread J Smith


Doesn't sound like a bad idea. It's a bit more grand than what I had in 
mind for the Crypto++ extension, but I'd be willing to work on it. The main 
thing for me right now is that the Crypto++ extension is being done for 
work, and isn't entirely a hobby-type of thing. (Although I'm glad I work 
for a company that lets me combine the two, as we need a crypto library for 
PHP and I'm glad to be writing one that other people will be able to use.)

Because it's for work, I'm still going to have to work towards getting the 
Crypto++ library working in some general sense, but if this API you're 
thinking of can be used with it, I'm all for it. Let me know what you're 
thinking and we'll see what happens.

J


[EMAIL PROTECTED] wrote:

 Hello,
 
 I'm currently designing a new 'encryption' extension which should be able
 to have different backend encryption libaries like mcrypt and crypto++.
 however this extension will be developped with an OO approach and for ZE2.
 Th eidea is only in my mind at this moment, but I'm sure we can get a API
 defined which supports both of these libraries. What do you think of this?
 
 Derick
 


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




Re: [PHP-DEV] Re: ext/ming doesn't compile..

2002-03-16 Thread Wez Furlong

I think it is due to a forgotten stream_close in ming.c;
fix going in now...

--Wez.

On 17/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
 Compiles now nicely. (after my tiny typo fixes :)

Thanks :-)

 btw. This streams stuff leaks a bit:
 /main/streams.c(443) :  Freeing 0x0823EC1C (8 bytes)
 /main/streams.c(52) :  Freeing 0x0834ADDC (48 bytes)




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




Re: [PHP-DEV] Re: memory streams

2002-03-16 Thread Wez Furlong

Hi Markus,

(Sorry: I think I deleted the most relevant mail, so I'm replying to
this one :-)

Thanks for your work on the memory streams; I have a couple of
comments about them:

As they stand now, it is only possible to write in append mode.
(Or it looked that way from my quick glance).
It would be really good if data could be written over existing data
if the stream is seek()ed.

Using the memory stream as an alternative when you need to seek
a possibly unseekable stream is good for smaller data, but what
about larger data?
I'm planning an API that will give you back a seekable stream
so the logic to determine when and what type of alternative to
use; we can use memory streams, but I think I'd feel happier
if we used a tmpfile() stream instead; if the data is small
enough, a sensible OS would cache the file in memory anyway.

As for the strange problems you have in the exif extension;
if you switch to a stream opened with php_stream_fopen_tmpfile(),
do you still have the same troubles? (So we can try and pin
it down!).

--Wez.


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




Re: [PHP-DEV] Re: memory streams

2002-03-16 Thread Marcus Börger

At 02:56 17.03.2002, Wez Furlong wrote:
Hi Markus,

(Sorry: I think I deleted the most relevant mail, so I'm replying to
this one :-)

Thanks for your work on the memory streams; I have a couple of
comments about them:

As they stand now, it is only possible to write in append mode.
(Or it looked that way from my quick glance).
It would be really good if data could be written over existing data
if the stream is seek()ed.

they do an auto resize so append will work but you can also use
seek to overwrite in a memory stream.


Using the memory stream as an alternative when you need to seek
a possibly unseekable stream is good for smaller data, but what
about larger data?

Yes this is only the first commit just going on with an automatic
stream that switches to temporary files if needed. I also thought
about having a configure option wich allows memory streams to
always use temp files on machines where temp files are always
in memory.

Besides this point i only used ext/exif to have memory streams
tested.

I'm planning an API that will give you back a seekable stream
so the logic to determine when and what type of alternative to
use; we can use memory streams, but I think I'd feel happier
if we used a tmpfile() stream instead; if the data is small
enough, a sensible OS would cache the file in memory anyway.

Mybe we should combine our work but go on you worked out
a *very* nice api and did a great work for php!


As for the strange problems you have in the exif extension;
if you switch to a stream opened with php_stream_fopen_tmpfile(),
do you still have the same troubles? (So we can try and pin
it down!).

Check this later...


--Wez.


--
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: memory streams

2002-03-16 Thread Marcus Börger


Date: Sun, 17 Mar 2002 04:16:07 +0100
To: Wez Furlong [EMAIL PROTECTED]
From: Marcus Börger [EMAIL PROTECTED]
Subject: Re: [PHP-DEV] Re: memory streams

As for the strange problems you have in the exif extension;
if you switch to a stream opened with php_stream_fopen_tmpfile(),
do you still have the same troubles? (So we can try and pin
it down!).

Yep i tried it and
Segmentation fault (core dumped)
when setting destro = NULL it works..

Tracked it down to function php_stream_open_url.
I changed
 wrapper = php_stream_http_wrapper;
//  if (FAILURE == zend_hash_find(url_stream_wrappers_hash, 
(char*)protocol, n, (void**)wrapper)) {
//  wrapper = NULL;
//  protocol = NULL;
//  }

then it is o.k.: wrapper == php_stream_http_wrapper
but when using zend_hash_find it fails

marcus



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




Re: [PHP-DEV] Re: ext/ming doesn't compile..r

2002-03-16 Thread Jani Taskinen


Those leaks weren't ming related at all.
Just 'normal' stuff in PHP. ie. file(), fopen(),
include()..etc.

--Jani


On Sun, 17 Mar 2002, Wez Furlong wrote:

I think it is due to a forgotten stream_close in ming.c;
fix going in now...

--Wez.

On 17/03/02, Jani Taskinen [EMAIL PROTECTED] wrote:
 Compiles now nicely. (after my tiny typo fixes :)

Thanks :-)

 btw. This streams stuff leaks a bit:
 /main/streams.c(443) :  Freeing 0x0823EC1C (8 bytes)
 /main/streams.c(52) :  Freeing 0x0834ADDC (48 bytes)





-- 


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