Bug #50503 [Com]: proc_open loses constants with $env

2011-08-17 Thread augf87 at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=50503&edit=1

 ID: 50503
 Comment by: augf87 at gmail dot com
 Reported by:tidustracker at freenet dot de
 Summary:proc_open loses constants with $env
 Status: Assigned
 Type:   Bug
 Package:Program Execution
 Operating System:   win32 only - Windows Vista
 PHP Version:5.3.1
 Assigned To:pajoye
 Block user comment: N
 Private report: N

 New Comment:

I´m having the same problem. Same conditions and same results. I´m using PHP 
5.3.5, os Windows XP 32bit.


Previous Comments:

[2009-12-28 14:55:38] paj...@php.net

Will take a look early in January for 5.3.2


[2009-12-19 13:23:52] carsten_sttgt at gmx dot de

> but that's not a proc_open bug then.

Correct, but I think it there a basic problem with proc_open on Windows. In 
this case with the environment.

Just see this example:
http://de.php.net/manual/en/function.proc-open.php#function.proc-open.examples

It's not working on Windows (returning 1 and no output). If you change:
- $process = proc_open('php', $descriptorspec, $pipes, $cwd, $env);
+ $process = proc_open('php', $descriptorspec, $pipes);

it's "working". But also no output, because the environment $_ENV is empty 
(even the new process should inherit the current ENV).

if you now change:
- write($pipes[0], '');
+ write($pipes[0], '');

you can see there is an output. But as long $env is an array (and not null) the 
script is not working). And so it's also not possible to define new env 
variables for the new process.

Regards,
Carsten


[2009-12-17 01:31:51] paj...@php.net

but that's not a proc_open bug then. PHP has no idea about what has called it. 
I'm not sure either why they are not defined in this case.




[2009-12-17 01:22:23] tidustracker at freenet dot de

The script is working very well? Adjust the two paths and run it in CLI. The 
ENVs are not the problem, the ENVs cause the problem.

The php example code starts via proc_open a new php process.
With an passed $env array to proc_open, the two constants SOL_TCP and SOL_UDP 
described at http://php.net/manual/en/sockets.constants.php are missing in the 
new php process.


[2009-12-17 01:01:51] paj...@php.net

Please provide a valid/working script.

The easiest way to verify that all ENVs are correctly defined is to simply echo 
them out (echo %ENVNAME%).




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

https://bugs.php.net/bug.php?id=50503


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


Bug #55283 [Ver]: SSL options set by mysqli_ssl_set ignored for MySQLi persistent connections

2011-08-17 Thread andrey
Edit report at https://bugs.php.net/bug.php?id=55283&edit=1

 ID: 55283
 Updated by: and...@php.net
 Reported by:aleksey at wepay dot com
 Summary:SSL options set by mysqli_ssl_set ignored for MySQLi
 persistent connections
 Status: Verified
 Type:   Bug
 Package:MySQLi related
 Operating System:   Cent OS
 PHP Version:5.3.6
 Assigned To:mysql
 Block user comment: N
 Private report: N

 New Comment:

I don't get your comment :(


Previous Comments:

[2011-08-18 01:34:33] spam2 at rhsoft dot net

well i guess this change results in connections hanging around and 
after a hughe timeout filling my mailbox with cron-mails since 
upgraded to 5.3.7 using MYSQLND so "Changing mysqli to make libmysql happy will 
cause leaks with mysqlnd" seems to be true -> but why done this change if 
knowing it?

mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $
without ssl_set() all works fine but unencyrpted 

how can i revert this change for the 5.3.7-final.tar.bz2?
___

MySQL server has gone away

 $this->ssl_key = '/etc/mysql-ssl/client.pem';
 $this->ssl_crt = '/etc/mysql-ssl/client.pem';
 $this->ssl_ca  = '/etc/mysql-ssl/ca.crt';

$>conn->ssl_set($this->ssl_key, $this->ssl_crt, $this->ssl_ca, NULL, NULL);


[2011-08-05 13:39:28] and...@php.net

Automatic comment from SVN on behalf of andrey
Revision: http://svn.php.net/viewvc/?view=revision&revision=314330
Log: Fix for bug #55283 SSL options set by mysqli_ssl_set ignored for MySQLi 
persistent connections


[2011-08-05 13:17:59] u...@php.net

The actual issue here is in mysqlnd (or in the mysqli user API, however you put 
it :-)): if using mysqli_init() to create a connection object we don't yet know 
if it needs to be persistent or not. mysqli was changed to meet the needs of 
mysqlnd. Unfortunately, this has an unforeseen side-effect on mysqli @ libmysql 
[@ SSL]. Changing mysqli to make libmysql happy will cause leaks with mysqlnd. 

This needs some think time.


[2011-08-05 11:53:47] u...@php.net

Reproducible with PHP 5.3.7RC4-dev (cli) (built: Jul 26 2011 17:35:20) (DEBUG) 
using *libmysql* to connect to 5.1.45-debug-log 

Configure Command =>  './configure'  '--with-mysql=mysqlnd' 
'--with-mysqli=/usr/local/mysql/bin/mysql_config' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config' '--enable-debug' 
'--enable-maintainer-zts' '--enable-mysqlnd-ms' '--enable-mysqlenterprise' 
'--enable-mysqlnd-uh' '--enable-pcntl'

nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_3> sapi/cli/php bar.php
array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(18) "DHE-RSA-AES256-SHA"
}
array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(7) "RC4-MD5"
}


