[PHP-DEV] PHP 5 Bug Summary Report

2009-03-02 Thread internals
 PHP 5 Bug Database summary - http://bugs.php.net/

 Num Status Summary (1308 total -- which includes 814 feature requests)
===[*Directory/Filesystem functions]
46990 Assigned   Passing UTF8 strings to filesystem functions produce wrong 
filenames
===[*General Issues]==
47286 Assigned   oci8 and pdo_oci aren't in 5.3.0B1 builds
===[Apache related]===
47503 Open   apache start terminated
===[Apache2 related]==
32220 Assigned   [PATCH] thread_resources for thread not getting freed when 
apache kills thread
44625 Assigned   php.ini doesn't show changed variable value for extension_dir 
and include_path
46479 Open   virtual() prints output to browser
46481 Open   apache_lookup_uri() draws blank if Apache auth enabled
===[Arrays related]===
46283 Open   array_merge_recursive() Warning recursion detected in...
47221 Open   no result from array_diff()
===[BC math related]==
44995 Open   bcpowmod() using a scale function always returns 0
46564 Open   bcmod( '1071', '357.5' ) returns '0'
===[Bzip2 Related]
29521 Assigned   compress.bzip2 wrapper
===[Calendar related]=
40213 Suspended  easter_date() returns wrong timestamp if ...
44474 Open   GregorianToJD wrong return value
===[CGI related]==
43313 Open   getopt doesn't handle unknown parameters
45217 Open   crash if -z and -m are used together
46305 Open   Exception handler not invoked when using -r command line option
47042 Open   php cgi sapi is incorrectly removing the SCRIPT_FILENAME for 
non apache
47412 Open   PHP_MSHUTDOWN_FUNCTION not being called under FastCGI
47540 Open   CLI can go into an infinite write() loop when 
ignore_user_abort(true)
===[Class/Object related]=
45199 Assigned   Serializing objects with private properties
46140 Open   Unserializing with __wakeup that removes child causes 
subsequent refs to shift
46812 Open   get_class_vars() does not include visible private variable 
looking at subclass
47405 Open   error reports wrong file/line
47525 Open   value returned from __call copied prematurely
===[COM related]==
31327 Assigned   chinese char and word problem
32099 Assigned   After opening ADO connection and closing it repeatedly, Apache 
stops service
34253 Assigned   COM binary object/array issue (question marks?)
35875 Assigned   IE event failure upon scheduling script
36360 Assigned   PHP crashes when accessing an object that was just create by 
parent object
37562 Assigned   Unable to lookup ParameterFieldDefinitions
37899 Assigned   [PATCH] php_char_to _OLECHAR copies junk bytes
37965 Assigned   Multi-dimensional array between PHP and COM
38719 Assigned   COM Error during accessing function VirtualMachines
40424 Assigned   Fatal error when setting the value of COM object's property 
array
40581 Assigned   Pass Struct type to COM object from PHP
40664 Assigned   String conversion functions wrong for multibyte chars
41055 Assigned   DOTNET not instantiating fully-pathed assembly
41078 Assigned   Its not possible to call Static dotNet Classes with dotnet
41189 Assigned   Multi-dimensional array in COM function causes hang
41368 Assigned   ADODB.Recordset ActiveConnection property - can't set with PHP 
5.2.1+
41388 Assigned   Error in COM Object results
41577 Assigned   DOTNET is successful once per server run
42413 Assigned   Cannot iterate IE's event object
42551 Assigned   new COM(HTMLFile) = warnings
42585 Assigned   die() in event handler = PHP hangs
43275 Open   get_class problem with COM objects
43432 Open   Fatal error when setting the value of COM object's Attribute 
property
43470 Open   COM API fails to correctly return [OUT]  VT_PTR references
43506 Open   com_get_active_object always fails
43521 Open   Problem with Variant/Parameters
43838 Open   variant_set with IE leads to hang
43897 Open   $ie not cleared on IE quit
44256 Open   Pb with COM in PHP5
44578 Open   Strange Behavior of PHP using COM Object
45280 Open   Reflection of instantiated COM classes causes PHP to crash.
45704 Open   $exception-getCode() always return 0x80020009 even when it 
shouldn't
45855 Open   COM-Problem with GET/SET, using same method name (but with 
different arg count)
46224 Open   Cannot instantiate .Net object (ABCpdf 6.1 .Net)
46522 Open   Problem using new com
47401 Open   Can't instantiate VARIANT 

