#49295 [Asn]: stream_socket_client() fails on SSL+async

2009-09-02 Thread srinatar
 ID:   49295
 Updated by:   srina...@php.net
 Reported By:  frase at cs dot wisc dot edu
 Status:   Assigned
 Bug Type: OpenSSL related
 Operating System: Win 2000 Pro SP4
 PHP Version:  5.2.11RC1
 Assigned To:  srinatar
 New Comment:

ok, i was looking into this issue today. the issue is that , 
especially on windows -where sockets are not file descriptors unlike 
in unix, async sockets and openssl works together only if we use BIO 
wrappers provided by openssl module instead of directly accessing 
underlying sockets as file descriptors. 

the possible right way to do this would be to use  to socket wrappers 
provided by  SSL module (known as BIO wrappers which makes it work 
properly on windows).

this will require some amount of fiddling our openssl module. i don't 
think, 5.2 is a good place to do this change.  

for now, commenting this below code should help you to run your script

properly on windows. 
stream_set_blocking($socket, 0);

i will spend more time on this and investigate on the best way to use 
BIO wrappers within existing openssl module say within php 5.3


Previous Comments:


[2009-08-21 15:05:47] frase at cs dot wisc dot edu

I had a chance to compile and test PHP5.2.11RC1 under Linux this
morning (Ubuntu Jaunty, Apache 2.2.11 from repositories), and these
warnings do not appear, however I noticed another problem.

Although the SSL+async connection is successful and data is returned
under Linux, the socket is not actually opened asynchonously.  The
script blocks until the socket has finished opening, exactly as it does
without the ASYNC flag.  This is also true under Windows, for the first
run -- after that, of course, it returns the errors posted above.



[2009-08-21 01:15:44] srina...@php.net

this issue seems to be happening when this script is executed more than
once and also seems to be happening only on windows. 



[2009-08-19 13:52:18] frase at cs dot wisc dot edu

Description:

stream_socket_client() can only open one socket using SSL and the
STREAM_CLIENT_ASYNC_CONNECT flag, and then fails every time until the
Apache process is restarted.  SSL sockets without ASYNC open fine, as do
plain TCP sockets with or without ASYNC.

Originally reported as an update to bug #48182, which also only
affected the combination of SSL+ASYNC, but now reported separately here
per srina...@php.net's request.