[2011-07-26 00:25:00] aleksey at wepay dot com

Please note that while the example shows the problem with the cipher, all other 
parameters are also ignored. In particular, ssl cert info is critical.




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

https://bugs.php.net/bug.php?id=55283


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


Bug #55283 [Com]: SSL options set by mysqli_ssl_set ignored for MySQLi persistent connections

2011-08-17 Thread spam2 at rhsoft dot net
Edit report at https://bugs.php.net/bug.php?id=55283&edit=1

 ID: 55283
 Comment by: spam2 at rhsoft dot net
 Reported by:aleksey at wepay dot com
 Summary:SSL options set by mysqli_ssl_set ignored for MySQLi
 persistent connections
 Status: Verified
 Type:   Bug
 Package:MySQLi related
 Operating System:   Cent OS
 PHP Version:5.3.6
 Assigned To:mysql
 Block user comment: N
 Private report: N

 New Comment:

well i guess this change results in connections hanging around and 
after a hughe timeout filling my mailbox with cron-mails since 
upgraded to 5.3.7 using MYSQLND so "Changing mysqli to make libmysql happy will 
cause leaks with mysqlnd" seems to be true -> but why done this change if 
knowing it?

mysqlnd 5.0.8-dev - 20102224 - $Revision: 310735 $
without ssl_set() all works fine but unencyrpted 

how can i revert this change for the 5.3.7-final.tar.bz2?
___

MySQL server has gone away

 $this->ssl_key = '/etc/mysql-ssl/client.pem';
 $this->ssl_crt = '/etc/mysql-ssl/client.pem';
 $this->ssl_ca  = '/etc/mysql-ssl/ca.crt';

$>conn->ssl_set($this->ssl_key, $this->ssl_crt, $this->ssl_ca, NULL, NULL);


Previous Comments:

[2011-08-05 13:39:28] and...@php.net

Automatic comment from SVN on behalf of andrey
Revision: http://svn.php.net/viewvc/?view=revision&revision=314330
Log: Fix for bug #55283 SSL options set by mysqli_ssl_set ignored for MySQLi 
persistent connections


[2011-08-05 13:17:59] u...@php.net

The actual issue here is in mysqlnd (or in the mysqli user API, however you put 
it :-)): if using mysqli_init() to create a connection object we don't yet know 
if it needs to be persistent or not. mysqli was changed to meet the needs of 
mysqlnd. Unfortunately, this has an unforeseen side-effect on mysqli @ libmysql 
[@ SSL]. Changing mysqli to make libmysql happy will cause leaks with mysqlnd. 

This needs some think time.


[2011-08-05 11:53:47] u...@php.net

Reproducible with PHP 5.3.7RC4-dev (cli) (built: Jul 26 2011 17:35:20) (DEBUG) 
using *libmysql* to connect to 5.1.45-debug-log 

Configure Command =>  './configure'  '--with-mysql=mysqlnd' 
'--with-mysqli=/usr/local/mysql/bin/mysql_config' 
'--with-pdo-mysql=/usr/local/mysql/bin/mysql_config' '--enable-debug' 
'--enable-maintainer-zts' '--enable-mysqlnd-ms' '--enable-mysqlenterprise' 
'--enable-mysqlnd-uh' '--enable-pcntl'

nixnutz@linux-fuxh:~/php/php-src/branches/PHP_5_3> sapi/cli/php bar.php
array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(18) "DHE-RSA-AES256-SHA"
}
array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(7) "RC4-MD5"
}


[2011-07-26 00:25:00] aleksey at wepay dot com

Please note that while the example shows the problem with the cipher, all other 
parameters are also ignored. In particular, ssl cert info is critical.


[2011-07-26 00:20:58] aleksey at wepay dot com

Description:

The MySQLi ignores SSL options set with mysqli_ssl_set() for persistent 
connections (works fine for non-persistent connections).

To reproduce:
1) Configure MySQL server with SSL support 
(http://dev.mysql.com/doc/refman/5.0/en/secure-connections.html)
2) Run the attached test script



Test script:
---
query("SHOW STATUS LIKE 'Ssl_cipher'");
var_dump($r->fetch_row());
}

/* non-persistent connection */
$link = mysqli_init();
mysqli_ssl_set($link, null, null, null, null, "RC4-MD5");
if (mysqli_real_connect($link, $host, $user, $pass, $db, $port, null, $flags)) {
$r = $link->query("SHOW STATUS LIKE 'Ssl_cipher'");
var_dump($r->fetch_row());
}


Expected result:

array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(18) "RC4-MD5"
}
array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(7) "RC4-MD5"
}


Actual result:
--
array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(18) "DHE-RSA-AES256-SHA"
}
array(2) {
  [0]=>
  string(10) "Ssl_cipher"
  [1]=>
  string(7) "RC4-MD5"
}







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


Bug #55445 [Asn->Csd]: Short echo tag still depends on short_open_tag setting

2011-08-17 Thread colder
Edit report at https://bugs.php.net/bug.php?id=55445&edit=1

 ID: 55445
 Updated by: col...@php.net
 Reported by:s...@php.net
 Summary:Short echo tag still depends on short_open_tag
 setting
-Status: Assigned
+Status: Closed
 Type:   Bug
 Package:*General Issues
 Operating System:   All
 PHP Version:5.4SVN-2011-08-17 (SVN)
 Assigned To:colder
 Block user comment: N
 Private report: N

 New Comment:

This bug has been fixed in SVN.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:

[2011-08-17 23:49:58] col...@php.net

Automatic comment from SVN on behalf of colder
Revision: http://svn.php.net/viewvc/?view=revision&revision=315119
Log: Fix bug #55445 (Incomplete implementation of 

Bug #55445 [Opn->Asn]: Short echo tag still depends on short_open_tag setting

2011-08-17 Thread colder
Edit report at https://bugs.php.net/bug.php?id=55445&edit=1

 ID: 55445
 Updated by: col...@php.net
 Reported by:s...@php.net
 Summary:Short echo tag still depends on short_open_tag
 setting
-Status: Open
+Status: Assigned
 Type:   Bug
 Package:*General Issues
 Operating System:   All
 PHP Version:5.4SVN-2011-08-17 (SVN)
-Assigned To:
+Assigned To:colder
 Block user comment: N
 Private report: N



Previous Comments:

[2011-08-17 22:44:56] s...@php.net

Description:

Use of Welcome 


Expected result:

$ php54 -d short_open_tag=0 t.php
 Welcome chris
$ php54 -d short_open_tag=1 t.php
 Welcome chris

Actual result:
--
$ php54 -d short_open_tag=0 t.php
 Welcome 
$ php54 -d short_open_tag=1 t.php
 Welcome chris






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


[PHP-BUG] Bug #55445 [NEW]: Short echo tag still depends on short_open_tag setting

2011-08-17 Thread s...@php.net
From: sixd
Operating system: All
PHP version:  5.4SVN-2011-08-17 (SVN)
Package:  *General Issues
Bug Type: Bug
Bug description:Short echo tag still depends on short_open_tag setting

Description:

Use of Welcome 


Expected result:

$ php54 -d short_open_tag=0 t.php
 Welcome chris
$ php54 -d short_open_tag=1 t.php
 Welcome chris

Actual result:
--
$ php54 -d short_open_tag=0 t.php
 Welcome 
$ php54 -d short_open_tag=1 t.php
 Welcome chris

-- 
Edit bug report at https://bugs.php.net/bug.php?id=55445&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55445&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55445&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55445&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55445&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55445&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55445&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55445&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55445&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55445&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55445&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55445&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55445&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55445&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55445&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55445&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55445&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55445&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55445&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55445&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55445&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55445&r=mysqlcfg



[PHP-BUG] Bug #55444 [NEW]: trans-sid enabled; PHPSESSID inserted after end of href on links

2011-08-17 Thread fatman at crackmonkey dot us
From: 
Operating system: Ubuntu 10.04.3 LTS
PHP version:  Irrelevant
Package:  Session related
Bug Type: Bug
Bug description:trans-sid enabled; PHPSESSID inserted after end of href on links

Description:

In more detail, OS:
Linux 2.6.32-32-server x86_64 #62-Ubuntu SMP Wed Apr 20 22:07:43 UTC 2011 

PHP 5.3.2-1ubuntu4.9 with Suhosin-Patch (cli) (built: May  3 2011
00:45:52)

This is the standard PHP package from Ubuntu Lucid's "main" repo. I did not

compile it. I have enabled the trans-
sid option.

When generating a long list of links, occasionally the trans-sid function
will 
miss the end of the "href" 
attribute and add "?PHPSESSID=73...07" outside the closing double quote
mark. 
eg:

gallery_36.jpg 
...
gallery_37.jpg 

Note that since it is outside the quote mark, it is generated with a "?"
instead 
of "&". This reliably 
happens on the "gallery_37.jpg" link, and the "gallery_18.jpg" link, and a
few 
others.