Re: [PHP-DEV] phar update

2009-03-02 Thread Igor Feghali
Hello Greg,

AIX 5.3.0.0, PPC 64bit:

297 passed
214 skipped

I am doing a second run right now to see if something goes different.
Please let me know if you want the test log as well.

Regards,
Igor Feghali.

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



Re: [PHP-DEV] phar update

2009-03-02 Thread Greg Beaver
Igor Feghali wrote:
 Hello Greg,
 
 AIX 5.3.0.0, PPC 64bit:
 
 297 passed
 214 skipped
 
 I am doing a second run right now to see if something goes different.
 Please let me know if you want the test log as well.

Hi Igor,

You can cut down on the skipped tests by building bz2, zlib, and openssl.

Thanks,
Greg

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



[PHP-DEV] Patch and test cases too for

2009-03-02 Thread Richard Quadling
Hi.

Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch
to the unit tests too.

Any chance this could get committed to 5.2+



Index: tests/002.phpt
===
RCS file: /repository/php-src/ext/json/tests/002.phpt,v
retrieving revision 1.3
diff -u -r1.3 002.phpt
--- tests/002.phpt  27 May 2008 18:16:03 -  1.3
+++ tests/002.phpt  2 Mar 2009 16:16:13 -
@@ -1,4 +1,4 @@
---TEST--
+--TEST--
 json_encode() tests
 --SKIPIF--
 ?php if (!extension_loaded(json)) print skip; ?
@@ -8,8 +8,14 @@
 var_dump(json_encode());
 var_dump(json_encode(NULL));
 var_dump(json_encode(TRUE));