Additionally, the timeout (argument #4 to stream_socket_client()) is
not ignored when using ASYNC, contrary to the manual: if set to 0 here,
the first warning is SSL: connection timeout instead of SSL: The
operation completed successfully.

Windows 2000 Professional SP4
Apache 2.2.11
PHP 5.2.11RC1-Win32-VC6-x86 (threadsafe binary from
http://windows.php.net/qa/)
configured as an Apache module
with php_openssl.dll and libeay32.dll+ssleay.dll v0.9.8k


Reproduce code:
---
?php
header('Content-Type: text/plain');
$errno = null;
$errstr = null;
$socket = stream_socket_client(
'ssl://'.gethostbyname('launchpad.net').':443', $errno, $errstr,
10, // timeout should be ignored when ASYNC
STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT
);
if (!$socket) {
echo errno = .$errno.\nerrstr = .$errstr.\n;
exit;
}
stream_set_blocking($socket, 0);
$data = GET / HTTP/1.0\r\nHost: launchpad.net\r\nConnection:
close\r\n\r\n;
$selR = null;
$selW = array();
$selE = null;
while ($data) {
$selW[0] = $socket;
if (stream_select($selR, $selW, $selE, 10)) {
$wrote = fwrite($socket, $data, strlen($data));
$data = substr($data, $wrote);
}
}
$html = ;
$selR = array($socket);
$selW = null;
while (!feof($socket)) {
$selR[0] = $socket;
if (stream_select($selR, $selW, $selE, 10))
$html .= fread($socket, 8192);
}
fclose($socket);
echo OK!\n--\n.$html;


Expected result:

OK!
--
(HTTP headers and content from launchpad.net)

Actual result:
--
Warning: stream_socket_client() [function.stream-socket-client]: SSL:
The operation completed successfully. in test-async-ssl.php on line 8

Warning: stream_socket_client() [function.stream-socket-client]: Failed
to enable crypto in test-async-ssl.php on line 8

Warning: stream_socket_client() [function.stream-socket-client]: unable
to connect to ssl://91.189.90.211:443 (Unknown error) in
test-async-ssl.php on line 8
errno = 10035 errstr = 






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



#49295 [Asn]: stream_socket_client() fails on SSL+async

2009-09-02 Thread srinatar
 ID:   49295
 Updated by:   srina...@php.net
 Reported By:  frase at cs dot wisc dot edu
 Status:   Assigned
 Bug Type: OpenSSL related
 Operating System: Win 2000 Pro SP4
 PHP Version:  5.2.11RC1
 Assigned To:  srinatar
 New Comment:

just a follow up note, this issue (async not working consistently with

openssl on windows) has always been the case and this issue has nothing

to do with the fix that went in for bug:48182.


Previous Comments:


[2009-09-02 08:09:22] srina...@php.net

ok, i was looking into this issue today. the issue is that , 
especially on windows -where sockets are not file descriptors unlike 
in unix, async sockets and openssl works together only if we use BIO 
wrappers provided by openssl module instead of directly accessing 
underlying sockets as file descriptors. 

the possible right way to do this would be to use  to socket wrappers 
provided by  SSL module (known as BIO wrappers which makes it work 
properly on windows).

this will require some amount of fiddling our openssl module. i don't 
think, 5.2 is a good place to do this change.  

for now, commenting this below code should help you to run your script

properly on windows. 
stream_set_blocking($socket, 0);

i will spend more time on this and investigate on the best way to use 
BIO wrappers within existing openssl module say within php 5.3



[2009-08-21 15:05:47] frase at cs dot wisc dot edu

I had a chance to compile and test PHP5.2.11RC1 under Linux this
morning (Ubuntu Jaunty, Apache 2.2.11 from repositories), and these
warnings do not appear, however I noticed another problem.

Although the SSL+async connection is successful and data is returned
under Linux, the socket is not actually opened asynchonously.  The
script blocks until the socket has finished opening, exactly as it does
without the ASYNC flag.  This is also true under Windows, for the first
run -- after that, of course, it returns the errors posted above.



[2009-08-21 01:15:44] srina...@php.net

this issue seems to be happening when this script is executed more than
once and also seems to be happening only on windows. 



[2009-08-19 13:52:18] frase at cs dot wisc dot edu

Description:

stream_socket_client() can only open one socket using SSL and the
STREAM_CLIENT_ASYNC_CONNECT flag, and then fails every time until the
Apache process is restarted.  SSL sockets without ASYNC open fine, as do
plain TCP sockets with or without ASYNC.

Originally reported as an update to bug #48182, which also only
affected the combination of SSL+ASYNC, but now reported separately here
per srina...@php.net's request.

Additionally, the timeout (argument #4 to stream_socket_client()) is
not ignored when using ASYNC, contrary to the manual: if set to 0 here,
the first warning is SSL: connection timeout instead of SSL: The
operation completed successfully.

Windows 2000 Professional SP4
Apache 2.2.11
PHP 5.2.11RC1-Win32-VC6-x86 (threadsafe binary from
http://windows.php.net/qa/)
configured as an Apache module
with php_openssl.dll and libeay32.dll+ssleay.dll v0.9.8k


Reproduce code:
---
?php
header('Content-Type: text/plain');
$errno = null;
$errstr = null;
$socket = stream_socket_client(
'ssl://'.gethostbyname('launchpad.net').':443', $errno, $errstr,
10, // timeout should be ignored when ASYNC
STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT
);
if (!$socket) {
echo errno = .$errno.\nerrstr = .$errstr.\n;
exit;
}
stream_set_blocking($socket, 0);
$data = GET / HTTP/1.0\r\nHost: launchpad.net\r\nConnection:
close\r\n\r\n;
$selR = null;
$selW = array();
$selE = null;
while ($data) {
$selW[0] = $socket;
if (stream_select($selR, $selW, $selE, 10)) {
$wrote = fwrite($socket, $data, strlen($data));
$data = substr($data, $wrote);
}
}
$html = ;
$selR = array($socket);
$selW = null;
while (!feof($socket)) {
$selR[0] = $socket;
if (stream_select($selR, $selW, $selE, 10))
$html .= fread($socket, 8192);
}
fclose($socket);
echo OK!\n--\n.$html;


Expected result:

OK!
--
(HTTP headers and content from launchpad.net)

Actual result:
--
Warning: stream_socket_client() [function.stream-socket-client]: SSL:
The operation completed successfully. in test-async-ssl.php on line 8

Warning: stream_socket_client() [function.stream-socket-client]: Failed
to enable crypto in test-async-ssl.php on line 8

Warning: stream_socket_client() [function.stream-socket-client]: unable
to connect to ssl://91.189.90.211:443 (Unknown error) in
test-async-ssl.php on 

#49437 [Opn-Csd]: Can't disable LIBXML_NOENT option

2009-09-02 Thread matt at matthewfagan dot com
 ID:   49437
 User updated by:  matt at matthewfagan dot com
 Reported By:  matt at matthewfagan dot com
-Status:   Open
+Status:   Closed
 Bug Type: SimpleXML related
 Operating System: ALL
 PHP Version:  5.2.10
 New Comment:

Scratch this. It seems to be a bug in the underlying libxml (they don't
treat the predefined entities as entities), which also means that all
the PHP functions based on libxml have the same problem.

Still, it might be nice to add a comment to the documentation that the
LIBXML_NOENT option does not apply to built-in XML entities, only to
DTD-defined entities.


Previous Comments:


[2009-09-02 05:30:07] matt at matthewfagan dot com

Description:

One of the options to simplexml_load_string is LIBXML_NOENT. This
option cannot be turned off.

Reproduce code:
---
The prototype for the simplexml_load_string function is:

object simplexml_load_string ( string $data [, string
$class_name=SimpleXMLElement [, int $options=0 [, string $ns [, bool
$is_prefix=false  )

Note the $options=0. However, it actually behaves like
$options=LIBXML_NOENT. There is no way to disable this behavior.
Explicitly specifying 0 does not turn off LIBXML_NOENT.

Code to reproduce:
echo simplexml_load_string(dataamp;/data, SimpleXMLElement,
0);

Expected result:

This should return amp;, because I have explicity turned off the
LIBXML_NOENT option. However, amp; is converted to  by libxml
regardless of the specified options.

It's as if the underlying C code is calling:

libxml-load_string(data, classname, options | LIBXML_NOENT);

(Note: not the real function names...)

Actual result:
--
Resolution:

There would seem to be two resolutions. Either:
a) Change the prototype so that the default value of $options is
LIBXML_NOENT, allowing this to be overridden by specifying the options.

OR

b) Create a special LIBXML flag especially for PHP, such as
LIBXML_KEEPENT that negates the LIBXML_NOENT flag.


Note: This is not an important bug for me, because I will just ditch
using SimpleXML and find another way, but I think it should still be on
the books as a bug.





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



#39188 [Com]: reading php://input hangs with IIS

2009-09-02 Thread arturm at union dot com dot pl
 ID:   39188
 Comment by:   arturm at union dot com dot pl
 Reported By:  php at nineberry dot de
 Status:   Feedback
 Bug Type: IIS related
 Operating System: Win32
 PHP Version:  5.1.6
 Assigned To:  dmitry
 New Comment:

Thank you. There is simple way to make workaround. I just reported a
bug :-)


Previous Comments:


[2009-09-01 13:03:04] paj...@php.net

Please try with IIS6 or 7 with fcgi.



[2009-09-01 12:57:42] arturm at union dot com dot pl

OK, my test is similar (hangs on submit):

?php

if($_SERVER[REQUEST_METHOD] == POST)
{
header(Content-type: text/xml);
$s = file_get_contents(php://input);
echo EOT
xml/
EOT;
}
else
{
echo EOT
form method=post action=
input type=text value=abc
input type=submit name=s1 value=Submit
/form
EOT;
}
?

Bug occured on:
1. Windows XP, PHP 5.2.10, IIS 5.1, CGI
2. Windows 2003, PHP 5.2.6, IIS 5.1, CGI
Didn't occured on:
Windows 2008, PHP 5.2.5 (x64), IIS 6, ISAPI



[2009-09-01 12:18:59] arturm at union dot com dot pl

I am trying to isolate bug. For this moment I noticed that content-type
header plays important role. Only problem is with
application/x-www-form-urlencoded. When request is text/xml it is OK.



[2009-08-31 16:41:16] paj...@php.net

An example to reproduce the issue was asked. Saying that the bug is
still here does not help.



[2009-08-31 15:51:29] arturm at union dot com dot pl

Bug is still there: PHP 5.2.10, XP Pro, IIS, CGI - C# client (timeout
on req.GetResponse(), content type is
application/x-www-form-urlencoded).



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

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



#48746 [Com]: Unable to browse directories within Junction Points

2009-09-02 Thread phpstuff at cresstone dot com
 ID:   48746
 Comment by:   phpstuff at cresstone dot com
 Reported By:  ddkees at illinois dot edu
 Status:   Feedback
 Bug Type: Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye
 New Comment:

Everything seems to be working as of the latest snapshot, thanks.


Previous Comments:


[2009-09-01 17:54:20] paj...@php.net

scandir has been fixed (not directly related to this issue) as well as
the mounted points issues. All regressions should be fixed now. Can you
give it a try please? The next snapshot will have the fixes.



[2009-09-01 17:51:00] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287950
Log: - #48746, revert previous about volume. Fix volume support to
allow all mounted points (with or without drives)



[2009-09-01 17:46:17] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287949
Log: - #48746, fix regression in readdir/scandir and mounted points or
junctions on windows



[2009-08-30 13:06:33] paj...@php.net

@shoresofnowhere at gmail dot com

Not with symlink/link/etc. You can try it under unix as well:

/var/www/dir1
/var/www/test.txt
/var/www/dir2
/var/www/dir2/linktodir1
/var/www/dir2/test2.txt
/var/www/dir2/linktodir1/t.php

In t.php, ../test2.txt will fail because it will use dir1 as base
direct. That's how it always worked, windows had only partial support
for links (symbolic or hard) or junctions. It worked before but it was
not correct (and not portable).



[2009-08-30 13:00:44] shoresofnowhere at gmail dot com

@ pajoye:

Sorry, but i don't understand why the correct behaviour should be that
of 5.3:

dir1 directory
subdir1 subdirectory of dir1
cfg.php file in dir1

dir2 directory
cfg.php file in dir2
junction1 junction to subdir1 created in dir2

and i have in dir1/subdir1/file.php:
require_once(../cfg.php);

I expect that if i run dir1/subdir1/file.php i get
require_once(dir1/cfg.php);

BUT if i run dir2/subdir1/file.php i will get
require_once(dir2/cfg.php);

Could you please tell me why this would be wrong? File inclusions have
always been relative to the path of the main php file that's
executing...

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

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



#49436 [Opn-Fbk]: during query executed, mysql connection lost

2009-09-02 Thread jani
 ID:   49436
 Updated by:   j...@php.net
 Reported By:  november at netsecuretech dot com
-Status:   Open
+Status:   Feedback
 Bug Type: MySQLi related
 Operating System: windowsXP
 PHP Version:  5.3.0
 New Comment:

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/




Previous Comments:


[2009-09-02 04:40:26] november at netsecuretech dot com

mysql query takes 20~30 minutes;

$query = create table test as select c_ip, count(*) from iis_summary
group by c_ip;

thank you



[2009-09-02 04:37:23] november at netsecuretech dot com

Description:

PHP version : 5.3.0 Windows Binary VC9 x86 Thread Safe (2009-Jun-30
08:52:56)

Mysql version : 5.1.37-community-edition (CentOS 4.7)

I use php CLI SAPI.

PHP cli's default max_execution_time is unlimited.

When I execute php script, mysql connection is lost.

When I use php 5.2.10, mysql query executed well.

What Can I do?

Thank you.

Reproduce code:
---
?php

$db = mysqli_connect('x.x.x.x', 'id', 'pw', 'db');

if (!$db) {
  die('Connect Error (' . mysqli_connect_errno() . ') '
  . mysqli_connect_error());
}   

echo date(Y-m-d H:i:s). = query start...\r\n;

$query = create table test as select c_ip, count(*) from iis_summary
group by c_ip;

mysqli_query($db, $query); 

if (mysqli_errno($db) != 0) {
echo mysqli_errno($db). .mysqli_error($db).\r\n;
}

echo date(Y-m-d H:i:s). = query end...\r\n;

mysqli_close($db);

?

Expected result:

During query, mysql connection lost.

PHP Warning:  mysqli_query(): MySQL server has gone away in
C:\php\Script\mysqli
_test.php on line 14


Actual result:
--
C:\php\Script..\php.exe mysqli_test.php
2009-09-02 13:23:15 = query start...
PHP Warning:  mysqli_query(): MySQL server has gone away in
C:\php\Script\mysqli
_test.php on line 14
PHP Warning:  mysqli_query(): Error reading result set's header in
C:\php\Script
\mysqli_test.php on line 14
2006 MySQL server has gone away
2009-09-02 13:24:15 = query end...

C:\php\Script





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



#46289 [Opn-Bgs]: PDO execute causes apache.exe to crash

2009-09-02 Thread pajoye
 ID:   46289
 Updated by:   paj...@php.net
 Reported By:  asylow at free dot fr
-Status:   Open
+Status:   Bogus
 Bug Type: PDO related
 Operating System: Windows XP SP3
 PHP Version:  5.2.9
 New Comment:

Ok, it was then the classic case where MySql's libmysql DLL was used
instead of the version bundled with PHP. We already have many bogus
reports about this issue and your solution is the right one (as explain
in the other reports).


Previous Comments:


[2009-09-02 03:07:10] Parad0X dot UA at gmail dot com

I was able to fix this by removing MYSQL from Windows' PATH env
setting. Looks like when PHP is looking for libmysql.dll it uses the
first one it finds in mysql\bin and it's not quite compatible. 
Or you can try to add php to the path before mysql.

I hope that helps.



[2009-06-22 03:53:32] ramin dot farmani at gmail dot com

Hi
similarly my httpd.exe crashed when i runnig a site wroten by Yii
framework it's seem we have a big problem in php_pdo_mysql library I
using php 5.2.10



[2009-05-24 18:04:07] dave at abo dot co dot uk

I have a similar occurrence when running through apache2.2 and mysql 5

When running a page via apache with mysql query it crashes 

szAppName : httpd.exe szAppVer : 2.2.11.0 
szModName : php5ts.dll 
szModVer : 5.2.9.9 offset : ac7a   

however when running the same page through php cli it works fine

Running PHP 5.2.9-2 (cli) (built: Apr  9 2009 08:23:19)
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies

Here is my example code 

It crashes frequently on the mysql_connect line other times it appears
to get as far (compiling) as the mysql query


?
  $cMysqlDatabase = 'develop';
  $cMysqlUsername = 'develop';
  $cMysqlPassword = 'develop';
  $cMysqlDatabase = 'develop_dev';

  $mysql_link = mysql_connect($gcMysqlHost1, $cMysqlUsername,
$cMysqlPassword);
  $bDatabaseSelected = mysql_select_db($cMysqlDatabase, $mysql_link);

  print hello\n;
  $nTestLevel = 1;

  if ($nTestLevel  0)
  {
print  nTestLevel  0;
$query = show tables\n;

print Query = $query;

$mysql_result = mysql_query($query, $mysql_link);
if ($mysql_result)
{
  while ($arTables = mysql_fetch_assoc($mysql_result))
  {
print_r($arTables);
  }
}
else
{
  print error . mysql_error($mysql_link) . \n;
}
  }
  print end\n;

?



[2009-05-08 19:10:51] mattgrdinic at yahoo dot com

I can confirm this bug as well. The solution was similar to above, I
replaced the php_pdo_mysql.dll and php_pdo.dll which were version
5.2.9.9 with ones from my 5.2.8 install (which were version 5.2.8.8(,
and all works as expected.



[2009-05-03 19:01:26] oddvibes at gmail dot com

I fixed this problem on my computer. In my case it seems to have to do
something with the Xammp installation. It probably would be interesting
to know if the other people who were experiencing this problem were also
running on xammp.

I found this sollution by searching the web and found it on the
Magento-forum:
http://www.magentocommerce.com/boards/viewthread/31789/

The solution is simple:

- Download:
http://windows.php.net/downloads/snaps/php-5.2-win32-VC6-x86-latest.zip
- Unzip  copy libmysql.dll into xampp\apache\bin  xampp\php.
- Restart apache.



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

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



#49439 [NEW]: (unicode) and (string) types

2009-09-02 Thread zlobnygrif at gmail dot com
From: zlobnygrif at gmail dot com
Operating system: FreeBSD 7.2-RELEASE
PHP version:  6SVN-2009-09-02 (snap)
PHP Bug Type: Unicode Engine related
Bug description:  (unicode) and (string) types

Description:

ENG: Functions for working with strings return different types. Because of
this, for example, function strtr not working properly.

RUS: Ôóíêöèè äëÿ ðàáîòû ñî ñòðîêàìè âîçâðàùàþò ðàçíûå òèïû ðåñóðñîâ. Èç-çà
ýòîãî äðóãèå ôóíêöèè, íàïðèìåð strtr, ðàáîòàþò íåïðàâèëüíî.

Reproduce code:
---
$sour = 'hello';

ob_start();
echo $sour;
$buff = ob_get_clean();

var_dump($sour);
var_dump($buff);

var_dump($sour === $buff);
var_dump(substr($buff,0));

var_dump(strtr($buff, array($sour = 'HELLO')));
var_dump(strtr($buff, $sour, 'HELLO'));

Expected result:

unicode(5) hello
string(5) hello
bool(false)
string(5) hello
string(5) hello
unicode(5) HELLO

Actual result:
--
unicode(5) hello
unicode(5) hello
bool(true)
unicode(5) hello
unicode(5) HELLO
unicode(5) HELLO

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



#49436 [Fbk-Opn]: during query executed, mysql connection lost

2009-09-02 Thread november at netsecuretech dot com
 ID:   49436
 User updated by:  november at netsecuretech dot com
 Reported By:  november at netsecuretech dot com
-Status:   Feedback
+Status:   Open
 Bug Type: MySQLi related
 Operating System: windowsXP
 PHP Version:  5.3.0
 New Comment:

I installed VC9 x86 Thread Safe (2009-Sep-02 11:00:00) verion.

It is not work well.

result is below...

thank you.


C:\php\Script..\php.exe mysqli_test.php
2009-09-02 19:03:27 = query start...
2006 MySQL server has gone away
2009-09-02 19:04:27 = query end...

C:\php\Script


Previous Comments:


[2009-09-02 09:41:45] j...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/





[2009-09-02 04:40:26] november at netsecuretech dot com

mysql query takes 20~30 minutes;

$query = create table test as select c_ip, count(*) from iis_summary
group by c_ip;

thank you



[2009-09-02 04:37:23] november at netsecuretech dot com

Description:

PHP version : 5.3.0 Windows Binary VC9 x86 Thread Safe (2009-Jun-30
08:52:56)

Mysql version : 5.1.37-community-edition (CentOS 4.7)

I use php CLI SAPI.

PHP cli's default max_execution_time is unlimited.

When I execute php script, mysql connection is lost.

When I use php 5.2.10, mysql query executed well.

What Can I do?

Thank you.

Reproduce code:
---
?php

$db = mysqli_connect('x.x.x.x', 'id', 'pw', 'db');

if (!$db) {
  die('Connect Error (' . mysqli_connect_errno() . ') '
  . mysqli_connect_error());
}   

echo date(Y-m-d H:i:s). = query start...\r\n;

$query = create table test as select c_ip, count(*) from iis_summary
group by c_ip;

mysqli_query($db, $query); 

if (mysqli_errno($db) != 0) {
echo mysqli_errno($db). .mysqli_error($db).\r\n;
}

echo date(Y-m-d H:i:s). = query end...\r\n;

mysqli_close($db);

?

Expected result:

During query, mysql connection lost.

PHP Warning:  mysqli_query(): MySQL server has gone away in
C:\php\Script\mysqli
_test.php on line 14


Actual result:
--
C:\php\Script..\php.exe mysqli_test.php
2009-09-02 13:23:15 = query start...
PHP Warning:  mysqli_query(): MySQL server has gone away in
C:\php\Script\mysqli
_test.php on line 14
PHP Warning:  mysqli_query(): Error reading result set's header in
C:\php\Script
\mysqli_test.php on line 14
2006 MySQL server has gone away
2009-09-02 13:24:15 = query end...

C:\php\Script





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



#48746 [Com]: Unable to browse directories within Junction Points

2009-09-02 Thread phpstuff at cresstone dot com
 ID:   48746
 Comment by:   phpstuff at cresstone dot com
 Reported By:  ddkees at illinois dot edu
 Status:   Feedback
 Bug Type: Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye
 New Comment:

sorry, found another mounted volume issue:

is_dir reutrns true when passed a file on a mounted volume.
Additionaly, chdir retruns true when passed that file.

eg: is_dir('c:\mounted_volume\image.jpg'); returns true. image.jpg is a
file and mounted_volume is a junction point mounted volume.


Previous Comments:


[2009-09-02 09:31:36] phpstuff at cresstone dot com

Everything seems to be working as of the latest snapshot, thanks.



[2009-09-01 17:54:20] paj...@php.net

scandir has been fixed (not directly related to this issue) as well as
the mounted points issues. All regressions should be fixed now. Can you
give it a try please? The next snapshot will have the fixes.



[2009-09-01 17:51:00] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287950
Log: - #48746, revert previous about volume. Fix volume support to
allow all mounted points (with or without drives)



[2009-09-01 17:46:17] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287949
Log: - #48746, fix regression in readdir/scandir and mounted points or
junctions on windows



[2009-08-30 13:06:33] paj...@php.net

@shoresofnowhere at gmail dot com

Not with symlink/link/etc. You can try it under unix as well:

/var/www/dir1
/var/www/test.txt
/var/www/dir2
/var/www/dir2/linktodir1
/var/www/dir2/test2.txt
/var/www/dir2/linktodir1/t.php

In t.php, ../test2.txt will fail because it will use dir1 as base
direct. That's how it always worked, windows had only partial support
for links (symbolic or hard) or junctions. It worked before but it was
not correct (and not portable).



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

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



#48746 [Fbk-Asn]: Unable to browse directories within Junction Points

2009-09-02 Thread pajoye
 ID:   48746
 Updated by:   paj...@php.net
 Reported By:  ddkees at illinois dot edu
-Status:   Feedback
+Status:   Assigned
 Bug Type: Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye
 New Comment:

Oh my, I'm about to loose my last hair :)

But we are getting close now... back to code


Previous Comments:


[2009-09-02 10:12:22] phpstuff at cresstone dot com

sorry, found another mounted volume issue:

is_dir reutrns true when passed a file on a mounted volume.
Additionaly, chdir retruns true when passed that file.

eg: is_dir('c:\mounted_volume\image.jpg'); returns true. image.jpg is a
file and mounted_volume is a junction point mounted volume.



[2009-09-02 09:31:36] phpstuff at cresstone dot com

Everything seems to be working as of the latest snapshot, thanks.



[2009-09-01 17:54:20] paj...@php.net

scandir has been fixed (not directly related to this issue) as well as
the mounted points issues. All regressions should be fixed now. Can you
give it a try please? The next snapshot will have the fixes.



[2009-09-01 17:51:00] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287950
Log: - #48746, revert previous about volume. Fix volume support to
allow all mounted points (with or without drives)



[2009-09-01 17:46:17] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287949
Log: - #48746, fix regression in readdir/scandir and mounted points or
junctions on windows



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

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



#48746 [Asn]: Unable to browse directories within Junction Points

2009-09-02 Thread pajoye
 ID:   48746
 Updated by:   paj...@php.net
 Reported By:  ddkees at illinois dot edu
 Status:   Assigned
 Bug Type: Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye
 New Comment:

Can't reproduce here. Which OS are you using for this test?


Previous Comments:


[2009-09-02 10:30:20] paj...@php.net

Oh my, I'm about to loose my last hair :)

But we are getting close now... back to code



[2009-09-02 10:12:22] phpstuff at cresstone dot com

sorry, found another mounted volume issue:

is_dir reutrns true when passed a file on a mounted volume.
Additionaly, chdir retruns true when passed that file.

eg: is_dir('c:\mounted_volume\image.jpg'); returns true. image.jpg is a
file and mounted_volume is a junction point mounted volume.



[2009-09-02 09:31:36] phpstuff at cresstone dot com

Everything seems to be working as of the latest snapshot, thanks.



[2009-09-01 17:54:20] paj...@php.net

scandir has been fixed (not directly related to this issue) as well as
the mounted points issues. All regressions should be fixed now. Can you
give it a try please? The next snapshot will have the fixes.



[2009-09-01 17:51:00] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287950
Log: - #48746, revert previous about volume. Fix volume support to
allow all mounted points (with or without drives)



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

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



#48746 [Asn-Fbk]: Unable to browse directories within Junction Points

2009-09-02 Thread pajoye
 ID:   48746
 Updated by:   paj...@php.net
 Reported By:  ddkees at illinois dot edu
-Status:   Assigned
+Status:   Feedback
 Bug Type: Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye


Previous Comments:


[2009-09-02 10:35:32] paj...@php.net

Can't reproduce here. Which OS are you using for this test?



[2009-09-02 10:30:20] paj...@php.net

Oh my, I'm about to loose my last hair :)

But we are getting close now... back to code



[2009-09-02 10:12:22] phpstuff at cresstone dot com

sorry, found another mounted volume issue:

is_dir reutrns true when passed a file on a mounted volume.
Additionaly, chdir retruns true when passed that file.

eg: is_dir('c:\mounted_volume\image.jpg'); returns true. image.jpg is a
file and mounted_volume is a junction point mounted volume.



[2009-09-02 09:31:36] phpstuff at cresstone dot com

Everything seems to be working as of the latest snapshot, thanks.



[2009-09-01 17:54:20] paj...@php.net

scandir has been fixed (not directly related to this issue) as well as
the mounted points issues. All regressions should be fixed now. Can you
give it a try please? The next snapshot will have the fixes.



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

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



#48866 [Asn]: ldap.conf TLS_REQCERT directive fails for ldaps

2009-09-02 Thread dev at lechat dot org
 ID:   48866
 User updated by:  dev at lechat dot org
 Reported By:  dev at lechat dot org
 Status:   Assigned
 Bug Type: LDAP related
 Operating System: win32 only - windows server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye
 New Comment:

I have now tested with 5.2.10 and It works succesfully as with
5.2.9-1.

I retry with 5.3.0, to test jbd at anl dot gov advice about restart
windows and not only apache, but I got the same problem. 
'TLS_REQCERT never' defined in c:\ldap.conf is not applied. I can still
observe that this file is open and read with a filemonitor at the first
ldaps request.

Hope this will be effectively fixed in next ldap lib version.

Thank you for your help.


Previous Comments:


[2009-08-31 15:26:40] jbd at anl dot gov

I have found that moving ldap.conf to c:\ldap.conf and restarting the
Windows machine (not just Apache) resolved the error for me with PHP 5.3
using LDAPS.



[2009-08-07 12:01:54] paj...@php.net

Has to be fixed in the ldap libs.



[2009-08-07 08:04:47] dev at lechat dot org

Hi,
I didn't try 5.2.10.
I will make a try in one week
when i Will be back from holidays (-;
At this point I'll give you a feedback
if the problem occurs or not with 5.2.10.



[2009-08-05 21:59:26] j...@php.net

Does this happen also with PHP 5.2.10 ?



[2009-07-09 09:35:06] dev at lechat dot org

Description:

Dealing with a secure ldap connection :
Since php 5.3, the
'TLS_REQCERT never' (means do not check certificate validity, and
process the request anymore)
directive in C:\OpenLDAP\sysconf\ldap.conf are not applied when trying
to bind an ldapS server that emit a certificate with an invalid CA.

The result is that the ldapS bind fails because php refuse the
certificate.

By using a filMonitor program, I saw that since php 5.3 php_ldap.dll,
the ldap conf file is now 'c:\ldap.conf' rather than
C:\OpenLDAP\sysconf\ldap.conf. I tried to put directive in this file
too. I can see that the file is open and read, but the directive
'TLS_REQCERT never' is not applied. Bind fails.


On the same server this is perfectly working with php  5.3 (until
5.2.9-1 as fas as I know).

Note that standard ldap connection works as expected with 5.3

Reproduce code:
---
$ldapConnect = ldap_connect('ldaps://ldaps.myserver.com:3269');
ldap_set_option($ldapConnect, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldapConnect, LDAP_OPT_REFERRALS, 0);
$ldapBind = ldap_bind($ldapConnect, $username,$password);
$filter=(| (employeeid=$user)(name=$user)(cn=$user)
(userprincipalname=$u...@mydomain) ) ;
$ldapSearch = ldap_search($ldapConnect, $baseDn, $filter);
$ldapEntries = ldap_get_entries($ldapConnect, $ldapSearch);
ldap_free_result($ldapSearch);
ldap_unbind($ldapConnect);

Expected result:

ldap_get_entries returns ldap entries that match whith the filter, as
expected.

Actual result:
--
None, cannot bind.





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



#46074 [Asn]: Bus error during running PHP CLI under IRIX 6.5.30

2009-09-02 Thread dmitry
 ID:   46074
 Updated by:   dmi...@php.net
 Reported By:  neko at nekochan dot net
 Status:   Assigned
 Bug Type: Reproducible crash
 Operating System: IRIX 6.5.30
 PHP Version:  5.3.0alpha2
 Assigned To:  dmitry
 New Comment:

Can anyone provide an access to IRIX server, where I can check the
patch? (contact me by email)


Previous Comments:


[2009-08-21 20:18:23] dgarciacampos at gmail dot com

I just finished compiling and make testing php on a linux-sparc
machine.
bash-3.2$ uname -a
Linux gcars0kq 2.6.27.12-78.2.9.fc9.sparc64.smp #1 SMP Sat Jan 24
22:46:27 EST 2009 sparc64 sparc64 sparc64 GNU/Linux


I'd like to point out that the last patch from the e-mail thread below
is slightly wrong, thread heading: ([12 Jul 5:20am UTC] pogma at
thewrittenword dot com)

The changes made to Zend/zend_vm_execute.h a somewhat misleading. 
If anybody needs a copy of this file or the the other two files
mentioned in the patch, i can gladly send them to you, just e-mail me at
dgarciacampos at gmail dot com.

Thanks,
David A. Garcia-Campos



[2009-07-14 02:49:51] pogma at thewrittenword dot com

Well, even though it built and tested ok, the patch had an error.

+   sizeof(temp_variable) * op_array-T TSRMLS_CC));

should be
+   sizeof(temp_variable) * op_array-T) TSRMLS_CC);

Seems to be that building php with an apxs that was built with
mpm=worker requires this.



[2009-07-12 17:56:14] neko at nekochan dot net

I've tested the new patch and it is also working well on IRIX. Thanks 
much!



[2009-07-12 05:20:52] pogma at thewrittenword dot com

Ok, so the problem is that, by changing the size of execute_data and
the alignment of the Ts member, when an exception occurs, zend no longer
knows when to stop unwinding the stack. 

We added another member to execute_data that keeps a record of the
stack top at the time of creation, we can no longer get there via the Ts
member, because we may have moved it, and the variables used to
calculate it, though they are stored in the execute_data struct, are not
constant, and may have different values at stack unwind time.

We see far fewer problems on ia64-hp-hpux with this patch.


Index: Zend/zend.c
===
--- Zend/zend.c.orig2009-07-11 02:57:58.525910184 +
+++ Zend/zend.c 2009-07-11 02:59:39.702014580 +
@@ -271,12 +276,12 @@
}
break;
case IS_DOUBLE:
-   *expr_copy = *expr;
+   memcpy(expr_copy,expr,sizeof(zval));
zval_copy_ctor(expr_copy);
zend_locale_sprintf_double(expr_copy
ZEND_FILE_LINE_CC);
break;
default:
-   *expr_copy = *expr;
+   memcpy(expr_copy,expr,sizeof(zval));
zval_copy_ctor(expr_copy);
convert_to_string(expr_copy);
break;
Index: Zend/zend_vm_execute.h
===
--- Zend/zend_vm_execute.h.orig 2009-07-12 00:32:46.0 +
+++ Zend/zend_vm_execute.h  2009-07-12 01:38:46.131809202 +
@@ -35,6 +35,22 @@
 #undef EX
 #define EX(element) execute_data-element

+#ifndef ZEND_MM_ALIGNMENT
+# define ZEND_MM_ALIGNMENT 8
+# define ZEND_MM_ALIGNMENT_LOG2 3
+#elif ZEND_MM_ALIGNMENT  4
+# undef ZEND_MM_ALIGNMENT
+# undef ZEND_MM_ALIGNMENT_LOG2
+# define ZEND_MM_ALIGNMENT 4
+# define ZEND_MM_ALIGNMENT_LOG2 2
+#endif
+#ifndef ZEND_MM_ALIGNMENT_MASK
+#define ZEND_MM_ALIGNMENT_MASK ~(ZEND_MM_ALIGNMENT-1)
+#endif
+/* Aligned header size */
+#ifndef ZEND_MM_ALIGNED_SIZE
+#define ZEND_MM_ALIGNED_SIZE(size)   ((size + ZEND_MM_ALIGNMENT - 1) 
ZEND_MM_ALIGNMENT_MASK)
+#endif

 ZEND_API void execute(zend_op_array *op_array TSRMLS_DC)
 {
@@ -52,13 +68,14 @@
 zend_vm_enter:
/* Initialize execute_data */
execute_data = (zend_execute_data *)zend_vm_stack_alloc(
+   (ZEND_MM_ALIGNMENT -1) + (
sizeof(zend_execute_data) +
sizeof(zval**) * op_array-last_var *
(EG(active_symbol_table) ? 1 : 2) +
-   sizeof(temp_variable) * op_array-T TSRMLS_CC);
-
+   sizeof(temp_variable) * op_array-T TSRMLS_CC));
EX(CVs) = (zval***)((char*)execute_data +
sizeof(zend_execute_data));
memset(EX(CVs), 0, sizeof(zval**) * op_array-last_var);
-   EX(Ts) = (temp_variable *)(EX(CVs) + op_array-last_var *
(EG(active_symbol_table) ? 1 : 2));
+   EX(top) = zend_vm_stack_top(TSRMLS_C);
+   EX(Ts) = (temp_variable *)

#46889 [Asn-Csd]: Memory leak in strtotime()

2009-09-02 Thread jani
 ID:   46889
 Updated by:   j...@php.net
 Reported By:  tim at digicol dot de
-Status:   Assigned
+Status:   Closed
 Bug Type: Date/time related
 Operating System: *
 PHP Version:  5.2.8
 Assigned To:  derick
 New Comment:

Same issue as in bug #47285 


Previous Comments:


[2009-07-03 08:28:03] paj...@php.net

Where went this comment:

[2009-06-26 08:14:21] strucken at web dot de

Without using the second parameter of strtotime the memory leak is
fixed. But memory usage is still increasing when I execute the
following
under windows (reproduces with 5.2.8, 5.2.9 and 5.2.10 under windows
xp
and windows server 2003) until I reach the 2 GB limit of my windows
32bit:

for( $i = 1; ; $i++ )
   strtotime( '+1 week', $i );

And why was it closed then?



[2008-12-19 14:11:36] tim at digicol dot de

I have verified that this bug is fixed in the PHP snapshot  php5.2-
200812191130.tar.bz2. Thanks a lot!



[2008-12-18 14:57:03] der...@php.net

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.





[2008-12-18 11:12:33] martin at 925 dot dk

Reproduced here.

OS:
FreeBSD 7.0-RELEASE-p4 FreeBSD 7.0-RELEASE-p4

PHP:
PHP 5.2.8 (cli) (built: Dec  8 2008 19:11:49) 
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies



[2008-12-17 15:11:48] tim at digicol dot de

Description:

With PHP 5.2.8, strtotime() on my Linux box leaks memory; we've 
noticed it because we're using long-running scripts with the PHP CLI. 
In our case, the PHP processes grew to hundreds of MB RAM usage within

minutes. This is not the case with PHP 5.2.6.

The funny thing is that neither memory_get_usage(false) nor 
memory_get_usage(true) report the actual memory usage; here's a line 
from top:

22728 digicol   25   0  258m 218m 6928 R 75.4 43.4   0:42.91 php

... while the PHP functions report at the same time:

memory_get_usage(false): 1738020
memory_get_usage(true):  1835008

What's also funny is that the default memory_limit = 128M setting 
doesn't help: PHP doesn't notice that this much RAM is being 
used and so doesn't kill the script. (But I can trigger the memory 
limit as usual with other PHP scripts, so PHP's memory limit isn't 
entirely broken.)

I tested with an unchanged copy of php.ini-recommended.

My configure string:

'./configure'  '--with-apxs2=/usr/bin/apxs2' '--enable-exif' '--
enable-ftp' '--enable-mbregex' '--enable-mbstring=all' '--enable-
pcntl' '--enable-soap' '--enable-zip' '--with-zlib' '--with-curl' '--
with-freetype-dir=/usr' '--with-gd' '--with-jpeg-dir=/usr' '--with-
ldap' '--with-mysqli' '--with-
oci8=instantclient,/usr/local/lib/instantclient' '--enable-sigchild' 
'--with-png-dir=/usr' '--with-xsl' '--with-mcrypt'

This is Debian Linux 4.0, running in VMware Fusion on an Intel Mac.

Thanks a lot for looking into this, and for the great work on PHP!

Reproduce code:
---
?php

// Run with the PHP CLI on the Linux shell...
// WARNING: If this bug affects you as well, your machine
// might start swapping within just a few seconds!

while (true)
strtotime('2008-12-16 19:48:27');

?


Expected result:

No increase in memory usage.

Actual result:
--
Memory usage is increasing dramatically - on my box, the process is 
growing by 100 MB per second...





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



#49441 [Opn-Csd]: filter_var - FILTER_VALIDATE_EMAIL

2009-09-02 Thread iliaa
 ID:   49441
 Updated by:   il...@php.net
 Reported By:  andrew at ajohnstone dot com
-Status:   Open
+Status:   Closed
 Bug Type: *General Issues
 Operating System: Debian
 PHP Version:  5.2.10
 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/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:


[2009-09-02 11:57:31] andrew at ajohnstone dot com

Description:

var_dump(filter_var('and...@bb1.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
bool(false)

var_dump(filter_var('and...@debian.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
bool(false)

php -v PHP 5.2.10-2 


Reproduce code:
---
var_dump(filter_var('and...@bb1.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
var_dump(filter_var('and...@debian.gateway.2wire.net',FILTER_VALIDATE_EMAIL));


Expected result:

string(28) and...@bb1.gateway.2wire.net
string(31) and...@debian.gateway.2wire.net

Actual result:
--
bool(false)
bool(false)





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



#49442 [NEW]: Some queries crash PHP with mysqli_real_connect()

2009-09-02 Thread vr...@php.net
From: vr...@php.net
Operating system: Windows
PHP version:  5.3.0
PHP Bug Type: MySQLi related
Bug description:  Some queries crash PHP with mysqli_real_connect()

Description:

LOAD DATA LOCAL INFILE query together with connecting by
mysqli_real_connect() causes PHP crash. Maybe it is not the single crashing
query but common queries like SELECT or INSERT work.

When I replace mysqli_init() + mysqli_real_connect() by mysqli_connect()
then everything works (no crash).

Reproduce code:
---
?php
$dbh = mysqli_init();
$dbh-real_connect(, ODBC, , cds);
$dbh-query(LOAD DATA LOCAL INFILE 'songs.csv' INTO TABLE songs);
?


Expected result:

Query executed OK.

Actual result:
--
PHP crashes.

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



#42060 [Com]: [PATCH] LDAP: Add pagedResults support and more

2009-09-02 Thread jochen at keutel dot de
 ID:   42060
 Comment by:   jochen at keutel dot de
 Reported By:  iarenuno at eteo dot mondragon dot edu
 Status:   Assigned
 Bug Type: Feature/Change Request
 Operating System: *
 PHP Version:  5CVS, 6CVS (2008-11-01)
 Assigned To:  patrickallaert
 New Comment:

I still can't see this patch in 5.3.x or HEAD; neither in PHP 6.

A lot of people really need this extension; e.g. when talking LDAP to
MS Active Directory you *need* the paged results control. Reason: AD
returns only 1000 entries without paging.

Another scenario often used is password policies; also her you
definitely need parsing of extended LDAP responses.

Please apply this patch !!!

Regards,  Jochen.


Previous Comments:


[2009-06-08 11:30:13] dj at krul dot nu

pajoye: I can't find the commit you're referring to (either in HEAD or
the 5.3 branch). Has it been committed yet?



[2009-06-05 15:31:40] paj...@php.net

 get some help :)



[2008-11-16 14:57:56] paj...@php.net

Alexey has ported the patch to 5.3, it will committed in the next days.



[2008-07-17 13:00:37] ando at sys-net dot it

I didn't get any notification about this message, so I overlooked it; I
was pointed here by a user (like many others) interested in the
functionalities provided by the patch.  In the meanwhile, I noticed that
the code, after more than 2 years of inactivity, is now incompatible
with the patch.  Fixing it will require an amount of time that is
incompatible with my current schedule.  Feel free to fix it yourself. 
Cheers, p.



[2008-06-05 19:10:08] paj...@php.net

After a little discussions about windows with Howard, he pointed me to
this bug report. 

It is now the right time to apply such patch (or any other new
features) to ext/ldap as we are getting closer to the PHP 5.3 features
freeze.

Ando, do you have the time to work on it for php5.3?





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

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



#47285 [Asn]: strtotime() still leaks memory

2009-09-02 Thread jani
 ID:   47285
 Updated by:   j...@php.net
 Reported By:  danger at FreeBSD dot org
 Status:   Assigned
 Bug Type: Date/time related
-Operating System: FreeBSD
+Operating System: *
-PHP Version:  5.2.8
+PHP Version:  5.2 (SVN-2009-0-02)
 Assigned To:  derick
 New Comment:

Reproduced on 32/64 bit servers using latest PHP_5_2 checkout. Does NOT
happen with PHP_5_3.


Previous Comments:


[2009-08-26 16:42:29] heron at xnapid dot com

I can confirm the same leak, running in Apache on Windows.  Apache
kills the script after a time limit, but the leaked memory remains
leaked; refreshing the same URL causes the total leaked memory to
increase from there.  It looks like it leaks 800KB per second or so, and
the script is killed after leaking about 30MB.

I'm running PHP 5.2.9-2, which came straight from the default Windows
installer.



[2009-07-23 20:26:57] scott at crisscott dot com

Reproduced on RHEL 4 (PHP built from source not RPM)
PHP 5.2.9 (cli) (built: May  1 2009 13:47:24) 
Copyright (c) 1997-2009 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2009 Zend Technologies
with Zend Debugger v5.2.14, Copyright (c) 1999-2008, by Zend
Technologies

Applying the patch from oliver at realtsp dot com slowed down the leak,
but did not stop it entirely.



[2009-07-07 10:47:47] oliver at realtsp dot com

I can confirm that we can reproduce this bug on FreeBSD 7.2 with
php5.2.10 and that the patch provided by bloudon at townnews dot com
does stop the leak.

I had to manually apply the patch because copying out of the html
rarely works, so I have prepared a clean version which applies without
errors to the current FreeBSD 7.2 port of php5. Here it is:

http://www.realtsp.com/public/patch-ext_date_php_date.c

Oliver



[2009-04-15 07:55:33] kimc at operamail dot com

You dont see the memory leak with PHP's memory_get_usage(), and the
process wont get killed by PHP's general memory_limit.

PHP doesnt see the memory use, but the kernel does and after some time
the kernel will kill it due to ulimit or out of memory.



[2009-04-06 10:01:32] davide dot ferrari at atrapalo dot com

Sorry for being dumb but does this leak affect memory_limit ? I mean, I
can reproduce the memleak with Linux and PHP 5.2.9 but
memory_get_usage() output seems constant, although memory occupied by
the process itself is getting biger every second, so there's clearly a
memleak.
I ask this because I don't know if there is an actual relationship
between this bug and some strange cronjob deaths I'm experiencing with
PHP 5.2.9.

TIA



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

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



#49441 [NEW]: filter_var - FILTER_VALIDATE_EMAIL

2009-09-02 Thread andrew at ajohnstone dot com
From: andrew at ajohnstone dot com
Operating system: Debian
PHP version:  5.2.10
PHP Bug Type: *General Issues
Bug description:  filter_var - FILTER_VALIDATE_EMAIL

Description:

var_dump(filter_var('and...@bb1.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
bool(false)

var_dump(filter_var('and...@debian.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
bool(false)

php -v PHP 5.2.10-2 


Reproduce code:
---
var_dump(filter_var('and...@bb1.gateway.2wire.net',FILTER_VALIDATE_EMAIL));
var_dump(filter_var('and...@debian.gateway.2wire.net',FILTER_VALIDATE_EMAIL));


Expected result:

string(28) and...@bb1.gateway.2wire.net
string(31) and...@debian.gateway.2wire.net

Actual result:
--
bool(false)
bool(false)

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



#49442 [Opn]: Some queries crash PHP with mysqli_real_connect()

2009-09-02 Thread vrana
 ID:   49442
 Updated by:   vr...@php.net
 Reported By:  vr...@php.net
 Status:   Open
 Bug Type: MySQLi related
 Operating System: Windows
 PHP Version:  5.3.0
 New Comment:

Backtrace analysis is available at http://www.vrana.cz/phpbug49442.zip


Previous Comments:


[2009-09-02 12:32:21] vr...@php.net

Description:

LOAD DATA LOCAL INFILE query together with connecting by
mysqli_real_connect() causes PHP crash. Maybe it is not the single
crashing query but common queries like SELECT or INSERT work.

When I replace mysqli_init() + mysqli_real_connect() by
mysqli_connect() then everything works (no crash).

Reproduce code:
---
?php
$dbh = mysqli_init();
$dbh-real_connect(, ODBC, , cds);
$dbh-query(LOAD DATA LOCAL INFILE 'songs.csv' INTO TABLE songs);
?


Expected result:

Query executed OK.

Actual result:
--
PHP crashes.





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



#49442 [Opn-Fbk]: Some queries crash PHP with mysqli_real_connect()

2009-09-02 Thread pajoye
 ID:   49442
 Updated by:   paj...@php.net
 Reported By:  vr...@php.net
-Status:   Open
+Status:   Feedback
 Bug Type: MySQLi related
 Operating System: Windows
 PHP Version:  5.3.0
 New Comment:

Please provide the create table and a small CSV to reproduce the
problem.


Previous Comments:


[2009-09-02 12:46:06] vr...@php.net

Backtrace analysis is available at http://www.vrana.cz/phpbug49442.zip



[2009-09-02 12:32:21] vr...@php.net

Description:

LOAD DATA LOCAL INFILE query together with connecting by
mysqli_real_connect() causes PHP crash. Maybe it is not the single
crashing query but common queries like SELECT or INSERT work.

When I replace mysqli_init() + mysqli_real_connect() by
mysqli_connect() then everything works (no crash).

Reproduce code:
---
?php
$dbh = mysqli_init();
$dbh-real_connect(, ODBC, , cds);
$dbh-query(LOAD DATA LOCAL INFILE 'songs.csv' INTO TABLE songs);
?


Expected result:

Query executed OK.

Actual result:
--
PHP crashes.





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



#49442 [Fbk]: Some queries crash PHP with mysqli_real_connect()

2009-09-02 Thread vrana
 ID:   49442
 Updated by:   vr...@php.net
 Reported By:  vr...@php.net
 Status:   Feedback
 Bug Type: MySQLi related
 Operating System: Windows
 PHP Version:  5.3.0
 New Comment:

CREATE TABLE and sample CSV included in
http://www.vrana.cz/phpbug49442.zip


Previous Comments:


[2009-09-02 13:21:23] paj...@php.net

Please provide the create table and a small CSV to reproduce the
problem.



[2009-09-02 12:46:06] vr...@php.net

Backtrace analysis is available at http://www.vrana.cz/phpbug49442.zip



[2009-09-02 12:32:21] vr...@php.net

Description:

LOAD DATA LOCAL INFILE query together with connecting by
mysqli_real_connect() causes PHP crash. Maybe it is not the single
crashing query but common queries like SELECT or INSERT work.

When I replace mysqli_init() + mysqli_real_connect() by
mysqli_connect() then everything works (no crash).

Reproduce code:
---
?php
$dbh = mysqli_init();
$dbh-real_connect(, ODBC, , cds);
$dbh-query(LOAD DATA LOCAL INFILE 'songs.csv' INTO TABLE songs);
?


Expected result:

Query executed OK.

Actual result:
--
PHP crashes.





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



#49442 [Fbk-Opn]: Some queries crash PHP with mysqli_real_connect()

2009-09-02 Thread vrana
 ID:   49442
 Updated by:   vr...@php.net
 Reported By:  vr...@php.net
-Status:   Feedback
+Status:   Open
 Bug Type: MySQLi related
 Operating System: Windows
 PHP Version:  5.3.0


Previous Comments:


[2009-09-02 13:27:42] vr...@php.net

CREATE TABLE and sample CSV included in
http://www.vrana.cz/phpbug49442.zip



[2009-09-02 13:21:23] paj...@php.net

Please provide the create table and a small CSV to reproduce the
problem.



[2009-09-02 12:46:06] vr...@php.net

Backtrace analysis is available at http://www.vrana.cz/phpbug49442.zip



[2009-09-02 12:32:21] vr...@php.net

Description:

LOAD DATA LOCAL INFILE query together with connecting by
mysqli_real_connect() causes PHP crash. Maybe it is not the single
crashing query but common queries like SELECT or INSERT work.

When I replace mysqli_init() + mysqli_real_connect() by
mysqli_connect() then everything works (no crash).

Reproduce code:
---
?php
$dbh = mysqli_init();
$dbh-real_connect(, ODBC, , cds);
$dbh-query(LOAD DATA LOCAL INFILE 'songs.csv' INTO TABLE songs);
?


Expected result:

Query executed OK.

Actual result:
--
PHP crashes.





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



#49442 [Opn-Asn]: Some queries crash PHP with mysqli_real_connect()

2009-09-02 Thread pajoye
 ID:   49442
 Updated by:   paj...@php.net
 Reported By:  vr...@php.net
-Status:   Open
+Status:   Assigned
 Bug Type: MySQLi related
 Operating System: Windows
 PHP Version:  5.3.0
-Assigned To:  
+Assigned To:  mysql


Previous Comments:


[2009-09-02 13:27:42] vr...@php.net

CREATE TABLE and sample CSV included in
http://www.vrana.cz/phpbug49442.zip



[2009-09-02 13:21:23] paj...@php.net

Please provide the create table and a small CSV to reproduce the
problem.



[2009-09-02 12:46:06] vr...@php.net

Backtrace analysis is available at http://www.vrana.cz/phpbug49442.zip



[2009-09-02 12:32:21] vr...@php.net

Description:

LOAD DATA LOCAL INFILE query together with connecting by
mysqli_real_connect() causes PHP crash. Maybe it is not the single
crashing query but common queries like SELECT or INSERT work.

When I replace mysqli_init() + mysqli_real_connect() by
mysqli_connect() then everything works (no crash).

Reproduce code:
---
?php
$dbh = mysqli_init();
$dbh-real_connect(, ODBC, , cds);
$dbh-query(LOAD DATA LOCAL INFILE 'songs.csv' INTO TABLE songs);
?


Expected result:

Query executed OK.

Actual result:
--
PHP crashes.





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



#49295 [Com]: stream_socket_client() fails on SSL+async

2009-09-02 Thread frase at cs dot wisc dot edu
 ID:   49295
 Comment by:   frase at cs dot wisc dot edu
 Reported By:  frase at cs dot wisc dot edu
 Status:   Assigned
 Bug Type: OpenSSL related
 Operating System: Win 2000 Pro SP4
 PHP Version:  5.2.11RC1
 Assigned To:  srinatar
 New Comment:

Commenting the stream_set_blocking() doesn't change anything for me on
Windows.  SSL+ASYNC still works exactly once (but doesn't actually
connect asynchronously) and then gives the warnings; SSL+SYNC still
works fine, as does TCP+ASYNC.

Thanks for your work on this.  I get complaints about it every week
because if the remote server doesn't respond then our software gets
stuck in the connection phase, and since the connection phase cannot be
made asynchronous, the user is unable to abort it and just has to wait.


Previous Comments:


[2009-09-02 08:38:01] srina...@php.net

just a follow up note, this issue (async not working consistently with

openssl on windows) has always been the case and this issue has nothing

to do with the fix that went in for bug:48182.



[2009-09-02 08:09:22] srina...@php.net

ok, i was looking into this issue today. the issue is that , 
especially on windows -where sockets are not file descriptors unlike 
in unix, async sockets and openssl works together only if we use BIO 
wrappers provided by openssl module instead of directly accessing 
underlying sockets as file descriptors. 

the possible right way to do this would be to use  to socket wrappers 
provided by  SSL module (known as BIO wrappers which makes it work 
properly on windows).

this will require some amount of fiddling our openssl module. i don't 
think, 5.2 is a good place to do this change.  

for now, commenting this below code should help you to run your script

properly on windows. 
stream_set_blocking($socket, 0);

i will spend more time on this and investigate on the best way to use 
BIO wrappers within existing openssl module say within php 5.3



[2009-08-21 15:05:47] frase at cs dot wisc dot edu

I had a chance to compile and test PHP5.2.11RC1 under Linux this
morning (Ubuntu Jaunty, Apache 2.2.11 from repositories), and these
warnings do not appear, however I noticed another problem.

Although the SSL+async connection is successful and data is returned
under Linux, the socket is not actually opened asynchonously.  The
script blocks until the socket has finished opening, exactly as it does
without the ASYNC flag.  This is also true under Windows, for the first
run -- after that, of course, it returns the errors posted above.



[2009-08-21 01:15:44] srina...@php.net

this issue seems to be happening when this script is executed more than
once and also seems to be happening only on windows. 



[2009-08-19 13:52:18] frase at cs dot wisc dot edu

Description:

stream_socket_client() can only open one socket using SSL and the
STREAM_CLIENT_ASYNC_CONNECT flag, and then fails every time until the
Apache process is restarted.  SSL sockets without ASYNC open fine, as do
plain TCP sockets with or without ASYNC.

Originally reported as an update to bug #48182, which also only
affected the combination of SSL+ASYNC, but now reported separately here
per srina...@php.net's request.

Additionally, the timeout (argument #4 to stream_socket_client()) is
not ignored when using ASYNC, contrary to the manual: if set to 0 here,
the first warning is SSL: connection timeout instead of SSL: The
operation completed successfully.

Windows 2000 Professional SP4
Apache 2.2.11
PHP 5.2.11RC1-Win32-VC6-x86 (threadsafe binary from
http://windows.php.net/qa/)
configured as an Apache module
with php_openssl.dll and libeay32.dll+ssleay.dll v0.9.8k


Reproduce code:
---
?php
header('Content-Type: text/plain');
$errno = null;
$errstr = null;
$socket = stream_socket_client(
'ssl://'.gethostbyname('launchpad.net').':443', $errno, $errstr,
10, // timeout should be ignored when ASYNC
STREAM_CLIENT_CONNECT | STREAM_CLIENT_ASYNC_CONNECT
);
if (!$socket) {
echo errno = .$errno.\nerrstr = .$errstr.\n;
exit;
}
stream_set_blocking($socket, 0);
$data = GET / HTTP/1.0\r\nHost: launchpad.net\r\nConnection:
close\r\n\r\n;
$selR = null;
$selW = array();
$selE = null;
while ($data) {
$selW[0] = $socket;
if (stream_select($selR, $selW, $selE, 10)) {
$wrote = fwrite($socket, $data, strlen($data));
$data = substr($data, $wrote);
}
}
$html = ;
$selR = array($socket);
$selW = null;
while (!feof($socket)) {
$selR[0] = $socket;
if (stream_select($selR, $selW, $selE, 

#49443 [NEW]: Special characters in section name breaks parse_ini_file

2009-09-02 Thread eric dot caron at gmail dot com
From: eric dot caron at gmail dot com
Operating system: N/A
PHP version:  5.3.0
PHP Bug Type: Filesystem function related
Bug description:  Special characters in section name breaks parse_ini_file

Description:

PHP 5.3 changes to parse_ini_*() functions breaks scripts that have
special characters, {}|~![()^, in the section titles. (Previous versions
worked, which I assume was proper behavior because section titles can have
those characters according to community understood INI standards).

There is no documentation stating that special characters can not be used
in section titles. While the INI_SCANNER_RAW parameter provides an opening
for a workaround for this solution, to be useful, the characters
{}|~![()^ should be usable in section titles (not to be confuse with
keys, where they shouldn't be used).

Reproduce code:
---
?php
$tmpfname = tempnam(/tmp, FOO);
file_put_contents($tmpfname, '[Ask]
Crawler=true

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]
Crawler=true
');

$array = parse_ini_file($tmpfname, true);
print_r($array);
unlink($tmpfname);

Expected result:

Array
(
[Ask] = Array
(
[Crawler] = 1
)

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)] = Array
(
[Crawler] = 1
)

)


Actual result:
--
Warning: parse error, expecting `']'' in FOOFCCA.tmp on line 4 in
parseBug.php on line 10 

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



#49444 [NEW]: $_GET variable

2009-09-02 Thread hafizanil at gmail dot com
From: hafizanil at gmail dot com
Operating system: Windows Xp
PHP version:  5.3.0
PHP Bug Type: Scripting Engine problem
Bug description:  $_GET variable

Description:

Want to sent variable via javascript via $_GET method and the output going
hirewire.The varible sent also been escape first(javascript).Tested using
5.29 and 5.3
Browser 1.Internet Explorer 7
2 Firefox 3.52
3. Opera 10

Reproduce code:
---
This is  tested 5.29
[code]
$_GET['to']=admin (sit: mr chang n mr sairi n mr pzan)
kamb...@gmail.com,;
echo strlen($_GET['to'])
// out put 63
 var_dump($_GET);
// output only showing admin (sit: mr chang n mr sairi n mr pzan) 
[/code]
This is tested 5.30
[code]
$_GET['to']=admin (sit: mr chang n mr sairi n mr pzan)
kamb...@gmail.com,;
echo strlen($_GET['to'])
// out put 63
 var_dump($_GET);
//output :Page going crazy.show all the php source
[/code]

Expected result:

var_dump or print_r $_GET array should understand the variable which might
contain ;


Actual result:
--
On 5.3 It show all the source php .

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



#49362 [Com]: Deprecated php.ini options warnings output even with display_errors=off

2009-09-02 Thread romanf at trash dot net
 ID:   49362
 Comment by:   romanf at trash dot net
 Reported By:  tomas dot hlavacek at firma dot volny dot cz
 Status:   Assigned
 Bug Type: PHP options/info functions
 Operating System: *
 PHP Version:  5.3, 6
 Assigned To:  kalle
 New Comment:

Will this be fixed in 5.3? Or only in 6?

-Roman


Previous Comments:


[2009-08-26 11:08:41] j...@php.net

Correction: E_ERROR of course. :)



[2009-08-26 11:08:07] j...@php.net

And in HEAD these should be E_FATAL errors.



[2009-08-26 09:59:19] tomas dot hlavacek at firma dot volny dot cz

Yes, true. What Error Level Constant is used for showing deprecated ini
settings then?



[2009-08-26 09:52:14] j...@php.net

Assigning to Kalle who added these in the obviously wrong place.
Deprecated ini settings checks can not happen in place where a check for
removed setting is done!



[2009-08-26 09:10:52] tomas dot hlavacek at firma dot volny dot cz

Yes, I'm pretty sure to have everything updated :)

php.ini:
error_reporting = E_ALL  ~E_DEPRECATED
display_errors = On

Even if I change display_errors=Off, that message will appear.


Take a look at this output:

D:\php5php --ini
PHP Warning:  Directive 'register_long_arrays' is deprecated in PHP 5.3
and grea
ter in Unknown on line 0
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File: D:\php5\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:  (none)


For me, that warning message seems to be hardcoded in php source.
Please revise your code.



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

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



#38851 [Com]: Failed to created Apache 2 shared library

2009-09-02 Thread martin at searchoptics dot com
 ID:   38851
 Comment by:   martin at searchoptics dot com
 Reported By:  shorb at optonline dot net
 Status:   No Feedback
 Bug Type: Compile Failure
 Operating System: RedHat EL 4
 PHP Version:  5.1.6
 New Comment:

I've had a similar issue on Centos 5.3 x64 using the following
configure option on 5.2.12

CONFIGURE_COMMAND = './configure'
'--with-apxs2=/usr/local/apache2/bin/apxs'
'--with-mysql=/usr/local/mysql' '--enable-ftp' '--with-gd'
'--with-png-dir=/usr' '--with-freetype-di
r=/usr/local' '--with-mcrypt=/usr/local' '--with-zlib=/usr'
'--with-openssl'

Apache was configured with:

./configure –enable-rewrite=shared –enable-status=shared
–enable-ssl=shared

Please advise


Previous Comments:


[2006-09-24 01:00:01] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.



[2006-09-16 17:28:31] m...@php.net

Uhm right, because the actual name is --enable-versioning.

IIRC that may be cause by some library only available statically whne
you try to link. You need to identify it and either build a shared lib
or build withgout its support enabled.




[2006-09-16 15:36:44] shorb at optonline dot net

Without that, compilation still fails



[2006-09-16 10:52:37] m...@php.net

Please don't ever use --with-versioning.



[2006-09-15 23:12:12] shorb at optonline dot net

Description:

'make install' fails because shared lib (.so is not created)
mod_so is installed on apache

[r...@steve php-5.1.6]# make install
Installing PHP SAPI module:   apache2handler
/opt/httpd/build/instdso.sh SH_LIBTOOL='/opt/httpd/build/libtool'
libphp5.la /opt/httpd/modules /opt/httpd/build/libtool --mode=install cp
libphp5.la /opt/httpd/modules/ cp .libs/libphp5.lai
/opt/httpd/modules/libphp5.la cp .libs/libphp5.a
/opt/httpd/modules/libphp5.a ranlib /opt/httpd/modules/libphp5.a chmod
644 /opt/httpd/modules/libphp5.a
libtool: install: warning: remember to run `libtool --finish
/root/php-5.1.6/libs'
Warning!  dlname not found in /opt/httpd/modules/libphp5.la.
Assuming installing a .so rather than a libtool archive.
chmod 755 /opt/httpd/modules/libphp5.so
chmod: cannot access `/opt/httpd/modules/libphp5.so': No such file or
directory
apxs:Error: Command failed with rc=65536 .
make: *** [install-sapi] Error 1

The compiler log from 'make' shows this:

*** Warning: inter-library dependencies are not known to be supported.
*** All declared inter-library dependencies are being dropped.

*** Warning: libtool could not satisfy all declared inter-library
*** dependencies of module libphp5.  Therefore, libtool will create
*** a static module, that should work as long as the dlopening
*** application is linked with the -dlopen flag.

Reproduce code:
---
./configure --with-apxs2=/opt/httpd/bin/apxs --prefix=/opt/httpd/php5
--sharedstatedir=/opt/httpd/php5/com --enable-discard-path
--disable-force-cgi-redirect --disable-debug --disable-rpath
--enable-inline-optimization --enable-memory-limit
--with-config-file-path=/opt/httpd/php5/etc
--with-peardir=/opt/httpd/php5/share/pear --enable-magic-quotes
--enable-debugger --enable-track-vars --with-exec-dir=/usr/bin
--with-versioning  --with-regex=php --enable-trans-sid
--enable-safe-mode --enable-ctype --enable-ftp --with-gettext=/usr
--enable-posix --enable-session --enable-sysvsem --enable-sysvshm
--enable-yp --with-openssl=/usr --with-kerberos --with-ttf
--with-freetype-dir=/usr --with-zlib --with-mysql=/usr --with-sqlite
--with-gd --with-imap --with-imap-ssl --with-ldap --enable-bcmath
--enable-calendar --with-curl --enable-dba --with-gd --with-gmp
--with-ldap --with-mcal=/usr/local --with-mycrypt --with-mime-magic
--with-ncurses --with-unixODBC --enable-xml --with-jpeg-dir
--with-zlib-dir --with-tiff-dir --with-pspell --with-png-dir=/usr/lib
--with-mysql-sock=/var/lib/mysql --with-dom --with-mcrypt --with-iconv
--enable-mbstring --with-mbstring=all






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



#49444 [Opn-Fbk]: $_GET variable

2009-09-02 Thread jani
 ID:   49444
 Updated by:   j...@php.net
 Reported By:  hafizanil at gmail dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Scripting Engine problem
 Operating System: Windows Xp
 PHP Version:  5.3.0
 New Comment:

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.




Previous Comments:


[2009-09-02 16:07:28] hafizanil at gmail dot com

Description:

Want to sent variable via javascript via $_GET method and the output
going hirewire.The varible sent also been escape
first(javascript).Tested using 5.29 and 5.3
Browser 1.Internet Explorer 7
2 Firefox 3.52
3. Opera 10

Reproduce code:
---
This is  tested 5.29
[code]
$_GET['to']=admin (sit: mr chang n mr sairi n mr pzan)
kamb...@gmail.com,;
echo strlen($_GET['to'])
// out put 63
 var_dump($_GET);
// output only showing admin (sit: mr chang n mr sairi n mr pzan) 
[/code]
This is tested 5.30
[code]
$_GET['to']=admin (sit: mr chang n mr sairi n mr pzan)
kamb...@gmail.com,;
echo strlen($_GET['to'])
// out put 63
 var_dump($_GET);
//output :Page going crazy.show all the php source
[/code]

Expected result:

var_dump or print_r $_GET array should understand the variable which
might contain ;


Actual result:
--
On 5.3 It show all the source php .





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



#49443 [Opn-Bgs]: Special characters in section name breaks parse_ini_file

2009-09-02 Thread jani
 ID:   49443
 Updated by:   j...@php.net
 Reported By:  eric dot caron at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: N/A
 PHP Version:  5.3.0
 New Comment:

The raw option is just for this and it's NOT a workaround but exactly 
the thing you're supposed to use here. No bug here.


Previous Comments:


[2009-09-02 15:52:10] eric dot caron at gmail dot com

Description:

PHP 5.3 changes to parse_ini_*() functions breaks scripts that have
special characters, {}|~![()^, in the section titles. (Previous
versions worked, which I assume was proper behavior because section
titles can have those characters according to community understood INI
standards).

There is no documentation stating that special characters can not be
used in section titles. While the INI_SCANNER_RAW parameter provides an
opening for a workaround for this solution, to be useful, the characters
{}|~![()^ should be usable in section titles (not to be confuse with
keys, where they shouldn't be used).

Reproduce code:
---
?php
$tmpfname = tempnam(/tmp, FOO);
file_put_contents($tmpfname, '[Ask]
Crawler=true

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]
Crawler=true
');

$array = parse_ini_file($tmpfname, true);
print_r($array);
unlink($tmpfname);

Expected result:

Array
(
[Ask] = Array
(
[Crawler] = 1
)

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)] = Array
(
[Crawler] = 1
)

)


Actual result:
--
Warning: parse error, expecting `']'' in FOOFCCA.tmp on line 4 in
parseBug.php on line 10 





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



#49351 [Opn-Fbk]: posix_setuid/posix_seteuid/posix_setgid/posix_setegid crashed apache

2009-09-02 Thread jani
 ID:   49351
 Updated by:   j...@php.net
 Reported By:  VJTD3 at VJTD3 dot com
-Status:   Open
+Status:   Feedback
 Bug Type: POSIX related
 Operating System: Linux
 PHP Version:  5.3.0


Previous Comments:


[2009-09-01 23:07:57] VJTD3 at VJTD3 dot com

the problem still exists, I'm not sure i can use gdb since it's a
problem interfacing with apache. I'll try tonight.



[2009-08-25 06:43:16] j...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

And provide a GDB backtrace if it still crashes.



[2009-08-25 00:02:36] VJTD3 at VJTD3 dot com

Description:

apache Apache/2.2.13:
env CFLAGS=-DBIG_SECURITY_HOLE ./configure --enable-so  make 
make install

php 5.3.0:
./configure --with-apxs2  make  make install

-DBIG_SECURITY_HOLE allows for root startup (administrative builds for
panels and such...) when this flag is used to compile apache, php will
crash when posix_setuid posix_seteuid posix_setgid or posix_setegid are
used to change the user/group.

Reproduce code:
---
?php

 posix_seteuid(1000);
 posix_setegid(1000);
 posix_setuid(1000);
 posix_setgid(1000);

?

(make sure you use a number that has an actual user...)

Expected result:

change to that user.

Actual result:
--
php and apache crash.





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



#49351 [Fbk]: posix_setuid/posix_seteuid/posix_setgid/posix_setegid crashed apache

2009-09-02 Thread jani
 ID:   49351
 Updated by:   j...@php.net
 Reported By:  VJTD3 at VJTD3 dot com
 Status:   Feedback
 Bug Type: POSIX related
 Operating System: Linux
 PHP Version:  5.3.0
 New Comment:

http://bugs.php.net/bugs-generating-backtrace.php


Previous Comments:


[2009-09-01 23:07:57] VJTD3 at VJTD3 dot com

the problem still exists, I'm not sure i can use gdb since it's a
problem interfacing with apache. I'll try tonight.



[2009-08-25 06:43:16] j...@php.net

Please try using this snapshot:

  http://snaps.php.net/php5.3-latest.tar.gz
 
For Windows:

  http://windows.php.net/snapshots/

And provide a GDB backtrace if it still crashes.



[2009-08-25 00:02:36] VJTD3 at VJTD3 dot com

Description:

apache Apache/2.2.13:
env CFLAGS=-DBIG_SECURITY_HOLE ./configure --enable-so  make 
make install

php 5.3.0:
./configure --with-apxs2  make  make install

-DBIG_SECURITY_HOLE allows for root startup (administrative builds for
panels and such...) when this flag is used to compile apache, php will
crash when posix_setuid posix_seteuid posix_setgid or posix_setegid are
used to change the user/group.

Reproduce code:
---
?php

 posix_seteuid(1000);
 posix_setegid(1000);
 posix_setuid(1000);
 posix_setgid(1000);

?

(make sure you use a number that has an actual user...)

Expected result:

change to that user.

Actual result:
--
php and apache crash.





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



#49257 [Opn-Bgs]: stream_socket_enable_crypto() problems outside of child process

2009-09-02 Thread jani
 ID:   49257
 Updated by:   j...@php.net
 Reported By:  jerrywilborn at gmail dot com
-Status:   Open
+Status:   Bogus
 Bug Type: Streams related
 Operating System: CentOS 4.4
 PHP Version:  5.2.10
 New Comment:

Exactly why would it be? You forked and called the crypto enabling, you

didn't enable it for the parent. 


Previous Comments:


[2009-08-14 17:40:28] jerrywilborn at gmail dot com

Description:

Open a tcp connection using stream_socket_client, spawn a child process

with pcntl_fork, encrypt the stream in the child, fetch data from the 
stream.  In the parent wait for the child to finish and then fetch data

out of the stream; it is not decrypted.

Reproduce code:
---
?

$s = stream_socket_client(tcp://smtpout.secureserver.net:465, $errno,
$errstr, 5, STREAM_CLIENT_CONNECT);

if (!pcntl_fork()) {
if (stream_socket_enable_crypto($s, TRUE,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT)) {
print child:  . fgets($s);
}
exit;
}

pcntl_wait($status);
print parent:  . fgets($s) . \n;

?

Expected result:

child: 220 smtpauth18.prod.mesa1.secureserver.net ESMTP
parent: 220 smtpauth18.prod.mesa1.secureserver.net ESMTP

Actual result:
--
child: 220 smtpauth18.prod.mesa1.secureserver.net ESMTP
parent:  ??1)?cV^~?
   ??n?0?s`wh?9






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



#49257 [Bgs]: stream_socket_enable_crypto() problems outside of child process

2009-09-02 Thread jerrywilborn at gmail dot com
 ID:   49257
 User updated by:  jerrywilborn at gmail dot com
 Reported By:  jerrywilborn at gmail dot com
 Status:   Bogus
 Bug Type: Streams related
 Operating System: CentOS 4.4
 PHP Version:  5.2.10
 New Comment:

I assumed the encryption was a feature of the socket and not the 
process. Thanks for the clarification.


Previous Comments:


[2009-09-02 19:20:54] j...@php.net

Exactly why would it be? You forked and called the crypto enabling, you

didn't enable it for the parent. 



[2009-08-14 17:40:28] jerrywilborn at gmail dot com

Description:

Open a tcp connection using stream_socket_client, spawn a child process

with pcntl_fork, encrypt the stream in the child, fetch data from the 
stream.  In the parent wait for the child to finish and then fetch data

out of the stream; it is not decrypted.

Reproduce code:
---
?

$s = stream_socket_client(tcp://smtpout.secureserver.net:465, $errno,
$errstr, 5, STREAM_CLIENT_CONNECT);

if (!pcntl_fork()) {
if (stream_socket_enable_crypto($s, TRUE,
STREAM_CRYPTO_METHOD_SSLv23_CLIENT)) {
print child:  . fgets($s);
}
exit;
}

pcntl_wait($status);
print parent:  . fgets($s) . \n;

?

Expected result:

child: 220 smtpauth18.prod.mesa1.secureserver.net ESMTP
parent: 220 smtpauth18.prod.mesa1.secureserver.net ESMTP

Actual result:
--
child: 220 smtpauth18.prod.mesa1.secureserver.net ESMTP
parent:  ??1)?cV^~?
   ??n?0?s`wh?9






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



#49216 [Opn-Fbk]: Reflection doesn't seem to work properly on MySqli

2009-09-02 Thread jani
 ID:   49216
 Updated by:   j...@php.net
 Reported By:  virgilp at gmail dot com
-Status:   Open
+Status:   Feedback
 Bug Type: Reflection related
 Operating System: Windows XP SP3
 PHP Version:  5.2.10
 New Comment:

host_info and such is only there when you actually have connected 
somewhere. How about you refine your report and try with an actual 
object first?


Previous Comments:


[2009-08-12 07:04:06] virgilp at gmail dot com

I tried 
http://windows.php.net/downloads/snaps/php-5.2-nts-win32-VC6-x86-
latest.zip - I get the same behaviour



[2009-08-11 07:18:28] virgilp at gmail dot com

Description:

There are several things that go wrong with reflection on MySqli. 
1. First and foremost - extracting mysqli::bind_param signature yields

strange results:  public function bind_param($);
And the parameter in question (printed as $) is in fact:
ReflectionParameter::__set_state(array(
   'name' = NULL,
))  /// Null name!!
I believe this is actually related to bug #45578 - but that one has 
been closed as being related to something completely different.

2. another odd thing is that reflection returns final protected class

mysqli_warning  (and a class can't be protected).

3. Several properties seem to be completely missing from reflection - 
e.g. the host_info property of mysqli.

4. Parameters are not shown in member methods - e.g. mysqli::prepare 
is shown to have 0 parameters (when in fact, it receives a string 
parameter).

Reproduce code:
---
$ext = new ReflectionExtension('mysqli');
$class_arr = $ext-getClassNames();
foreach($class_arr as $cls_name){
DumpClass($cls_name);
}
 // I could give the implementation of DumpClass if needed, but it's
straight out of the reflection examples, it prints the modifiers,
class name, extends, implements  properties/methods


Expected result:

MySqli class seen through reflection the same way as it is documented
on 
www.php.net

Actual result:
--
Wrong output from reflection (as listed in description)





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



#49438 [Opn-Bgs]: openssl_sign,why the results are different between 'gbk' and 'utf-8'.

2009-09-02 Thread jani
 ID:   49438
 Updated by:   j...@php.net
 Reported By:  gaoc at guoli dot com
-Status:   Open
+Status:   Bogus
 Bug Type: OpenSSL related
 Operating System: windows
 PHP Version:  5.3.0
 New Comment:

Because the data is different. Not enough info, invalid reproduce code.

Bogus.


Previous Comments:


[2009-09-02 05:56:06] gaoc at guoli dot com

Description:

openssl_sign($data,$sig,$privatekey);
the data is from gkb '°¡' and utf-8 '°¡'!
buy why the results are different between 'gbk' and 'utf-8'.

Reproduce code:
---
---
From manual page: function.openssl-sign
---







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



#46058 [Opn-WFx]: ReflectionMethod::invoke - wrong behavior (PHP_5_2 only)

2009-09-02 Thread jani
 ID:   46058
 Updated by:   j...@php.net
 Reported By:  fel...@php.net
-Status:   Open
+Status:   Wont fix
 Bug Type: Reflection related
 Operating System: *
 PHP Version:  5.2CVS-2009-04-30
 New Comment:

So use 5.3 or HEAD. Not a security bug or critical.


Previous Comments:


[2008-09-11 19:40:09] fel...@php.net

Description:

Currently the behavior is different of 5.3 and HEAD.

Note also: the method name in the warning message.

Reproduce code:
---
?php

$x = new ReflectionMethod('reflectionfunction', 'invoke');
var_dump($x-invokeArgs(new ReflectionFunction('trim'), array(' foobar
')));

Expected result:

string(6) foobar

Actual result:
--
Fatal error: Non-static method ReflectionFunction::trim() cannot be
called statically in %s on line %d





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



#49443 [Bgs]: Special characters in section name breaks parse_ini_file

2009-09-02 Thread eric dot caron at gmail dot com
 ID:   49443
 User updated by:  eric dot caron at gmail dot com
 Reported By:  eric dot caron at gmail dot com
 Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: N/A
 PHP Version:  5.3.0
 New Comment:

The raw option, though, does not convert the string true/false to
its boolean.

If you change the print_r in my demo code to a var_dump:
*** PHP 5.2 RESULTS ***
array(2) {
  [Ask]=
  array(1) {
[Crawler]=
string(1) 1
  }
  [Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]=
  array(1) {
[Crawler]=
string(1) 1
  }
}

*** PHP 5.3 RESULTS ***
array(2) {
  [Ask]=
  array(1) {
[Crawler]=
string(4) true
  }
  [Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]=
  array(1) {
[Crawler]=
string(4) true
  }
}


Previous Comments:


[2009-09-02 19:12:19] j...@php.net

The raw option is just for this and it's NOT a workaround but exactly 
the thing you're supposed to use here. No bug here.



[2009-09-02 15:52:10] eric dot caron at gmail dot com

Description:

PHP 5.3 changes to parse_ini_*() functions breaks scripts that have
special characters, {}|~![()^, in the section titles. (Previous
versions worked, which I assume was proper behavior because section
titles can have those characters according to community understood INI
standards).

There is no documentation stating that special characters can not be
used in section titles. While the INI_SCANNER_RAW parameter provides an
opening for a workaround for this solution, to be useful, the characters
{}|~![()^ should be usable in section titles (not to be confuse with
keys, where they shouldn't be used).

Reproduce code:
---
?php
$tmpfname = tempnam(/tmp, FOO);
file_put_contents($tmpfname, '[Ask]
Crawler=true

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]
Crawler=true
');

$array = parse_ini_file($tmpfname, true);
print_r($array);
unlink($tmpfname);

Expected result:

Array
(
[Ask] = Array
(
[Crawler] = 1
)

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)] = Array
(
[Crawler] = 1
)

)


Actual result:
--
Warning: parse error, expecting `']'' in FOOFCCA.tmp on line 4 in
parseBug.php on line 10 





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



#49443 [Bgs]: Special characters in section name breaks parse_ini_file

2009-09-02 Thread eric dot caron at gmail dot com
 ID:   49443
 User updated by:  eric dot caron at gmail dot com
 Reported By:  eric dot caron at gmail dot com
 Status:   Bogus
 Bug Type: Filesystem function related
 Operating System: N/A
 PHP Version:  5.3.0
 New Comment:

The logic difficulty is better showcased with false values.

*** PHP 5.2 (GOOD) ***
array(2) {
  [Ask]=
  array(1) {
[Crawler]=
string(0) 
  }
  [Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]=
  array(1) {
[Crawler]=
string(1) 1
  }
}


*** PHP 5.3 (BAD) ***
array(2) {
  [Ask]=
  array(1) {
[Crawler]=
string(5) false
  }
  [Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]=
  array(1) {
[Crawler]=
string(4) true
  }
}


Previous Comments:


[2009-09-02 19:49:13] eric dot caron at gmail dot com

The raw option, though, does not convert the string true/false to
its boolean.

If you change the print_r in my demo code to a var_dump:
*** PHP 5.2 RESULTS ***
array(2) {
  [Ask]=
  array(1) {
[Crawler]=
string(1) 1
  }
  [Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]=
  array(1) {
[Crawler]=
string(1) 1
  }
}

*** PHP 5.3 RESULTS ***
array(2) {
  [Ask]=
  array(1) {
[Crawler]=
string(4) true
  }
  [Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]=
  array(1) {
[Crawler]=
string(4) true
  }
}



[2009-09-02 19:12:19] j...@php.net

The raw option is just for this and it's NOT a workaround but exactly 
the thing you're supposed to use here. No bug here.



[2009-09-02 15:52:10] eric dot caron at gmail dot com

Description:

PHP 5.3 changes to parse_ini_*() functions breaks scripts that have
special characters, {}|~![()^, in the section titles. (Previous
versions worked, which I assume was proper behavior because section
titles can have those characters according to community understood INI
standards).

There is no documentation stating that special characters can not be
used in section titles. While the INI_SCANNER_RAW parameter provides an
opening for a workaround for this solution, to be useful, the characters
{}|~![()^ should be usable in section titles (not to be confuse with
keys, where they shouldn't be used).

Reproduce code:
---
?php
$tmpfname = tempnam(/tmp, FOO);
file_put_contents($tmpfname, '[Ask]
Crawler=true

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)]
Crawler=true
');

$array = parse_ini_file($tmpfname, true);
print_r($array);
unlink($tmpfname);

Expected result:

Array
(
[Ask] = Array
(
[Crawler] = 1
)

[Mozilla/?.0 (compatible; Ask Jeeves/Teoma*)] = Array
(
[Crawler] = 1
)

)


Actual result:
--
Warning: parse error, expecting `']'' in FOOFCCA.tmp on line 4 in
parseBug.php on line 10 





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



#48746 [Com]: Unable to browse directories within Junction Points

2009-09-02 Thread phpstuff at cresstone dot com
 ID:   48746
 Comment by:   phpstuff at cresstone dot com
 Reported By:  ddkees at illinois dot edu
 Status:   Feedback
 Bug Type: Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye
 New Comment:

Using Windows 7 x64. It seems all files in my mounted volumes are being
treated as directories. (is_dir returns true, is_file returns false.)
Directory operations pointed at files seem to point back to the root of
the volume.

The following script:
echo dumping: scandir('mounted_volume')\n;
var_dump(scandir('mounted_volume'));
echo dumping: scandir('mounted_volume\\file1')\n;
var_dump(scandir('mounted_volume\file1'));

gives this output:



dumping: scandir('mounted_volume')
array(4) {
  [0]=
  string(12) $RECYCLE.BIN
  [1]=
  string(4) dir1
  [2]=
  string(4) dir2
  [3]=
  string(5) file1
}
dumping: scandir('mounted_volume\file1')
array(4) {
  [0]=
  string(12) $RECYCLE.BIN
  [1]=
  string(4) dir1
  [2]=
  string(4) dir2
  [3]=
  string(5) file1
}

Nesting does not seem to matter, eg:
scandir('mounted_volume\dir1\file_in_dir1'); gives the same output


Something else that's interesting... When I create the junction from a
drive letter, eg: mklink mounted_volume y: everything works perfectly,
files are files and dirs are dirs. It's only when I use the volume name
in the creation (mklink /J mounted_volume
\\?\Volume{feeac7c1-2ad0-11de-89bb-001fd0ae05ac}\) that I get this
strange behavior. Bizarre, but I swear I'm not making this up :)


Previous Comments:


[2009-09-02 10:35:32] paj...@php.net

Can't reproduce here. Which OS are you using for this test?



[2009-09-02 10:30:20] paj...@php.net

Oh my, I'm about to loose my last hair :)

But we are getting close now... back to code



[2009-09-02 10:12:22] phpstuff at cresstone dot com

sorry, found another mounted volume issue:

is_dir reutrns true when passed a file on a mounted volume.
Additionaly, chdir retruns true when passed that file.

eg: is_dir('c:\mounted_volume\image.jpg'); returns true. image.jpg is a
file and mounted_volume is a junction point mounted volume.



[2009-09-02 09:31:36] phpstuff at cresstone dot com

Everything seems to be working as of the latest snapshot, thanks.



[2009-09-01 17:54:20] paj...@php.net

scandir has been fixed (not directly related to this issue) as well as
the mounted points issues. All regressions should be fixed now. Can you
give it a try please? The next snapshot will have the fixes.



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

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



#49445 [NEW]: Segfault on connection close

2009-09-02 Thread jake dot levitt at mailtrust dot com
From: jake dot levitt at mailtrust dot com
Operating system: CentOS 5
PHP version:  5.3.0
PHP Bug Type: IMAP related
Bug description:  Segfault on connection close

Description:

If an IMAP server closes a connection without sending a BYE command, PHP
segfaults on the next IMAP command run on the mailbox resource.  I noticed
this while testing against an exchange server, where I was selecting a
folder that doesn't exist.  After 10 times it disconnected me without
sending a BYE command.  When this happens PHP segfaulted, which doesn't
allow for the script to do any error handling.

Reproduce code:
---
?php
//Try testing against an exchange server that disconnects after a
//certain number of bad commands
$flags = '/novalidate-cert';
$host = 'secure.emailsrvr.com:143';
$username = 'notewort...@sts.com';
$password = 'webmail';
$base_imap_string = '{' . $host . $flags . '}';
$connect_string = $base_imap_string . 'INBOX';
$mailbox = imap_open($connect_string, $username, $password, 0, 3);
$connect_string = $base_imap_string . 'Does not exist';
for ($i = 0; $i  10; $i++) {
$reopen_success = imap_reopen($mailbox, $connect_string, 0, 3);
}

Expected result:

imap_reopen either returns false or throws a PHP error.

Actual result:
--
The script segfaults.

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



#49445 [Opn-Fbk]: Segfault on connection close

2009-09-02 Thread scottmac
 ID:   49445
 Updated by:   scott...@php.net
 Reported By:  jake dot levitt at mailtrust dot com
-Status:   Open
+Status:   Feedback
 Bug Type: IMAP related
 Operating System: CentOS 5
 PHP Version:  5.3.0
 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 for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

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.

Also what version of c-client are you using?


Previous Comments:


[2009-09-02 22:16:09] jake dot levitt at mailtrust dot com

Description:

If an IMAP server closes a connection without sending a BYE command,
PHP segfaults on the next IMAP command run on the mailbox resource.  I
noticed this while testing against an exchange server, where I was
selecting a folder that doesn't exist.  After 10 times it disconnected
me without sending a BYE command.  When this happens PHP segfaulted,
which doesn't allow for the script to do any error handling.

Reproduce code:
---
?php
//Try testing against an exchange server that disconnects after a
//certain number of bad commands
$flags = '/novalidate-cert';
$host = 'secure.emailsrvr.com:143';
$username = 'notewort...@sts.com';
$password = 'webmail';
$base_imap_string = '{' . $host . $flags . '}';
$connect_string = $base_imap_string . 'INBOX';
$mailbox = imap_open($connect_string, $username, $password, 0, 3);
$connect_string = $base_imap_string . 'Does not exist';
for ($i = 0; $i  10; $i++) {
$reopen_success = imap_reopen($mailbox, $connect_string, 0, 3);
}

Expected result:

imap_reopen either returns false or throws a PHP error.

Actual result:
--
The script segfaults.





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



#49446 [NEW]: escapeshellarg dosn`t work on windows

2009-09-02 Thread heromantor at users dot sourceforge dot net
From: heromantor at users dot sourceforge dot net
Operating system: windows xp sp2
PHP version:  5.2.10
PHP Bug Type: CGI related
Bug description:  escapeshellarg dosn`t work on windows

Description:

escapeshellarg function dosn`t work properly on windows platform. Problem
in  \ and % chars handling.

this patch fix this problem
--- exec.c  Wed Sep  2 22:41:27 2009
+++ exec_fixed.cWed Sep  2 22:40:50 2009
@@ -352,6 +352,11 @@
cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j  0  cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
switch (str[x]) {
 #ifdef PHP_WIN32
-   case '':
-   case '%':
-   cmd[y++] = ' ';
-   break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+cmd[y++] = '%';
+cmd[y++] = '';
+break;
+case '':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+/* fall-through */
 #else
case '\'':
cmd[y++] = '\'';
@@ -388,6 +399,9 @@
}
}
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';

and some test cases
P A T H = P A T H
%PATH% = %PATH%
a%PATH%b = a%PATH%b
%%PATH%% = %%PATH%%
PATH = PATH
%PATH% = %PATH%
\P\A\T\H = \P\A\T\H
\P\A\T\H\ = \P\A\T\H\\
\%\%\ = \\%\\%\\
a\\%b\\c%\\ = a%b\\c%
a\ = a\\
a\ = a\\
a\^|^^(^) = a\\^|^^(^)
PATH\%\ = PATH\\%\\


Reproduce code:
---
?php
print_r(escapeshellarg(%PATH%) . PHP_EOL);
print_r(escapeshellarg(c:\\temp\\) . PHP_EOL);
print_r(escapeshellarg('\\') . PHP_EOL);


Expected result:

%PATH%
c:\temp\\
\\


Actual result:
--
 PATH 
c:\temp\
\ 


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



#48746 [Fbk]: Unable to browse directories within Junction Points

2009-09-02 Thread pajoye
 ID:   48746
 Updated by:   paj...@php.net
 Reported By:  ddkees at illinois dot edu
 Status:   Feedback
 Bug Type: Directory function related
 Operating System: win32 only - Windows Server 2003
 PHP Version:  5.3.0
 Assigned To:  pajoye
 New Comment:

I can't reproduce the problem with is_dir or is_file behave correctly,
however I think I found the problem and commited a fix.

I can reproduce the scandir one, same fix. I manually launched a build,
you can get the vc9-x86 here: http://is.gd/2OtDf (other snaps should be
online within 15mins).




Previous Comments:


[2009-09-02 22:59:59] s...@php.net

Automatic comment from SVN on behalf of pajoye
Revision: http://svn.php.net/viewvc/?view=revisionrevision=287975
Log: - #48746, len includes null already



[2009-09-02 21:29:08] phpstuff at cresstone dot com

Using Windows 7 x64. It seems all files in my mounted volumes are being
treated as directories. (is_dir returns true, is_file returns false.)
Directory operations pointed at files seem to point back to the root of
the volume.

The following script:
echo dumping: scandir('mounted_volume')\n;
var_dump(scandir('mounted_volume'));
echo dumping: scandir('mounted_volume\\file1')\n;
var_dump(scandir('mounted_volume\file1'));

gives this output:



dumping: scandir('mounted_volume')
array(4) {
  [0]=
  string(12) $RECYCLE.BIN
  [1]=
  string(4) dir1
  [2]=
  string(4) dir2
  [3]=
  string(5) file1
}
dumping: scandir('mounted_volume\file1')
array(4) {
  [0]=
  string(12) $RECYCLE.BIN
  [1]=
  string(4) dir1
  [2]=
  string(4) dir2
  [3]=
  string(5) file1
}

Nesting does not seem to matter, eg:
scandir('mounted_volume\dir1\file_in_dir1'); gives the same output


Something else that's interesting... When I create the junction from a
drive letter, eg: mklink mounted_volume y: everything works perfectly,
files are files and dirs are dirs. It's only when I use the volume name
in the creation (mklink /J mounted_volume
\\?\Volume{feeac7c1-2ad0-11de-89bb-001fd0ae05ac}\) that I get this
strange behavior. Bizarre, but I swear I'm not making this up :)



[2009-09-02 10:35:32] paj...@php.net

Can't reproduce here. Which OS are you using for this test?



[2009-09-02 10:30:20] paj...@php.net

Oh my, I'm about to loose my last hair :)

But we are getting close now... back to code



[2009-09-02 10:12:22] phpstuff at cresstone dot com

sorry, found another mounted volume issue:

is_dir reutrns true when passed a file on a mounted volume.
Additionaly, chdir retruns true when passed that file.

eg: is_dir('c:\mounted_volume\image.jpg'); returns true. image.jpg is a
file and mounted_volume is a junction point mounted volume.



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

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



#49446 [Opn]: escapeshellarg dosn`t work on windows

2009-09-02 Thread heromantor at users dot sourceforge dot net
 ID:   49446
 User updated by:  heromantor at users dot sourceforge dot net
 Reported By:  heromantor at users dot sourceforge dot net
 Status:   Open
 Bug Type: CGI related
 Operating System: windows xp sp2
 PHP Version:  5.2.10
 New Comment:

oh sorry, i post invalid patch.

this ok:
--- exec.c  Wed Sep  2 23:44:19 2009
+++ exec_fixed.cWed Sep  2 23:44:41 2009
@@ -343,7 +343,7 @@
  */
 PHPAPI char *php_escape_shell_arg(char *str)
 {
-int x, y = 0, l = strlen(str);
+int x, y = 0, j, l = strlen(str);
 char *cmd;
 size_t estimate = (4 * l) + 3;
 
@@ -352,6 +352,11 @@
 cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j  0  cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
 cmd[y++] = '';
 #else
 cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
 switch (str[x]) {
 #ifdef PHP_WIN32
-case '':
-case '%':
-cmd[y++] = ' ';
-break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+cmd[y++] = '%';
+cmd[y++] = '';
+break;
+case '':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+/* fall-through */
 #else
 case '\'':
 cmd[y++] = '\'';
@@ -388,6 +399,9 @@
 }
 }
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
 cmd[y++] = '';
 #else
 cmd[y++] = '\'';


Previous Comments:


[2009-09-02 23:10:52] heromantor at users dot sourceforge dot net

Description:

escapeshellarg function dosn`t work properly on windows platform.
Problem in  \ and % chars handling.

this patch fix this problem
--- exec.c  Wed Sep  2 22:41:27 2009
+++ exec_fixed.cWed Sep  2 22:40:50 2009
@@ -352,6 +352,11 @@
cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j  0  cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
switch (str[x]) {
 #ifdef PHP_WIN32
-   case '':
-   case '%':
-   cmd[y++] = ' ';
-   break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+cmd[y++] = '%';
+cmd[y++] = '';
+break;
+case '':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+/* fall-through */
 #else
case '\'':
cmd[y++] = '\'';
@@ -388,6 +399,9 @@
}
}
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';

and some test cases
P A T H = P A T H
%PATH% = %PATH%
a%PATH%b = a%PATH%b
%%PATH%% = %%PATH%%
PATH = PATH
%PATH% = %PATH%
\P\A\T\H = \P\A\T\H
\P\A\T\H\ = \P\A\T\H\\
\%\%\ = \\%\\%\\
a\\%b\\c%\\ = a%b\\c%
a\ = a\\
a\ = a\\
a\^|^^(^) = a\\^|^^(^)
PATH\%\ = PATH\\%\\


Reproduce code:
---
?php
print_r(escapeshellarg(%PATH%) . PHP_EOL);
print_r(escapeshellarg(c:\\temp\\) . PHP_EOL);
print_r(escapeshellarg('\\') . PHP_EOL);


Expected result:

%PATH%
c:\temp\\
\\


Actual result:
--
 PATH 
c:\temp\
\ 






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



#49444 [Fbk-Opn]: $_GET variable

2009-09-02 Thread hafizanil at gmail dot com
 ID:   49444
 User updated by:  hafizanil at gmail dot com
 Reported By:  hafizanil at gmail dot com
-Status:   Feedback
+Status:   Open
 Bug Type: Scripting Engine problem
 Operating System: Windows Xp
 PHP Version:  5.3.0
 New Comment:

Javascript (Page 1)
script language=javascript
 function sentMail() {
   var url;
   var to;
   url   = 'ml_compose_com.php?';
   document.form.title.value='admin (sit: mr chang n mr sairi n mr
pzan)
kamb...@gmail.com,';
   title = escape(document.form.title.value);
   if(title){ url= url+'title='+ title; }
   location = url+sent_mail=1;
  }
/script

Page 2 (ml_compose_com.php)
?php 
echo pre.print_r($_GET)./pre;
var_dump($_GET);
?


Previous Comments:


[2009-09-02 19:11:27] j...@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 ?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.





[2009-09-02 16:07:28] hafizanil at gmail dot com

Description:

Want to sent variable via javascript via $_GET method and the output
going hirewire.The varible sent also been escape
first(javascript).Tested using 5.29 and 5.3
Browser 1.Internet Explorer 7
2 Firefox 3.52
3. Opera 10

Reproduce code:
---
This is  tested 5.29
[code]
$_GET['to']=admin (sit: mr chang n mr sairi n mr pzan)
kamb...@gmail.com,;
echo strlen($_GET['to'])
// out put 63
 var_dump($_GET);
// output only showing admin (sit: mr chang n mr sairi n mr pzan) 
[/code]
This is tested 5.30
[code]
$_GET['to']=admin (sit: mr chang n mr sairi n mr pzan)
kamb...@gmail.com,;
echo strlen($_GET['to'])
// out put 63
 var_dump($_GET);
//output :Page going crazy.show all the php source
[/code]

Expected result:

var_dump or print_r $_GET array should understand the variable which
might contain ;


Actual result:
--
On 5.3 It show all the source php .





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



#49447 [NEW]: php engine need to correctly check for socket API return status on windows

2009-09-02 Thread sriram dot natarajan at gmail dot com
From: sriram dot natarajan at gmail dot com
Operating system: windows xp
PHP version:  5.3.0
PHP Bug Type: Sockets related
Bug description:  php engine need to correctly check for socket API return 
status on windows

Description:

Unlike bsd sockets, Win32 Socket API does not return -1 on failure for
most of the common socket api calls like bind, accept, connect etc. in
fact, the error status is another integer with numbers like 10035 etc. 
so, checking for returns status on these socket API's like -1 or = 0 is
wrong. 

i noticed this issue while debugging another problem on windows. hence,
filing this bug to track this issue . checking for correct error status on
these API is important during trouble shooting scenarios.


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



#49447 [Opn-Asn]: php engine need to correctly check for socket API return status on windows

2009-09-02 Thread srinatar
 ID:   49447
 Updated by:   srina...@php.net
 Reported By:  sriram dot natarajan at gmail dot com
-Status:   Open
+Status:   Assigned
 Bug Type: Sockets related
 Operating System: windows xp
 PHP Version:  5.3.0
-Assigned To:  
+Assigned To:  srinatar


Previous Comments:


[2009-09-03 01:36:03] sriram dot natarajan at gmail dot com

Description:

Unlike bsd sockets, Win32 Socket API does not return -1 on failure for
most of the common socket api calls like bind, accept, connect etc. in
fact, the error status is another integer with numbers like 10035 etc. 
so, checking for returns status on these socket API's like -1 or = 0
is wrong. 

i noticed this issue while debugging another problem on windows. hence,
filing this bug to track this issue . checking for correct error status
on these API is important during trouble shooting scenarios.






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



#49447 [Asn-Ana]: php engine need to correctly check for socket API return status on windows

2009-09-02 Thread srinatar
 ID:   49447
 Updated by:   srina...@php.net
 Reported By:  sriram dot natarajan at gmail dot com
-Status:   Assigned
+Status:   Analyzed
 Bug Type: Sockets related
 Operating System: windows xp
 PHP Version:  5.3.0
 Assigned To:  srinatar
 New Comment:

here is the patch to address this issue. 

Index: ext/openssl/xp_ssl.c
===
--- ext/openssl/xp_ssl.c(revision 287975)
+++ ext/openssl/xp_ssl.c(working copy)
@@ -259,6 +259,10 @@
SSL_CTX_free(sslsock-ctx);
sslsock-ctx = NULL;
}
+#ifdef PHP_WIN32
+   if (sslsock-s.socket == -1)
+   sslsock-s.socket = SOCK_ERR;
+#endif
if (sslsock-s.socket != SOCK_ERR) {
 #ifdef PHP_WIN32
/* prevent more data from coming in */
Index: ext/ftp/ftp.c
===
--- ext/ftp/ftp.c   (revision 287975)
+++ ext/ftp/ftp.c   (working copy)
@@ -147,7 +147,7 @@
 
size = sizeof(ftp-localaddr);
memset(ftp-localaddr, 0, size);
-   if (getsockname(ftp-fd, (struct sockaddr*) ftp-localaddr, size)
== -1) {
+   if (getsockname(ftp-fd, (struct sockaddr*) ftp-localaddr, size)
!= 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, getsockname 
failed: %s
(%d), strerror(errno), errno);
goto bail;
}
@@ -1387,7 +1387,7 @@
 
sa = (struct sockaddr *) ftp-localaddr;
/* bind/listen */
-   if ((fd = socket(sa-sa_family, SOCK_STREAM, 0)) == -1) {
+   if ((fd = socket(sa-sa_family, SOCK_STREAM, 0)) == SOCK_ERR) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, socket() failed: %s
(%d), strerror(errno), errno);
goto bail;
}
@@ -1420,17 +1420,17 @@
php_any_addr(sa-sa_family, addr, 0);
size = php_sockaddr_size(addr);
 
-   if (bind(fd, (struct sockaddr*) addr, size) == -1) {
+   if (bind(fd, (struct sockaddr*) addr, size) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, bind() failed: %s
(%d), strerror(errno), errno);
goto bail;
}
 
-   if (getsockname(fd, (struct sockaddr*) addr, size) == -1) {
+   if (getsockname(fd, (struct sockaddr*) addr, size) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, getsockname() 
failed:
%s (%d), strerror(errno), errno);
goto bail;
}
 
-   if (listen(fd, 5) == -1) {
+   if (listen(fd, 5) != 0) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, listen() failed: %s
(%d), strerror(errno), errno);
goto bail;
}
Index: ext/sockets/sockets.c
===
--- ext/sockets/sockets.c   (revision 287975)
+++ ext/sockets/sockets.c   (working copy)
@@ -370,14 +370,14 @@
 
sock-type = PF_INET;
 
-   if (bind(sock-bsd_socket, (struct sockaddr *)la, sizeof(la))  0)
{
+   if (bind(sock-bsd_socket, (struct sockaddr *)la, sizeof(la)) != 0)
{
PHP_SOCKET_ERROR(sock, unable to bind to given address, 
errno);
close(sock-bsd_socket);
efree(sock);
return 0;
}
 
-   if (listen(sock-bsd_socket, backlog)  0) {
+   if (listen(sock-bsd_socket, backlog) != 0) {
PHP_SOCKET_ERROR(sock, unable to listen on socket, errno);
close(sock-bsd_socket);
efree(sock);
Index: main/network.c
===
--- main/network.c  (revision 287975)
+++ main/network.c  (working copy)
@@ -314,7 +314,7 @@
 
SET_SOCKET_BLOCKING_MODE(sockfd, orig_flags);

-   if ((n = connect(sockfd, addr, addrlen))  0) {
+   if ((n = connect(sockfd, addr, addrlen)) != 0) {
error = php_socket_errno();
 
if (error_code) {
@@ -348,7 +348,7 @@
   BSD-derived systems set errno correctly
   Solaris returns -1 from getsockopt in case of error
   */
-   if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char*)error, 
len) 
0) {
+   if (getsockopt(sockfd, SOL_SOCKET, SO_ERROR, (char*)error, 
len) !=
0) {
ret = -1;
}
} else {
@@ -375,7 +375,7 @@
if (asynchronous) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, Asynchronous 
connect()
not supported on this platform);
}
-   return connect(sockfd, addr, addrlen);
+   return (connect(sockfd, addr, addrlen) == 0) ? 0 : -1;
 #endif
 }
 /* }}} */
@@ -715,7 +715,7 @@
 
clisock = accept(srvsock, (struct sockaddr*)sa, sl);
 
-   if (clisock = 0) {
+   if (clisock != SOCK_ERR) {

#49421 [Opn]: Make failure with MySQL 6 and PHP 6.0-dev

2009-09-02 Thread gabrycucciolo84pv at fastwebnet dot it
 ID:   49421
 User updated by:  gabrycucciolo84pv at fastwebnet dot it
 Reported By:  gabrycucciolo84pv at fastwebnet dot it
 Status:   Open
 Bug Type: Compile Failure
 Operating System: Centos 4.8
 PHP Version:  6SVN-2009-08-31 (snap)
 New Comment:

After long work and time spent to read many documents and bugs, i found
that solution indicated here: http://bugs.php.net/bug.php?id=42890
solves the problem and makes php compile succesfully.

(I had some problems with running phpBB e phpMyAdmin but I assume those
problems are because php6.0-dev is in Alpha and code is not written for
that version, and I think it has nothing to do with the fix indicated in
the Bug Above).


Previous Comments:


[2009-09-01 05:39:02] sveta at mysql dot com

MySQL is http://bugs.mysql.com/bug.php?id=47026



[2009-09-01 00:40:33] gabrycucciolo84pv at fastwebnet dot it

We CAN assume that the problem happens only with PHP6 (php5.3 compiles
and
makes succesfully) but what I don't know is the linking type.

I mean:

I don't know if php5.3-dev and php6.0-dev link against mysql in the
same way. (i.e. I
don't know if php5.3-dev and php6.0-dev include the same file(s) and in
the same way (same
functions or so). That said, I can't tell weather the bug is php, mysql
or compiler
related.

On thing is certain: gcc HAS been upgraded in the meantime. That lead
me to try to
recompile php 5.3-dev (fresh sources) to see if the bug was still
present and at the end
it wasn't. php5.3-dev compiles succesfully.

In the past, php6.0-dev compiled succesfully too so I'm not able to
understand what is
wrong where, I only suppose that the problem might origin from a
combination of factors,
such as compiler upgraded, mysql version and php version.
I also tried to remove from php the --with-mysql line and leave the
--with-mysqli=/usr/bin/mysql_config and in this case php compiles
succesfully, so the
problem resides inside mysql.h include or misunderstanding between
compiler, php and mysql
headers.

UPDATE:

More informations:
Recently I upgraded my box from CentOS 4.7 to CentOS 4.8 (20 august).
Issues with php
mysql and the compiler begun after this upgrade.

More News:
I tried to install on my box gcc4-* from CentOS repository. The error
list shortened to
this:

/bin/sh /root/php6.0-200908312230/libtool --silent --preserve-dup-deps
--mode=compile
/root/php6.0-200908312230/meta_ccld  -Imain/
-I/root/php6.0-200908312230/main/
-DPHP_ATOM_INC -I/root/php6.0-200908312230/include
-I/root/php6.0-200908312230/main
-I/root/php6.0-200908312230 -I/usr/local/include
-I/root/php6.0-200908312230/ext/date/lib
-I/root/php6.0-200908312230/ext/ereg/regex -I/usr/include/libxml2
-I/usr/include/imap
-I/root/php6.0-200908312230/ext/mbstring/oniguruma
-I/root/php6.0-200908312230/ext/mbstring/libmbfl
-I/root/php6.0-200908312230/ext/mbstring/libmbfl/mbfl
-I/usr/include/mysql
-I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/public
-I/usr/lib/oracle/xe/app/oracle/product/10.2.0/server/rdbms/demo
-I/root/php6.0-200908312230/ext/sqlite3/libsqlite
-I/root/php6.0-200908312230/TSRM
-I/root/php6.0-200908312230/Zend  -D_REENTRANT -DTHREAD=1 
-I/usr/include -g -O2 -pthread
-DZTS  -prefer-non-pic -c main/internal_functions.c -o
main/internal_functions.lo 
In file included from /usr/include/mysql/mysql.h:74,
 from
/root/php6.0-200908312230/ext/mysql/php_mysql_structs.h:43,
 from main/internal_functions.c:58:
/usr/include/mysql/my_list.h:26: error: expected identifier or '('
before numeric
constant
/usr/include/mysql/my_list.h:30: error: expected identifier or '('
before numeric
constant
/usr/include/mysql/my_list.h:31: error: expected identifier or '('
before numeric
constant
/usr/include/mysql/my_list.h:32: error: expected identifier or '('
before numeric
constant
/usr/include/mysql/my_list.h:33: error: expected identifier or '('
before numeric
constant
/usr/include/mysql/my_list.h:34: error: expected declaration specifiers
or '...' before
numeric constant
/usr/include/mysql/my_list.h:35: error: expected declaration specifiers
or '...' before
numeric constant
/usr/include/mysql/my_list.h:36: error: expected declaration specifiers
or '...' before
numeric constant
In file included from
/root/php6.0-200908312230/ext/mysql/php_mysql_structs.h:43,
 from main/internal_functions.c:58:
/usr/include/mysql/mysql.h:266: error: expected
specifier-qualifier-list before numeric
constant
/usr/include/mysql/mysql.h:574: error: expected
specifier-qualifier-list before numeric
constant
make: *** [main/internal_functions.lo] Error 1

So i think we can now assume that the main responsible for this
behaviour is the compiler update of CentOS 4.8 and some PHP6/MYSQL6
interactions with it.
The worse is now to understand what is going on...

Still trying but no luck

I am now 

#49446 [Opn]: escapeshellarg dosn`t work on windows

2009-09-02 Thread scottmac
 ID:   49446
 Updated by:   scott...@php.net
 Reported By:  heromantor at users dot sourceforge dot net
 Status:   Open
 Bug Type: CGI related
 Operating System: windows xp sp2
 PHP Version:  5.2.10
 New Comment:

This was fixed in 5.3 with bug #43261

Though \\ within double quotes is considered a single \


Previous Comments:


[2009-09-02 23:51:40] heromantor at users dot sourceforge dot net

oh sorry, i post invalid patch.

this ok:
--- exec.c  Wed Sep  2 23:44:19 2009
+++ exec_fixed.cWed Sep  2 23:44:41 2009
@@ -343,7 +343,7 @@
  */
 PHPAPI char *php_escape_shell_arg(char *str)
 {
-int x, y = 0, l = strlen(str);
+int x, y = 0, j, l = strlen(str);
 char *cmd;
 size_t estimate = (4 * l) + 3;
 
@@ -352,6 +352,11 @@
 cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j  0  cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
 cmd[y++] = '';
 #else
 cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
 switch (str[x]) {
 #ifdef PHP_WIN32
-case '':
-case '%':
-cmd[y++] = ' ';
-break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+cmd[y++] = '%';
+cmd[y++] = '';
+break;
+case '':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+/* fall-through */
 #else
 case '\'':
 cmd[y++] = '\'';
@@ -388,6 +399,9 @@
 }
 }
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
 cmd[y++] = '';
 #else
 cmd[y++] = '\'';



[2009-09-02 23:10:52] heromantor at users dot sourceforge dot net

Description:

escapeshellarg function dosn`t work properly on windows platform.
Problem in  \ and % chars handling.

this patch fix this problem
--- exec.c  Wed Sep  2 22:41:27 2009
+++ exec_fixed.cWed Sep  2 22:40:50 2009
@@ -352,6 +352,11 @@
cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j  0  cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
switch (str[x]) {
 #ifdef PHP_WIN32
-   case '':
-   case '%':
-   cmd[y++] = ' ';
-   break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+cmd[y++] = '%';
+cmd[y++] = '';
+break;
+case '':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+/* fall-through */
 #else
case '\'':
cmd[y++] = '\'';
@@ -388,6 +399,9 @@
}
}
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';

and some test cases
P A T H = P A T H
%PATH% = %PATH%
a%PATH%b = a%PATH%b
%%PATH%% = %%PATH%%
PATH = PATH
%PATH% = %PATH%
\P\A\T\H = \P\A\T\H
\P\A\T\H\ = \P\A\T\H\\
\%\%\ = \\%\\%\\
a\\%b\\c%\\ = a%b\\c%
a\ = a\\
a\ = a\\
a\^|^^(^) = a\\^|^^(^)
PATH\%\ = PATH\\%\\


Reproduce code:
---
?php
print_r(escapeshellarg(%PATH%) . PHP_EOL);
print_r(escapeshellarg(c:\\temp\\) . PHP_EOL);
print_r(escapeshellarg('\\') . PHP_EOL);


Expected result:

%PATH%
c:\temp\\
\\


Actual result:
--
 PATH 
c:\temp\
\ 






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



#49446 [Opn-Fbk]: escapeshellarg dosn`t work on windows

2009-09-02 Thread scottmac
 ID:   49446
 Updated by:   scott...@php.net
 Reported By:  heromantor at users dot sourceforge dot net
-Status:   Open
+Status:   Feedback
 Bug Type: CGI related
 Operating System: windows xp sp2
 PHP Version:  5.2.10


Previous Comments:


[2009-09-03 04:16:48] scott...@php.net

This was fixed in 5.3 with bug #43261

Though \\ within double quotes is considered a single \



[2009-09-02 23:51:40] heromantor at users dot sourceforge dot net

oh sorry, i post invalid patch.

this ok:
--- exec.c  Wed Sep  2 23:44:19 2009
+++ exec_fixed.cWed Sep  2 23:44:41 2009
@@ -343,7 +343,7 @@
  */
 PHPAPI char *php_escape_shell_arg(char *str)
 {
-int x, y = 0, l = strlen(str);
+int x, y = 0, j, l = strlen(str);
 char *cmd;
 size_t estimate = (4 * l) + 3;
 
@@ -352,6 +352,11 @@
 cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j  0  cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
 cmd[y++] = '';
 #else
 cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
 switch (str[x]) {
 #ifdef PHP_WIN32
-case '':
-case '%':
-cmd[y++] = ' ';
-break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+cmd[y++] = '%';
+cmd[y++] = '';
+break;
+case '':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+/* fall-through */
 #else
 case '\'':
 cmd[y++] = '\'';
@@ -388,6 +399,9 @@
 }
 }
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
 cmd[y++] = '';
 #else
 cmd[y++] = '\'';



[2009-09-02 23:10:52] heromantor at users dot sourceforge dot net

Description:

escapeshellarg function dosn`t work properly on windows platform.
Problem in  \ and % chars handling.

this patch fix this problem
--- exec.c  Wed Sep  2 22:41:27 2009
+++ exec_fixed.cWed Sep  2 22:40:50 2009
@@ -352,6 +352,11 @@
cmd = safe_emalloc(4, l, 3); /* worst case */
 
 #ifdef PHP_WIN32
+#   define PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES() \
+for(j = y - 1; j  0  cmd[j] == '\\'; --j) { \
+cmd[y++] = '\\'; \
+}
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';
@@ -372,10 +377,16 @@
 
switch (str[x]) {
 #ifdef PHP_WIN32
-   case '':
-   case '%':
-   cmd[y++] = ' ';
-   break;
+case '%':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+cmd[y++] = '%';
+cmd[y++] = '';
+break;
+case '':
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+cmd[y++] = '';
+/* fall-through */
 #else
case '\'':
cmd[y++] = '\'';
@@ -388,6 +399,9 @@
}
}
 #ifdef PHP_WIN32
+PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES()
+#   undef PHP_ESCAPE_SHELL_ARG_PROCESS_TRAILING_SLASHES
+
cmd[y++] = '';
 #else
cmd[y++] = '\'';

and some test cases
P A T H = P A T H
%PATH% = %PATH%
a%PATH%b = a%PATH%b
%%PATH%% = %%PATH%%
PATH = PATH
%PATH% = %PATH%
\P\A\T\H = \P\A\T\H
\P\A\T\H\ = \P\A\T\H\\
\%\%\ = \\%\\%\\
a\\%b\\c%\\ = a%b\\c%
a\ = a\\
a\ = a\\
a\^|^^(^) = a\\^|^^(^)
PATH\%\ = PATH\\%\\


Reproduce code:
---
?php
print_r(escapeshellarg(%PATH%) . PHP_EOL);
print_r(escapeshellarg(c:\\temp\\) . PHP_EOL);
print_r(escapeshellarg('\\') . PHP_EOL);


Expected result:

%PATH%
c:\temp\\
\\


Actual result:
--
 PATH 
c:\temp\
\ 






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