Test script:
---
The relevant loop:

  while ($row = mysql_fetch_assoc($result)) {
 $file = sanitise_html($row["filename"]);
 $title = sanitise_html($row["title"]);
?>
   
  
  
  
   
https://bugs.php.net/bug.php?id=55444&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55444&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55444&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55444&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55444&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55444&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55444&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55444&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55444&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55444&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55444&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55444&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55444&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55444&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55444&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55444&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55444&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55444&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55444&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55444&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55444&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55444&r=mysqlcfg



Bug #46025 [Com]: zend_bailout can deadlock APC

2011-08-17 Thread pierre at archlinux dot de
Edit report at https://bugs.php.net/bug.php?id=46025&edit=1

 ID: 46025
 Comment by: pierre at archlinux dot de
 Reported by:askalski at gmail dot com
 Summary:zend_bailout can deadlock APC
 Status: Feedback
 Type:   Bug
 Package:Reproducible crash
 Operating System:   redhat
 PHP Version:5.2.6
 Assigned To:gopalv
 Block user comment: N
 Private report: N

 New Comment:

This issue is still reproducable using php-fpm and PHP 5.3.6 with APC 3.1.9


Previous Comments:

[2010-11-07 21:08:38] fel...@php.net

Gopal, this issue has been already fixed?


[2010-06-24 18:52:07] askalski at gmail dot com

A note about the above patches:  They work with the stable 3.0.19 release of 
APC, but not the beta 3.1.3p1.  In the beta version, compilation was moved 
inside a HANDLE_BLOCK_INTERRUPTIONS/HANDLE_UNBLOCK_INTERRUPTIONS block, so the 
zend_bailout deferral is no longer safe.  For example, a syntax error in the 
script will result in a partially compiled opcode array to be cached in APC.  I 
don't yet have an alternate solution.


[2010-05-31 06:54:14] askalski at gmail dot com

I uploaded patches against the latest 5.1, 5.2, and 5.3 versions of PHP, for 
sites with production issues that can't afford to wait years for an upstream 
fix.


[2009-10-21 18:42:04] askalski at gmail dot com

We are using a modified 5.2 in production, so a patch against 5.2.11 (the 
latest release in that series) would be good.

Thanks,

Andy


[2009-10-21 18:01:00] sh...@php.net

Lucas Nealan and I are working on fixing some items in the signals patch, and 
would like to push forward on this getting integrated in core.  Would you be 
willing to try the patch for PHP to see if it corrects your problem?  It would 
be of great use to know that it fixes your specific issue.  If so let me know 
which specific version of PHP you want a patch against and I'll make sure we 
get you the latest one that cleanly patches against 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

https://bugs.php.net/bug.php?id=46025


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


[PHP-BUG] Req #55443 [NEW]: 4nd params double_encode

2011-08-17 Thread al at instrument dot pl dot ua
From: 
Operating system: any
PHP version:  5.3.6
Package:  *General Issues
Bug Type: Feature/Change Request
Bug description:4nd params double_encode

Description:

Path in Bug #43101: htmlentities(): double_quote vs. double_encode typo
---
>From manual page:
http://www.php.net/function.htmlspecialchars%23%D0%9E%D0%BF%D0%B8%D1%81%D0%B0%D0%BD%D0%B8%D0%B5
---
four params double_encode=true|false present in real, and absent in
documentation

Test script:
---
$links_str = "http://ya.ru?q=search&mmm";
$links_str =
htmlspecialchars($links_str,ENT_COMPAT,'UTF-8',$double_encode=false);


-- 
Edit bug report at https://bugs.php.net/bug.php?id=55443&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55443&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55443&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55443&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55443&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55443&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55443&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55443&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55443&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55443&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55443&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55443&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55443&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55443&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55443&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55443&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55443&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55443&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55443&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55443&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55443&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55443&r=mysqlcfg



[PHP-BUG] Bug #55442 [NEW]: ID3-0.2 Comments tag.

2011-08-17 Thread thephpguru at hotmai dot com
From: 
Operating system: Federa  13
PHP version:  5.3.6
Package:  Unknown/Other Function
Bug Type: Bug
Bug description:ID3-0.2 Comments tag.

Description:

---
THe Comments tag (COMM) is not appearing in ID3-0.2. I have verified that
the Comments tag is not null in EasyTag, Kid3 or a Flash application I have
that reads ID3 Tags.
---


Test script:
---
This file contains a 1.x tag";
}
if ($tag_version & ID3_V1_1) {
echo "This file contains a 1.1 tag";
}
if ($tag_version & ID3_V2) {
echo "This file contains a 2.x tag";
}
if ($tag_version & ID3_V2_3) {
echo "This file contains a 2.3 tag";
}
if ($tag_version & ID3_V2_4) {
echo "This file contains a 2.4 tag";
}

echo "";

$tag = id3_get_tag("$new_mp3_file");

while(list($key,$value) = each($tag)){
echo "$key: $value"; if($key == "genre"){echo " (" .
id3_get_genre_name($value) . ")";} echo "";
}

unlink($new_mp3_file);
?>

Expected result:

The comments tag should display in the tag output.

Actual result:
--
This file contains a 1.x tag
This file contains a 1.1 tag
This file contains a 2.3 tag
This file contains a 2.4 tag