+
 var_dump(json_encode(array(=)));
 var_dump(json_encode(array(array(1;
+var_dump(json_encode(array());
+
+var_dump(json_encode(array(=)), PHP_JSON_FORCE_HASH);
+var_dump(json_encode(array(array(1))),PHP_JSON_FORCE_HASH);
+var_dump(json_encode(array(),PHP_JSON_FORCE_HASH);

 var_dump(json_encode(1));
 var_dump(json_encode(руссиш));
@@ -23,6 +29,10 @@
 string(4) true
 string(7) {:}
 string(5) [[1]]
+string(2) []
+string(7) {:}
+string(15) {0:{0:1}}
+string(2) {}
 string(1) 1
 string(38) \u0440\u0443\u0441\u0441\u0438\u0448
 Done



-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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

Re: [PHP-DEV] Patch and test cases too for

2009-03-02 Thread Scott MacVicar
Richard Quadling wrote:
 Hi.
 
 Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch
 to the unit tests too.
 
 Any chance this could get committed to 5.2+
 

I'm too convinced of the parameter name and I don't think its something
that should be added to 5.2.9 since its a feature.

Scott

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



Re: [PHP-DEV] phar update

2009-03-02 Thread Igor Feghali
 You can cut down on the skipped tests by building bz2, zlib, and openssl.

350 passed
161 skipped

By the way, phar complained Archive.php wasn't found (no PEAR
installed in this machine) in `make` time. Does it affects anything ?

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



Re: [PHP-DEV] Patch and test cases too for

2009-03-02 Thread Richard Quadling
2009/3/2 Scott MacVicar sc...@macvicar.net:
 Richard Quadling wrote:
 Hi.

 Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch
 to the unit tests too.

 Any chance this could get committed to 5.2+


 I'm too convinced of the parameter name and I don't think its something
 that should be added to 5.2.9 since its a feature.

 Scott


5.3+ would be OK then.

As to the param name, I'm not actually changing the name, just adding
another flag.

In javascript's terminology,the output is an array ...

[]

or a hash

{}

So forcing a hash for arrays is pretty much what would be wanted and I
as I comment in the request, we have a force option when coming FROM
json data ... json_decode ( string $json [, bool $assoc= false [, int
$depth= 512 ]] )

And the name of the param here is appropriate to PHP's use (assoc is
not part of JSON's or JS's terminology).

If you can think of a better name for the flag, then I'd be glad to use it.

Richard.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] Patch and test cases too for

2009-03-02 Thread Scott MacVicar
Richard Quadling wrote:
 2009/3/2 Scott MacVicar sc...@macvicar.net:
 Richard Quadling wrote:
 Hi.

 Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch
 to the unit tests too.

 Any chance this could get committed to 5.2+

 I'm too convinced of the parameter name and I don't think its something
 that should be added to 5.2.9 since its a feature.

 Scott

 
 5.3+ would be OK then.
 
 As to the param name, I'm not actually changing the name, just adding
 another flag.
 
 In javascript's terminology,the output is an array ...
 
 []
 
 or a hash
 
 {}
 
 So forcing a hash for arrays is pretty much what would be wanted and I
 as I comment in the request, we have a force option when coming FROM
 json data ... json_decode ( string $json [, bool $assoc= false [, int
 $depth= 512 ]] )
 
 And the name of the param here is appropriate to PHP's use (assoc is
 not part of JSON's or JS's terminology).
 
 If you can think of a better name for the flag, then I'd be glad to use it.
 

The JSON spec refers to them as arrays or objects though, as does our
documentation I believe.

PHP_JSON_FORCE_OBJECT

I however have another patch for more strict encoding so I'll try to
roll this in a single update.

Scott

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



[PHP-DEV] Stream chunk size

2009-03-02 Thread Jonathan Bond-Caron
Hi everyone, I have a question about streams and the maximum ‘chunk size’ of
8192. 

 

I’ve read README.STREAMS and found these slides by Wez:

http://netevil.org/blog/2008/07/slides-php-streams

 

While trying to write an Amazon S3 stream wrapper and I ran into an issue
with large files: 

 

$fp = fopen('s3://mvtest/large.html', 'r'); // 30 mb

 

// This is OK

fseek($fp, 10);

echo fread($fp, 100) . \n; // 100 bytes

echo fread($fp, 100) . \n; // 100 bytes

 

// This is OK (according to documentation, max 8192 bytes) 

echo fread($fp, 65536) . \n; // 8192 bytes

 

My issue is I would like to request larger ‘chunks’, something like:

stream_set_chunk_size($fp, 65536);

 

echo fread($fp, 65536) . \n; // 65536 bytes

echo fread($fp, 10) . \n; // 65536 bytes

echo fread($fp, 15) . \n; // 15 bytes

 

Then copying to a file and avoiding memory issues:

 

$wfp = fopen(‘/tmp/large.html’);

stream_copy_to_stream($fp, $wfp); // read 65536 byte chunks, write default
8192 byte chunks

 

stream_set_chunk_size($wfp, 65536);

stream_copy_to_stream($fp, $wfp); // read  write 65536 byte chunks

copy('s3://mvtest/large.html', '/tmp/large.html'); // read  write default
8192 byte chunks

 

Going through the PHP 5.2 source, it looks like there’s support for it but
at some places the 8192 ‘chunk’ is hardcoded:

 

#define CHUNK_SIZE 8192

 

PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest,
size_t maxlen STREAMS_DC TSRMLS_DC)

{

char buf[CHUNK_SIZE]; ß  Is there any reason the php_stream
*src-chunk_size isn’t used?

 

stream_set_chunk_size($fp, 65536); // Would mean src-chunk_size = 65536;

 

I’d like to try to write a patch for it, anything that I should know about
streams and why the limit is there?



[PHP-DEV] XOR congruentation breaks PHP

2009-03-02 Thread Kenan R Sulayman
Hey Folks!

I've been writing some code for a small project and saw PHP crashing every
time.

The Code:

?php
/*
 * XOR buffer v1
 */
class XoRb {
/* Set buffer ( - write genPad to file ) in bit */
public $buffer = 4096;

public function encrypt($InputString, $KeyPhrase){
$KeyPhraseLength = strlen($KeyPhrase);
for ($i = 0, $strlen = strlen($InputString); $i 
$strlen; $i++)
$InputString[$i] = chr( (
ord($InputString[$i]) ^ ord( $KeyPhrase[ ( $i % $KeyPhraseLength ) ] ) ) );
return $InputString;
}
public function genPad ( $input ) {
for ( $i = 1, $o = null, $strlen = strlen($input);
$i = $strlen; ++$i )
$o .= chr( mt_rand( 10, 300 ) );
return $o;
}
public function writePad ( $file, $byte, $buffer = false ) {
$fo = fopen( $file, a+);
if ( !$buffer ) $buffer = $this - buffer;
if ( $byte  $buffer ) $buffer = $byte;
for ( $i = 1, $o = null; $i = $byte; ++$i ) {
$o .= chr( mt_rand( 10, 300 ) );
if ( strlen( $o ) = $buffer + 20 )
print Writing buffer  . chr ( $i %
$buffer ) . \n and fwrite( $fo, $o ) and $o = null;
}
}
}
$xor = new XoRb;

$xor - buffer = 1024;
$xor - writePad ( 'int.dat', 8192 * 1000 );

/* //Interface
while ( true ) {
print Input: ;
$input = trim(fgets(fopen(php://stdin, a+)));
print \tPad:  . ($str = $xr-genPad($input));
print \n\tOutput:  . $xr-encrypt($input, $str) .
\n\n;
}
*/
?

PHP now breaks at:
  chr ( $i % $buffer ) ,
in:
if ( strlen( $o ) = $buffer + 20 ) print Writing buffer  . chr ( $i %
$buffer ) . \n and fwrite( $fo, $o ) and $o = null;
while $I = 5k ± 2k.


Tested within CLI on Windows, I don't think, it'll break on Linux, nor
Apple.

--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


Re: [PHP-DEV] Patch and test cases too for

2009-03-02 Thread Richard Quadling
2009/3/2 Scott MacVicar sc...@macvicar.net:
 Richard Quadling wrote:
 2009/3/2 Scott MacVicar sc...@macvicar.net:
 Richard Quadling wrote:
 Hi.

 Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch
 to the unit tests too.

 Any chance this could get committed to 5.2+

 I'm too convinced of the parameter name and I don't think its something
 that should be added to 5.2.9 since its a feature.

 Scott


 5.3+ would be OK then.

 As to the param name, I'm not actually changing the name, just adding
 another flag.

 In javascript's terminology,the output is an array ...

 []

 or a hash

 {}

 So forcing a hash for arrays is pretty much what would be wanted and I
 as I comment in the request, we have a force option when coming FROM
 json data ... json_decode ( string $json [, bool $assoc= false [, int
 $depth= 512 ]] )

 And the name of the param here is appropriate to PHP's use (assoc is
 not part of JSON's or JS's terminology).

 If you can think of a better name for the flag, then I'd be glad to use it.


 The JSON spec refers to them as arrays or objects though, as does our
 documentation I believe.

 PHP_JSON_FORCE_OBJECT

 I however have another patch for more strict encoding so I'll try to
 roll this in a single update.

 Scott


When it is in JSON, it isn't an object, but an object hash, similar,
as I understand things, to the differences between a class definition
and an instance. Or, I suppose more like an object serialization and
an object.

PHP_JSON_FORCE_OBJECT would be ideal.

Thank you.

-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] XOR congruentation breaks PHP