encoderSettings: LAME 32bits version 3.98.2 (http://www.mp3dev.org/)
length: 27414
title: My name is Sulaiman The WordSmith
artist: Sulaiman The WordSmith
album: What Is A WordSmith
recTime: 2010
track: 03/03
genre: 7 (Hip-Hop)
composer: Sulaiman The WordSmith
originalArtist: Sulaiman The WordSmith
copyright: U.S: PAU003376550 / 1-407766721
encodedBy: Lame
webOffPubl: http://thewordsmith.info
webOffAudioFile: http://thewordsmith.info
webOffAudioSrc: http://thewordsmith.info
webOffIRS: http://thewordsmith.info
publisher: The WordSmith World Wide
mood: Educational
webOffArtist: http://thewordsmith.info
language: EN

-- 
Edit bug report at https://bugs.php.net/bug.php?id=55442&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55442&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55442&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55442&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55442&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55442&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55442&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55442&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55442&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55442&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55442&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55442&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55442&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55442&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55442&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55442&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55442&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55442&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55442&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55442&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55442&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55442&r=mysqlcfg



Bug #50547 [Com]: SoapServer Fatal errror in WSDL mode

2011-08-17 Thread chinigo at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=50547&edit=1

 ID: 50547
 Comment by: chinigo at gmail dot com
 Reported by:rsumibcay at reddoor dot biz
 Summary:SoapServer Fatal errror in WSDL mode
 Status: Open
 Type:   Bug
 Package:SOAP related
 Operating System:   Ubuntu Linux
 PHP Version:5.2.12
 Block user comment: N
 Private report: N

 New Comment:

mdekrijger's suggestion about disabling Xdebug worked for me too. Adding 
xdebug_disable() immediately before the SOAP call resulted in a Fatal SOAP 
error 
being converted to a catchable SOAP fault.


Previous Comments:

[2011-02-24 16:00:36] mdekrijger at e-sites dot nl

Xdebug might be the problem. When using xdebug_disable() before calling the 
handle() method, the server responds with a proper SOAP message which says that 
something went wrong.


[2011-02-24 09:54:31] mdekrijger at e-sites dot nl

Does anyone have an alternative solution for this problem? (while this bug 
remains 
open?)

We really want to provide some information about the wrong type in the return 
soap 
response. So implementing our SOAP services would be a much easier job.


[2010-02-01 09:48:05] jitka at darbujanova dot cz

I can confirm this. (http://bugs.php.net/bug.php?id=50895)


[2009-12-21 20:18:01] rsumibcay at reddoor dot biz

Description:

SoapServer dies with fatal error in WSDL mode when a soap argument is a 
ComplexType with a member defined as int in the XSD, but the member value is 
passed as a non-numeric string. 

Reproduce code:
---
1. Define a ComplexType with an int data member:

http://crkt190.reddoor.biz/fatalerror/complex_types.xsd

2. Define a WSDL that uses the ComplexType as an argument to the soap function:

http://crkt190.reddoor.biz/fatalerror/fatalerror.wsdl

3. Create a soap envelope with a non-numeric string as the value for the int 
data member:

http://crkt190.reddoor.biz/fatalerror/fatalerror-soap-envelope.xml

4. Make a soap request using the soap envelope in step 3.


Expected result:

The SoapServer should not die with a fatal error. The SoapServer should respond 
with a SoapFault, or let the call pass through so the business logic (mapped 
handler) can do validation and handle the error appropriately.

Actual result:
--
500 HTTP response from server. The HTTP response body contains an error message 
and stack trace.

Fatal error: SOAP-ERROR: Encoding Violation of encoding rules in ...






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


Bug #54114 [Com]: Output Buffer Dumps Data On Error

2011-08-17 Thread nicolas dot grekas+php at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=54114&edit=1

 ID: 54114
 Comment by: nicolas dot grekas+php at gmail dot com
 Reported by:danhstevens at gmail dot com
 Summary:Output Buffer Dumps Data On Error
 Status: Open
 Type:   Bug
 Package:Output Control
 Operating System:   all
 PHP Version:5.3.5
 Block user comment: N
 Private report: N

 New Comment:

Here is an other example that can't be workaround using danhstevens' technique:




Previous Comments:

[2011-03-10 19:41:28] danhstevens at gmail dot com

I've found a viable work-around for this bug (although a patch of the core 
would still be ideal so people don't discover this potential security issue the 
hard-way).

By registering the following shutdown handler before any output buffering the 
dump of data can be prevented:

 1)
  {
//Prevent data in buffer from dumping
ob_end_clean();
  }
}
register_shutdown_function('shutdown_fn');



Now when using the examples above that normally cause the buffer to dump to the 
client the buffer data is disposed of. Of course, this can be extended to use 
ob_get_contents and redirect the data to file or other means if necessary. This 
approach is working for me (on PHP 5.3.5).

~Dan


[2011-03-06 16:51:52] neweracracker at gmail dot com

I've managed to reproduce this in Windows 7 running php 5.2.17 (with 
php.ini-dist) and php 5.3.5 (with php.ini-development).

Here is my test script:


I've reported this as bug #54174 which got closed due being a dupe of this one 
so I am leaving this comment here for reference purposes.

Regards,
NewEraCracker.


[2011-02-28 21:40:36] danhstevens at gmail dot com

Hi Rasmus,

I was still able to create the problem by calling on a non-existing class to 
create a fatal error. Here is a variation of your code:

function eh($errno, $errstr, $errfile, $errline) {
  $contents = ob_get_contents();
  ob_end_clean();
  echo "Error: $errno, $errstr, $errfile, $errline\n";
}
set_error_handler('eh');
ob_start();
echo 123;
nonExistantClass::nonExistantMethod();
echo "After error\n";

Output is:
123
Fatal error: Class 'nonExistantClass' not found in ...

Hopefully the above should more accurately illustrate the issue.


[2011-02-28 19:37:32] ras...@php.net

I am unable to reproduce this.  My test script:




Expected result:

(no output)

Actual result:
--
123
Fatal error: test error in ...






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


[PHP-BUG] Bug #55441 [NEW]: \Phar::createDefaultStub() does not handle its arguments

2011-08-17 Thread frederic dot hardy at mageekbox dot net
From: 
Operating system: MacOS X 10.6.8
PHP version:  5.3.6
Package:  PHAR related
Bug Type: Bug
Bug description:\Phar::createDefaultStub() does not handle its arguments

Description:

\Phar::createDefaultStub() takes two optional arguments.
With these arguments, the user can defined file in phar archive which will
be used 
in stub.
However, these arguments seems to be not used by
\Phar::createDefaultStub().

Test script:
---
';
$phar->createDefaultStub('stub.php');

Expected result:

This is the stub !

Actual result:
--
PHP Warning:  include(phar:///path/to/my.phar/index.php): failed to open
stream: 
phar error: "index.php" is not a file in phar "/path/to/my.phar" in 
/path/to/my.phar on line 9

-- 
Edit bug report at https://bugs.php.net/bug.php?id=55441&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55441&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55441&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55441&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55441&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55441&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55441&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55441&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55441&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55441&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55441&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55441&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55441&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55441&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55441&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55441&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55441&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55441&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55441&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55441&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55441&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55441&r=mysqlcfg



[PHP-BUG] Req #55440 [NEW]: Internal state of the execution engine

2011-08-17 Thread nicolas dot grekas+php at gmail dot com
From: 
Operating system: 
PHP version:  5.3.6
Package:  *General Issues
Bug Type: Feature/Change Request
Bug description:Internal state of the execution engine

Description:

While developing in PHP, I've learned that the execution engine is
sometimes set in special states that alter its capabilities.

As far as I know, their is no way for us developers to write code that test
for one of these particular state and branch code appropriately.

By "special state", I mean :
- execute/compile stage, where for eg autoloading doesn't work
(http://bugs.php.net/42098),
- outside/inside output buffering handler, where for eg print_r($v, true)
doesn't work (http://bugs.php.net/55428),
- before/after "shutdown time", where for eg uncatched exceptions generate
the cryptic "Fatal error: Exception thrown without a stack frame in Unknown
on line 0" and set_exception_handler() is disabled.

Adding a centralized way to check for these states is maybe a good idea ?
For example, get_engine_state( void ) would return a bit field, each bit
for each possible state?


-- 
Edit bug report at https://bugs.php.net/bug.php?id=55440&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55440&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55440&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55440&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55440&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55440&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55440&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55440&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55440&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55440&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55440&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55440&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55440&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55440&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55440&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55440&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55440&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55440&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55440&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55440&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55440&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55440&r=mysqlcfg



[PHP-BUG] Bug #55439 [NEW]: crypt() returns only the salt for MD5

2011-08-17 Thread jo at feuersee dot de
From: 
Operating system: Linux
PHP version:  5.3.7RC5
Package:  *Encryption and hash functions
Bug Type: Bug
Bug description:crypt() returns only the salt for MD5

Description:

If crypt() is executed with MD5 salts, the return value conists of the salt
only.
DES and BLOWFISH salts work as expected.

I tested with php from openSUSE PHP5 repository

> php -v
PHP 5.3.7RC6-dev (cli)
> rpm -q php5
php5-5.3.6.201108112132-94.1.x86_64

Test script:
---
printf("MD5: %s\n", crypt('password', '$1$U7AjYB.O$'));


Expected result:

MD5: $1$U7AjYB.O$L1N7ux7twaMIMw0En8UUR1

Actual result:
--
MD5: $1$U7AjYB.O

-- 
Edit bug report at https://bugs.php.net/bug.php?id=55439&edit=1
-- 
Try a snapshot (PHP 5.4):
https://bugs.php.net/fix.php?id=55439&r=trysnapshot54
Try a snapshot (PHP 5.3):
https://bugs.php.net/fix.php?id=55439&r=trysnapshot53
Try a snapshot (trunk):  
https://bugs.php.net/fix.php?id=55439&r=trysnapshottrunk
Fixed in SVN:
https://bugs.php.net/fix.php?id=55439&r=fixed
Fixed in SVN and need be documented: 
https://bugs.php.net/fix.php?id=55439&r=needdocs
Fixed in release:
https://bugs.php.net/fix.php?id=55439&r=alreadyfixed
Need backtrace:  
https://bugs.php.net/fix.php?id=55439&r=needtrace
Need Reproduce Script:   
https://bugs.php.net/fix.php?id=55439&r=needscript
Try newer version:   
https://bugs.php.net/fix.php?id=55439&r=oldversion
Not developer issue: 
https://bugs.php.net/fix.php?id=55439&r=support
Expected behavior:   
https://bugs.php.net/fix.php?id=55439&r=notwrong
Not enough info: 
https://bugs.php.net/fix.php?id=55439&r=notenoughinfo
Submitted twice: 
https://bugs.php.net/fix.php?id=55439&r=submittedtwice
register_globals:
https://bugs.php.net/fix.php?id=55439&r=globals
PHP 4 support discontinued:  
https://bugs.php.net/fix.php?id=55439&r=php4
Daylight Savings:https://bugs.php.net/fix.php?id=55439&r=dst
IIS Stability:   
https://bugs.php.net/fix.php?id=55439&r=isapi
Install GNU Sed: 
https://bugs.php.net/fix.php?id=55439&r=gnused
Floating point limitations:  
https://bugs.php.net/fix.php?id=55439&r=float
No Zend Extensions:  
https://bugs.php.net/fix.php?id=55439&r=nozend
MySQL Configuration Error:   
https://bugs.php.net/fix.php?id=55439&r=mysqlcfg



Bug #55431 [Fbk->Csd]: SIGSEV11 mysqli_result::fetch_fields

2011-08-17 Thread lgandras at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55431&edit=1

 ID: 55431
 User updated by:lgandras at gmail dot com
 Reported by:lgandras at gmail dot com
 Summary:SIGSEV11 mysqli_result::fetch_fields
-Status: Feedback
+Status: Closed
 Type:   Bug
 Package:Reproducible crash
 Operating System:   Cent OS 5.6
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

This is a duplicate of https://bugs.php.net/bug.php?id=55414


Previous Comments:

[2011-08-16 03:57:23] larue...@php.net

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 ,
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.




[2011-08-16 01:21:39] lgandras at gmail dot com

Definitively the problematic function is mysqli_result::fetch_fields


[2011-08-16 01:12:32] lgandras at gmail dot com

Description:

Hi,

I was using phpunit 3.5.13 during this crash. I'm executing a query of type 
"SHOW CREATE TABLE `name`". I'm also using Zend framework 1.11.6. This means 
the query es being executed using prepare. I believe this has something to do 
with the fact that the field returned by mysql has a space in between "Create 
table". I've got to have a crash executing the same query in other environment, 
but without being able to reproduce. That time the error came up executing 
mysqli_result::fetch_fields. This time i don't really know.

'./configure' '--disable-fileinfo' '--disable-pdo' '--disable-phar' 
'--enable-bcmath' '--enable-calendar' '--enable-ftp' '--enable-libxml' 
'--enable-magic-quotes' '--enable-mbstring' '--enable-pcntl' '--enable-shmop' 
'--enable-soap' '--enable-sockets' '--enable-sysvmsg' '--enable-sysvsem' 
'--enable-sysvshm' '--enable-zip' '--prefix=/usr' '--with-curl=/opt/curlssl/' 
'--with-gd' '--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr' 
'--with-jpeg-dir=/usr' '--with-kerberos' '--with-libxml-dir=/opt/xml2' 
'--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/' 
'--with-mysql=/usr' '--with-mysql-sock=/var/lib/mysql/mysql.sock' 
'--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr' 
'--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre' '--with-png-dir=/usr' 
'--with-xpm-dir=/usr' '--with-zlib' '--with-zlib-dir=/usr' '--without-sqlite3' 



#0  0x0841f2e8 in add_property_string_ex (arg=0xa2cce98, key=0x87ad4cc 
"catalog", key_len=8, str=0x79726100 , 
duplicate=1)
at /home/cpeasyapache/src/php-5.3.6/Zend/zend_API.c:1524
#1  0x081d7628 in php_add_field_properties (value=0xa2cce98, field=0x9c65874) 
at /home/cpeasyapache/src/php-5.3.6/ext/mysqli/mysqli_api.c:1056
#2  0x081d79b7 in zif_mysqli_fetch_fields (ht=0, return_value=0xa2ea190, 
return_value_ptr=0x0, this_ptr=0xa2ea310, return_value_used=1)
at /home/cpeasyapache/src/php-5.3.6/ext/mysqli/mysqli_api.c:1114
#3  0x0844632f in zend_do_fcall_common_helper_SPEC (execute_data=0x9c16e40) at 
/home/cpeasyapache/src/php-5.3.6/Zend/zend_vm_execute.h:316
#4  0x08446f6b in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x9c16e40) 
at /home/cpeasyapache/src/php-5.3.6/Zend/zend_vm_execute.h:421
#5  0x084456fe in execute (op_array=0xa022ae8) at 
/home/cpeasyapache/src/php-5.3.6/Zend/zend_vm_execute.h:107
#6  0x0840b5a3 in zend_call_function (fci=0xbf80a798, fci_cache=0xbf80a784) at 
/home/cpeasyapache/src/php-5.3.6/Zend/zend_execute_API.c:964
#7  0x081ed8f6 in zim_reflection_method_invokeArgs (ht=2, 
return_value=0xa2eb2fc, return_value_ptr=0x0, this_ptr=0xa2eb450, 
return_value_used=1)
at /home/cpeasyapache/src/php-5.3.6/ext/reflection/php_reflection.c:2745
#8  0x0844632f in zend_do_fcall_common_helper_SPEC (execute_data=0x9c15a18) at 
/home/cpeasyapache/src/php-5.3.6/Zend/zend_vm_execute.h:316
#9  0x08446f6b in ZEND_DO_FCALL_BY_NAME_SPEC_HANDLER (execute_data=0x9c15a18) 
at /home/cpeasyapache/src/php-5.3.6/Zend/zend_vm_execute.h:421
#10 0x084456fe in execute (op_array=0xa18b944) at 
/home/cpeasyapache/src/php-5.3.6/Zend/zend_vm_execute.h:107
#11 0x08419b44 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at 
/home/cpeasyapache/src/php-5.3.6/Zend/zend.c:1194
#12 0x083ad584 in php_execute_script (primary_file=0xbf80cc94) at 
/home/cpeasyapache/src/php-5.3.6/main/main.c:2268
#13 0x084e6f64 in main (argc=2, argv=0xbf80cdf4) at 
/home/cpeasyapache/src/php-5.3.6/sapi/cli/php_cli.c:1193