2009-03-02 Thread Christopher Jones



Kenan R Sulayman wrote:

Hey Folks!

I've been writing some code for a small project and saw PHP crashing every
time.


Please test the latest snapshot from http://snaps.php.net/.  If the problem
still exists, log a bug at http://bugs.php.net/ with version and platform 
details.

--
Email: christopher.jo...@oracle.com  Tel: +1 650 506 8630
Twitter:  http://twitter.com/ghrdFree PHP Book: http://tinyurl.com/UGPOM

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



Re: [PHP-DEV] Patch and test cases too for

2009-03-02 Thread Ilia Alshanetsky

I believe that this is a feature, so it would not go into 5.2, sorry.


Ilia Alshanetsky




On 2-Mar-09, at 11:21 AM, Richard Quadling wrote:


Hi.

Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch
to the unit tests too.

Any chance this could get committed to 5.2+



Index: tests/002.phpt
===
RCS file: /repository/php-src/ext/json/tests/002.phpt,v
retrieving revision 1.3
diff -u -r1.3 002.phpt
--- tests/002.phpt  27 May 2008 18:16:03 -  1.3
+++ tests/002.phpt  2 Mar 2009 16:16:13 -
@@ -1,4 +1,4 @@
---TEST--
+--TEST--
json_encode() tests
--SKIPIF--
?php if (!extension_loaded(json)) print skip; ?
@@ -8,8 +8,14 @@
var_dump(json_encode());
var_dump(json_encode(NULL));
var_dump(json_encode(TRUE));
+
var_dump(json_encode(array(=)));
var_dump(json_encode(array(array(1;
+var_dump(json_encode(array());
+
+var_dump(json_encode(array(=)), PHP_JSON_FORCE_HASH);
+var_dump(json_encode(array(array(1))),PHP_JSON_FORCE_HASH);
+var_dump(json_encode(array(),PHP_JSON_FORCE_HASH);

var_dump(json_encode(1));
var_dump(json_encode(руссиш));
@@ -23,6 +29,10 @@
string(4) true
string(7) {:}
string(5) [[1]]
+string(2) []
+string(7) {:}
+string(15) {0:{0:1}}
+string(2) {}
string(1) 1
string(38) \u0440\u0443\u0441\u0441\u0438\u0448
Done



--
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



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



Re: [PHP-DEV] Patch and test cases too for

2009-03-02 Thread Richard Quadling
2009/3/2 Ilia Alshanetsky i...@prohost.org:
 I believe that this is a feature, so it would not go into 5.2, sorry.


 Ilia Alshanetsky


That's OK. Just like to try these things sometimes.




 On 2-Mar-09, at 11:21 AM, Richard Quadling wrote:

 Hi.

 Regarding http://bugs.php.net/bug.php?id=47493, I've supplied a patch
 to the unit tests too.

 Any chance this could get committed to 5.2+



 Index: tests/002.phpt
 ===
 RCS file: /repository/php-src/ext/json/tests/002.phpt,v
 retrieving revision 1.3
 diff -u -r1.3 002.phpt
 --- tests/002.phpt      27 May 2008 18:16:03 -      1.3
 +++ tests/002.phpt      2 Mar 2009 16:16:13 -
 @@ -1,4 +1,4 @@
 ---TEST--
 +--TEST--
 json_encode() tests
 --SKIPIF--
 ?php if (!extension_loaded(json)) print skip; ?
 @@ -8,8 +8,14 @@
 var_dump(json_encode());
 var_dump(json_encode(NULL));
 var_dump(json_encode(TRUE));
 +
 var_dump(json_encode(array(=)));
 var_dump(json_encode(array(array(1;
 +var_dump(json_encode(array());
 +
 +var_dump(json_encode(array(=)), PHP_JSON_FORCE_HASH);
 +var_dump(json_encode(array(array(1))),PHP_JSON_FORCE_HASH);
 +var_dump(json_encode(array(),PHP_JSON_FORCE_HASH);

 var_dump(json_encode(1));
 var_dump(json_encode(руссиш));
 @@ -23,6 +29,10 @@
 string(4) true
 string(7) {:}
 string(5) [[1]]
 +string(2) []
 +string(7) {:}
 +string(15) {0:{0:1}}
 +string(2) {}
 string(1) 1
 string(38) \u0440\u0443\u0441\u0441\u0438\u0448
 Done



 --
 -
 Richard Quadling
 Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
 Standing on the shoulders of some very clever giants!

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





-- 
-
Richard Quadling
Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498r=213474731
Standing on the shoulders of some very clever giants!

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



Re: [PHP-DEV] XOR congruentation breaks PHP

2009-03-02 Thread Kenan R Sulayman
Hello Christopher!

It crashes now at $i = 40k ± 5k, while ( 5k ~ 0.5 second ).
Rather ugly, isn't it ?

Thanks,
--
(c) Kenan Sulayman
Freelance Designer and Programmer

Life's Live Poetry


2009/3/2 Christopher Jones christopher.jo...@oracle.com



 Kenan R Sulayman wrote:

 Hey Folks!

 I've been writing some code for a small project and saw PHP crashing every
 time.


 Please test the latest snapshot from http://snaps.php.net/.  If the
 problem
 still exists, log a bug at http://bugs.php.net/ with version and platform
 details.

 --
 Email: christopher.jo...@oracle.com  Tel: +1 650 506 8630
 Twitter:  http://twitter.com/ghrdFree PHP Book:
 http://tinyurl.com/UGPOM



Re: [PHP-DEV] phar update

2009-03-02 Thread Marcus Boerger
Hello Igor,

Monday, March 2, 2009, 5:31:51 PM, you wrote:

 You can cut down on the skipped tests by building bz2, zlib, and openssl.

 350 passed
 161 skipped

 By the way, phar complained Archive.php wasn't found (no PEAR
 installed in this machine) in `make` time. Does it affects anything ?


No, it just limits the capabilities of the phar command line tool.

Best regards,
 Marcus


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



RE: [PHP-DEV] Stream chunk size

2009-03-02 Thread Andi Gutmans
I don't see a fundamental issue why it could not be arbitrary.
The only challenge which may be an issue is that this code clearly allocates 
the buffer on the stack for what are probably performance reasons. If you allow 
arbitrary chunk size and use alloca() (do_alloca()) for stack allocation you 
might kill the stack.
I suggest you do some performance tests and if you need to keep it on the stack 
then create some arbitrary limit like 8K and use stack below that and use heap 
above that (code will be uglier).

Andi

 -Original Message-
 From: Jonathan Bond-Caron [mailto:jbo...@openmv.com]
 Sent: Monday, March 02, 2009 8:48 AM
 To: 'PHP Developers Mailing List'
 Subject: [PHP-DEV] Stream chunk size
 
 Hi everyone, I have a question about streams and the maximum 'chunk size' of
 8192.
 
 
 
 I've read README.STREAMS and found these slides by Wez:
 
 http://netevil.org/blog/2008/07/slides-php-streams
 
 
 
 While trying to write an Amazon S3 stream wrapper and I ran into an issue
 with large files:
 
 
 
 $fp = fopen('s3://mvtest/large.html', 'r'); // 30 mb
 
 
 
 // This is OK
 
 fseek($fp, 10);
 
 echo fread($fp, 100) . \n; // 100 bytes
 
 echo fread($fp, 100) . \n; // 100 bytes
 
 
 
 // This is OK (according to documentation, max 8192 bytes)
 
 echo fread($fp, 65536) . \n; // 8192 bytes
 
 
 
 My issue is I would like to request larger 'chunks', something like:
 
 stream_set_chunk_size($fp, 65536);
 
 
 
 echo fread($fp, 65536) . \n; // 65536 bytes
 
 echo fread($fp, 10) . \n; // 65536 bytes
 
 echo fread($fp, 15) . \n; // 15 bytes
 
 
 
 Then copying to a file and avoiding memory issues:
 
 
 
 $wfp = fopen('/tmp/large.html');
 
 stream_copy_to_stream($fp, $wfp); // read 65536 byte chunks, write default
 8192 byte chunks
 
 
 
 stream_set_chunk_size($wfp, 65536);
 
 stream_copy_to_stream($fp, $wfp); // read  write 65536 byte chunks
 
 copy('s3://mvtest/large.html', '/tmp/large.html'); // read  write default
 8192 byte chunks
 
 
 
 Going through the PHP 5.2 source, it looks like there's support for it but
 at some places the 8192 'chunk' is hardcoded:
 
 
 
 #define CHUNK_SIZE 8192
 
 
 
 PHPAPI size_t _php_stream_copy_to_stream(php_stream *src, php_stream *dest,
 size_t maxlen STREAMS_DC TSRMLS_DC)
 
 {
 
 char buf[CHUNK_SIZE]; ß  Is there any reason the php_stream
 *src-chunk_size isn't used?
 
 
 
 stream_set_chunk_size($fp, 65536); // Would mean src-chunk_size = 65536;
 
 
 
 I'd like to try to write a patch for it, anything that I should know about
 streams and why the limit is there?


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