The same executed again

#0  0x0841f2e8 

Bug #55438 [Com]: race condition: curlwapper is not sending http header randomly

2011-08-17 Thread xuefer at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=55438&edit=1

 ID: 55438
 Comment by: xuefer at gmail dot com
 Reported by:xuefer at gmail dot com
 Summary:race condition: curlwapper is not sending http
 header randomly
 Status: Open
 Type:   Bug
 Package:cURL related
 Operating System:   gentoo
 PHP Version:5.3.6
 Block user comment: N
 Private report: N

 New Comment:

sorry for the mismatch http url string. i was trying to remove some string for 
privacy


Previous Comments:

[2011-08-17 11:38:50] xuefer at gmail dot com

Description:

background: php is configured with curl wrapper, which make file_get_contents 
use curl. i haven't tested with calling curl functions directly

php unset curl header too soon before curl make the request

expected order: set header, build and send request. unset header
actual order 1: set header, build and send request. unset header (good)
actual order 2: set header, unset header, build and send request (bad)
"send request" comes after php "unset header"
curl behavior randomly, by sending request before or after php unset the header


Test script:
---
#!/usr/lib/php5.3/bin/php
http://localhost/";;
$context = stream_context_create(array(
'http' => array(
'header'  => "Authorization: Basic " . 
base64_encode("$username:$password")
)
));
$http_response_header = array();
$data = file_get_contents($authUrl, false, $context);
sleep(1);
}
?>

tcpdump -nilo dst port 80 -w- -s0

Expected result:

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6MTQzNjEuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6NTY3MDQuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=


GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6MTQzNjEuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6NTY3MDQuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=


Actual result:
--
GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6MTQzNjEuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6NTY3MDQuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*


GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*


gdb --args /usr/lib/php5.3/bin/php.debug test.php

(gdb) l /usr/src/debug/dev-lang/php-5.3.6/sapis-build/cli/ext/curl/streams.c:367
360 slist = 
curl_slist_append(slist, 
trimmed);
361 efree(trimmed);
362 p = php_strtok_r(NULL, "\r\n", 
&token);
363 }
364 efree(copy_ctx_opt);
365 }
366 if (slist) {
367 curl_easy_setopt(curlstream->curl, 
CURLOPT_HTTPHEADER, slist);
368 }
369 }
370 if (SUCCESS == php_stream_context_get_option(context, 
"http", "method", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_STRING) {
371 if (strcasecmp(Z_STRVAL_PP(ctx_opt), "get")) {
372 if (!strcasecmp(Z_STRVAL_PP(ctx_opt), 
"head")) {
373 curl_easy_setopt(curlstream-
>curl, CURLOPT_NOBODY, 1);
374 } else {
(gdb) l /usr/src/debug/dev-lang/php-5.3.6/sapis-build/cli/ext/curl/streams.c:501
494 if (msg_found) {
495 goto exit_fail;
496 }
497 }
498
499 /* context headers are not needed anymore */
500 if (slist) {
501 curl_easy_setopt(curlstream->curl, CURLOPT_HTTPHEADER, 
NULL);
502   

[PHP-BUG] Bug #55438 [NEW]: race condition: curlwapper is not sending http header randomly

2011-08-17 Thread xuefer at gmail dot com
From: 
Operating system: gentoo
PHP version:  5.3.6
Package:  cURL related
Bug Type: Bug
Bug description:race condition: curlwapper is not sending http header randomly

Description:

background: php is configured with curl wrapper, which make
file_get_contents 
use curl. i haven't tested with calling curl functions directly

php unset curl header too soon before curl make the request

expected order: set header, build and send request. unset header
actual order 1: set header, build and send request. unset header (good)
actual order 2: set header, unset header, build and send request (bad)
"send request" comes after php "unset header"
curl behavior randomly, by sending request before or after php unset the
header


Test script:
---
#!/usr/lib/php5.3/bin/php
http://localhost/";;
$context = stream_context_create(array(
'http' => array(
'header'  => "Authorization: Basic
" . base64_encode("$username:$password")
)
));
$http_response_header = array();
$data = file_get_contents($authUrl, false, $context);
sleep(1);
}
?>

tcpdump -nilo dst port 80 -w- -s0

Expected result:

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6MTQzNjEuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6NTY3MDQuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=


GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6MTQzNjEuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6NTY3MDQuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=


Actual result:
--
GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6MTQzNjEuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*
Authorization: Basic 
dGVzdDE6NTY3MDQuLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4u
Li4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4uLi4=

GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*


GET / HTTP/1.1
User-Agent: PHP/5.3.6-pl0-gentoo
Host: localhost
Accept: */*


gdb --args /usr/lib/php5.3/bin/php.debug test.php

(gdb) l
/usr/src/debug/dev-lang/php-5.3.6/sapis-build/cli/ext/curl/streams.c:367
360 slist =
curl_slist_append(slist, 
trimmed);
361 efree(trimmed);
362 p = php_strtok_r(NULL,
"\r\n", 
&token);
363 }
364 efree(copy_ctx_opt);
365 }
366 if (slist) {
367 curl_easy_setopt(curlstream->curl,

CURLOPT_HTTPHEADER, slist);
368 }
369 }
370 if (SUCCESS ==
php_stream_context_get_option(context, 
"http", "method", &ctx_opt) && Z_TYPE_PP(ctx_opt) == IS_STRING) {
371 if (strcasecmp(Z_STRVAL_PP(ctx_opt),
"get")) {
372 if
(!strcasecmp(Z_STRVAL_PP(ctx_opt), 
"head")) {
373
curl_easy_setopt(curlstream-
>curl, CURLOPT_NOBODY, 1);
374 } else {
(gdb) l
/usr/src/debug/dev-lang/php-5.3.6/sapis-build/cli/ext/curl/streams.c:501
494 if (msg_found) {
495 goto exit_fail;
496 }
497 }
498
499 /* context headers are not needed anymore */
500 if (slist) {
501 curl_easy_setopt(curlstream->curl,
CURLOPT_HTTPHEADER, 
NULL);
502 curl_slist_free_all(slist);
503 }
504 return stream;
505
506 exit_fail:
507 php_stream_close(stream);
508 if (slist) {
(gdb) br 367
Breakpoint 1 at 0x1c59c9: file /usr/src/debug/dev-lang/php-5.3.6/sapis-
build/cli/ext/curl/streams.c, line 367.
(gdb) br 501
Breakpoint 2 at 0x1c61bc: file /usr/src/debug/dev-lang/php-5.3.6/sapis-
build/cli/ext/curl/streams.c, line 501.
(gdb) br Curl_send_plain
Breakpoint 4 at 0xb7698ca0: file sendf.c, line 279.