[PHP-BUG] Req #64664 [NEW]: Reinitialize fetchAll

2013-04-17 Thread vtap at clubinternet dot fr
From: vtap at clubinternet dot fr
Operating system: Windows 7
PHP version:  5.4.14
Package:  PDO related
Bug Type: Feature/Change Request
Bug description:Reinitialize fetchAll

Description:

$sql = "SELECT f1, f2 FROM test;";
$res = $pdo->query($sql);

$f1= $res->fetchAll(PDO::FETCH_COLUMN,0);
$f2= $res->fetchAll(PDO::FETCH_COLUMN,1);

$f1 is OK but $f2 is an empty array. Is there a way to reinitialize the
cursor ?
I know I can rerun the query but wanted to know if it could be avoided.
Thanks.


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



Bug #64650 [Opn->Nab]: parse_ini_file parse ini file

2013-04-17 Thread ab
Edit report at https://bugs.php.net/bug.php?id=64650&edit=1

 ID: 64650
 Updated by: a...@php.net
 Reported by:eduosi at 163 dot com
 Summary:parse_ini_file parse ini file
-Status: Open
+Status: Not a bug
 Type:   Bug
 Package:Unknown/Other Function
 PHP Version:5.3Git-2013-04-15 (Git)
 Block user comment: N
 Private report: N

 New Comment:

 and it's clearly documented here http://de2.php.net/parse_ini_file

[quote]
Note: 

If a value in the ini file contains any non-alphanumeric characters it needs to 
be enclosed in double-quotes ("). 
[/quote]


Previous Comments:

[2013-04-15 17:10:08] pierr...@php.net

The current ini_parser implementations with INI_SCANNER_RAW only works with 
double 
quotes as string delimiter.


[2013-04-15 09:52:22] eduosi at 163 dot com

Description:

Dear,

php version 5.3.0 or greater 5.3.0,

parse_ini_file() loads in the ini file specified in file, if param 
$scanner_mode equal 'INI_SCANNER_RAW' and option value contain ';', this value 
will be truncated.

Test script:
---
== ini file ==
simple.ini

[db]
connectionString='mysql:dbname=db;host=127.0.0.1'
username='root'
passwrd=''

== php script ==


  array(3) {
["connectionString"]=>
string(17) "'mysql:dbname=db"
["username"]=>
string(6) "'root'"
["password"]=>
string(2) "''"
  }
}

== I expect results ==

array(1) {
  ["db"]=>
  array(3) {
["connectionString"]=>
string(17) "'mysql:dbname=db;host=127.0.0.1'"
["username"]=>
string(6) "'root'"
["password"]=>
string(2) "''"
  }
}








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


Req #64661 [Wfx]: Enabling .NET Framework Support Module

2013-04-17 Thread pajoye
Edit report at https://bugs.php.net/bug.php?id=64661&edit=1

 ID: 64661
 Updated by: paj...@php.net
 Reported by:vdeepakkumar at msn dot com
 Summary:Enabling .NET Framework Support Module
 Status: Wont fix
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   Windows
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Also, as per having, developing or using Modules (as in php extensions) 
implemented in .net, it is already possible. See 

https://github.com/pierrejoye/php_ajaxmin
https://github.com/pierrejoye/php_mschart

for examples.

However, as Rasmus said, having to maintain a totally different engine, windows 
specific with its lots of compatibility issues is not something that will 
happen 
any time soon.


Previous Comments:

[2013-04-18 05:24:56] ras...@php.net

Sorry, we do not have the resources to take this on.


[2013-04-17 19:16:18] vdeepakkumar at msn dot com

Description:

I came across an opensource module called Phalanger hosted from 
http://phalanger.codeplex.com/, which seems to be compiling PHP scripts to MSIL 
so 
that .NET framework applications can use the same. Precisely, PHP serves as one 
of 
the .NET framework languages. 

However, this seems to be maintained as a separate branch. I am wondering if 
this 
could be maintained by PHP Team and managed as a IL module (configurable from 
PHP.INI just like CGI, ISAPI modes. 

Test script:
---
I came across an opensource module called Phalanger hosted from 
http://phalanger.codeplex.com/, which seems to be compiling PHP scripts to MSIL 
so that .NET framework applications can use the same. Precisely, PHP serves as 
one of the .NET framework languages. 

However, this seems to be maintained as a separate branch. I am wondering if 
this could be maintained by PHP Team and managed as a IL module (configurable 
from PHP.INI just like CGI, ISAPI modes. 

Expected result:

IL output is one of the modes like CGI, ISAPI.

Actual result:
--
None currently






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


Bug #64654 [Opn]: socket_select returns false and socket_last_error returns 0 (success)

2013-04-17 Thread laruence
Edit report at https://bugs.php.net/bug.php?id=64654&edit=1

 ID: 64654
 Updated by: larue...@php.net
 Reported by:xilon dot jul at gmail dot com
 Summary:socket_select returns false and socket_last_error
 returns 0 (success)
 Status: Open
 Type:   Bug
 Package:Sockets related
 Operating System:   Linux 3.5.0-23-generic
 PHP Version:5.4.14
 Block user comment: N
 Private report: N

 New Comment:

hmm, I agree with you about give more info to php side.

but what do we define this error ? E_BADF?

simple fix is:

$ git diff
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index f305fa0..5f5b8c2 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -783,7 +783,14 @@ static int php_sock_array_to_fd_set(zval *sock_array, 
fd_set 
*fds, PHP_SOCKET *m
num++;
}

-   return num ? 1 : 0;
+   if (num) {
+   return 1;
+   } else {
+#ifdef EBADF
+   SOCKETS_G(last_error) = EBADF;
+#endif
+   return 0;
+   }
 }
 /* }}} */


Previous Comments:

[2013-04-17 16:00:50] xilon dot jul at gmail dot com

Thanx laruence for your answer. I also "straced" the sample to check if the 
real 
sys call was invoked and indeed it is not. Php does some processing before 
giving the hand to the select sys call (checking valid fd, raising a warning as 
you mentionned).

However to give more control on Php side, I think a return code different from 
0 
must be returned. Even if it's not a "bug", my opinion is that there is a  
misconception here about raising a warning and having a success return code and 
that thinking that all that should be fined enough for PHP developpers.


[2013-04-17 13:59:47] larue...@php.net

I don't think this is a bug.

the warning is threw before do really "select", it is an error in php side. not 
system call side.

and socket_last_error is for the error in system call side.


[2013-04-17 09:52:28] xilon dot jul at gmail dot com

Description:

When a socket ressource previously watched for read I/O in socket_select is 
closed, the socket_select function would return false and throw a warning 
saying 
"Not a valid socket ressource".

The fact is that subsequent call to socket_last_error() returns 0 which 
translates 
to success using socket_strerror().


Test script:
---
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if (false === socket_bind($socket, '0.0.0.0', )) {
die('bind()');
}
$read[] = $socket;
// voluntarily close the socket
socket_close($socket);
// Will throw a warning and return false
$retval = socket_select($read, $w = null, $e = null, 1);
echo socket_last_error(); // returns 0


Expected result:

As the C select system call, closing the socket should return a valid system 
error 
code.

The C counterpart of this PHP sample above gives :

select(): Bad file descriptor (9 => EBADF)



Actual result:
--
The result of socket_last_error is 0.






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


Req #64661 [Opn->Wfx]: Enabling .NET Framework Support Module

2013-04-17 Thread rasmus
Edit report at https://bugs.php.net/bug.php?id=64661&edit=1

 ID: 64661
 Updated by: ras...@php.net
 Reported by:vdeepakkumar at msn dot com
 Summary:Enabling .NET Framework Support Module
-Status: Open
+Status: Wont fix
 Type:   Feature/Change Request
 Package:*General Issues
 Operating System:   Windows
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

Sorry, we do not have the resources to take this on.


Previous Comments:

[2013-04-17 19:16:18] vdeepakkumar at msn dot com

Description:

I came across an opensource module called Phalanger hosted from 
http://phalanger.codeplex.com/, which seems to be compiling PHP scripts to MSIL 
so 
that .NET framework applications can use the same. Precisely, PHP serves as one 
of 
the .NET framework languages. 

However, this seems to be maintained as a separate branch. I am wondering if 
this 
could be maintained by PHP Team and managed as a IL module (configurable from 
PHP.INI just like CGI, ISAPI modes. 

Test script:
---
I came across an opensource module called Phalanger hosted from 
http://phalanger.codeplex.com/, which seems to be compiling PHP scripts to MSIL 
so that .NET framework applications can use the same. Precisely, PHP serves as 
one of the .NET framework languages. 

However, this seems to be maintained as a separate branch. I am wondering if 
this could be maintained by PHP Team and managed as a IL module (configurable 
from PHP.INI just like CGI, ISAPI modes. 

Expected result:

IL output is one of the modes like CGI, ISAPI.

Actual result:
--
None currently






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


Req #64639 [PATCH]: Add third parameter to nl2br

2013-04-17 Thread krak...@php.net
Edit report at https://bugs.php.net/bug.php?id=64639&edit=1

 ID: 64639
 Patch added by: krak...@php.net
 Reported by:valentiny510 at yahoo dot es
 Summary:Add third parameter to nl2br
 Status: Open
 Type:   Feature/Change Request
 Package:*General Issues
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

The following patch has been added/updated:

Patch Name: nl2br_additional_parameter
Revision:   1366227875
URL:
https://bugs.php.net/patch-display.php?bug=64639&patch=nl2br_additional_parameter&revision=1366227875


Previous Comments:

[2013-04-12 02:12:27] valentiny510 at yahoo dot es

Description:

The name "nl2br" for somebody who doesn't know php very well, suggest that 
actually replace "nl" with "br" but is not true. The name of the function 
function should be "nl2nl+br"

I think it should have a third parameter like $replace, and actually Replace 
the nl with br

I have some clients who used this function inside pre with horrible result.
Anyway, I think it will be more usefull this

nl2br ($string, true/false, $replace = true/false)

than

preg_replace('#([\r?\n]+)#', '', $string) or
str_replace(array("\r\n", "\r", "\n"), '', $string)








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


[PHP-BUG] Req #64661 [NEW]: Enabling .NET Framework Support Module

2013-04-17 Thread vdeepakkumar at msn dot com
From: vdeepakkumar at msn dot com
Operating system: Windows
PHP version:  Irrelevant
Package:  *General Issues
Bug Type: Feature/Change Request
Bug description:Enabling .NET Framework Support Module

Description:

I came across an opensource module called Phalanger hosted from 
http://phalanger.codeplex.com/, which seems to be compiling PHP scripts to
MSIL so 
that .NET framework applications can use the same. Precisely, PHP serves as
one of 
the .NET framework languages. 

However, this seems to be maintained as a separate branch. I am wondering
if this 
could be maintained by PHP Team and managed as a IL module (configurable
from 
PHP.INI just like CGI, ISAPI modes. 

Test script:
---
I came across an opensource module called Phalanger hosted from
http://phalanger.codeplex.com/, which seems to be compiling PHP scripts to
MSIL so that .NET framework applications can use the same. Precisely, PHP
serves as one of the .NET framework languages. 

However, this seems to be maintained as a separate branch. I am wondering
if this could be maintained by PHP Team and managed as a IL module
(configurable from PHP.INI just like CGI, ISAPI modes. 

Expected result:

IL output is one of the modes like CGI, ISAPI.

Actual result:
--
None currently

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



Bug #64659 [Nab]: Encode Error: accented chars returns empty string

2013-04-17 Thread luis dot pessoa67 at ibest dot com dot br
Edit report at https://bugs.php.net/bug.php?id=64659&edit=1

 ID: 64659
 User updated by:luis dot pessoa67 at ibest dot com dot br
 Reported by:luis dot pessoa67 at ibest dot com dot br
 Summary:Encode Error: accented chars returns empty string
 Status: Not a bug
 Type:   Bug
 Package:Strings related
 Operating System:   Windows 7 SP1
 PHP Version:5.4.14
 Block user comment: N
 Private report: N

 New Comment:

Tks for the answer, Ramus.

By the way the Brazilian Portuguese documentation are not updated. This is the 
reason for this ticket.

I saw there a lot of issues to updated related to html encoding.

Regards, Luis


Previous Comments:

[2013-04-17 16:54:27] ras...@php.net

The documentation clearly states:

5.4.0The default value for the encoding parameter was changed to UTF-8.


[2013-04-17 15:59:58] luis dot pessoa67 at ibest dot com dot br

I saw php 5.4.14 this bugs should be corrected (Fixed bug #64011).


[2013-04-17 15:54:36] luis dot pessoa67 at ibest dot com dot br

Environment Information:

System  Windows NT LUIS 6.1 build 7601 (Windows 7 Business Edition Service Pack 
1) i586
Build Date  Apr 10 2013 21:15:43
CompilerMSVC9 (Visual C++ 2008)
Architecturex86
Configure Command   cscript /nologo configure.js "--enable-snapshot-build" 
"--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" 
"--without-mssql" "--without-pdo-mssql" "--without-pi3web" 
"--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" 
"--with-enchant=shared" "--enable-object-out-dir=../obj/" 
"--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" 
"--with-pgo"
Server API  CGI/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   C:\Windows
Loaded Configuration File   C:\php\php.ini 

-
my php.ini charset defs:

; PHP's built-in default is text/html
default_mimetype = "text/html"
default_charset = "iso-8859-1"


[2013-04-17 15:44:58] luis dot pessoa67 at ibest dot com dot br

Description:

1) First script
php -r "print(htmlentities('ú', ENT_COMPAT, 'ISO-8859-1'));"

results: ú
expected: ú
[OK]

2) Second script
php -r "print(htmlentities('ú'));"
results: 
expected: ú
[Error]

3) According documentation
quote_style: ENT_COMPAT (default)
charset: ISO-8859-1 (default)



---
>From manual page: 
>http://www.php.net/function.htmlentities#refsect1-function.htmlentities-returnvalues
---


Test script:
---
php -r "print(htmlentities('ú'));"

Expected result:

ú

Actual result:
--
string with lenght=0






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


Bug #64659 [Opn->Nab]: Encode Error: accented chars returns empty string

2013-04-17 Thread rasmus
Edit report at https://bugs.php.net/bug.php?id=64659&edit=1

 ID: 64659
 Updated by: ras...@php.net
 Reported by:luis dot pessoa67 at ibest dot com dot br
 Summary:Encode Error: accented chars returns empty string
-Status: Open
+Status: Not a bug
 Type:   Bug
 Package:Strings related
 Operating System:   Windows 7 SP1
 PHP Version:5.4.14
 Block user comment: N
 Private report: N

 New Comment:

The documentation clearly states:

5.4.0The default value for the encoding parameter was changed to UTF-8.


Previous Comments:

[2013-04-17 15:59:58] luis dot pessoa67 at ibest dot com dot br

I saw php 5.4.14 this bugs should be corrected (Fixed bug #64011).


[2013-04-17 15:54:36] luis dot pessoa67 at ibest dot com dot br

Environment Information:

System  Windows NT LUIS 6.1 build 7601 (Windows 7 Business Edition Service Pack 
1) i586
Build Date  Apr 10 2013 21:15:43
CompilerMSVC9 (Visual C++ 2008)
Architecturex86
Configure Command   cscript /nologo configure.js "--enable-snapshot-build" 
"--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" 
"--without-mssql" "--without-pdo-mssql" "--without-pi3web" 
"--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" 
"--with-enchant=shared" "--enable-object-out-dir=../obj/" 
"--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" 
"--with-pgo"
Server API  CGI/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   C:\Windows
Loaded Configuration File   C:\php\php.ini 

-
my php.ini charset defs:

; PHP's built-in default is text/html
default_mimetype = "text/html"
default_charset = "iso-8859-1"


[2013-04-17 15:44:58] luis dot pessoa67 at ibest dot com dot br

Description:

1) First script
php -r "print(htmlentities('ú', ENT_COMPAT, 'ISO-8859-1'));"

results: ú
expected: ú
[OK]

2) Second script
php -r "print(htmlentities('ú'));"
results: 
expected: ú
[Error]

3) According documentation
quote_style: ENT_COMPAT (default)
charset: ISO-8859-1 (default)



---
>From manual page: 
>http://www.php.net/function.htmlentities#refsect1-function.htmlentities-returnvalues
---


Test script:
---
php -r "print(htmlentities('ú'));"

Expected result:

ú

Actual result:
--
string with lenght=0






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


Bug #44841 [Com]: --disable-rpath breaks GD library

2013-04-17 Thread jose dot nobile at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=44841&edit=1

 ID: 44841
 Comment by: jose dot nobile at gmail dot com
 Reported by:alex at alexjudd dot com
 Summary:--disable-rpath breaks GD library
 Status: Not a bug
 Type:   Bug
 Package:Compile Failure
 Operating System:   Centos 4
 PHP Version:5.2.5
 Block user comment: N
 Private report: N

 New Comment:

http://php.net/manual/en/configure.about.php

--disable-rpath
Disable passing additional runtime library search paths.


Previous Comments:

[2008-04-26 19:16:18] j...@php.net

If you don't know what a configure option does and is used for DO NOT USE IT. 
No bug here.


[2008-04-26 16:47:05] alex at alexjudd dot com

Description:

When compiling with both

--disable rpath

and

--with gd
--with t1lib

the compilation fails

Expected result:

Successful compilation

Actual result:
--
Fails with the following error


hecking for GD support... yes
checking for the location of libjpeg... yes
checking for the location of libpng... yes
checking for the location of libXpm... no
checking for FreeType 1.x support... no
checking for FreeType 2... /usr
checking for T1lib support... yes
checking whether to enable truetype string function in GD... no
checking whether to enable JIS-mapped Japanese font support in GD... no
checking for fabsf... (cached) yes
checking for floorf... (cached) yes
checking for jpeg_read_header in -ljpeg... (cached) yes
checking for png_write_image in -lpng... (cached) yes
If configure fails try --with-xpm-dir=
checking for FT_New_Face in -lfreetype... (cached) yes
checking for T1_StrError in -lt1... (cached) yes
configure: error: GD build test failed. Please check the config.log for details.

and config.log says

configure:37012: checking for T1_StrError in -lt1
configure:43279: gcc -o conftest -g -O2   -L/usr/kerberos/lib -L/usr/local/lib 
conftest.c-lt1 -lfreetype -lpng -lz -ljpeg -lssl -lcrypto -lcurl -lz -lssl 
-lcrypto -lresolv -lm -ldl -lnsl  -lxml2 -lz -lm -lcurl -lgssapi_krb5 -lkrb5 
-lk5crypto -lcom_err -lresolv -ldl -lidn -lssl -lcrypto -lz -lxml2 -lz -lm 1>&5
configure: failed program was:
#line 43268 "configure"
#include "confdefs.h"

char foobar () {}
char foobar();
int main() {
  foobar();
  return 0;
}


Removing --with rpath fixes the compilation






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


Bug #64654 [Com]: socket_select returns false and socket_last_error returns 0 (success)

2013-04-17 Thread xilon dot jul at gmail dot com
Edit report at https://bugs.php.net/bug.php?id=64654&edit=1

 ID: 64654
 Comment by: xilon dot jul at gmail dot com
 Reported by:xilon dot jul at gmail dot com
 Summary:socket_select returns false and socket_last_error
 returns 0 (success)
 Status: Open
 Type:   Bug
 Package:Sockets related
 Operating System:   Linux 3.5.0-23-generic
 PHP Version:5.4.14
 Block user comment: N
 Private report: N

 New Comment:

Thanx laruence for your answer. I also "straced" the sample to check if the 
real 
sys call was invoked and indeed it is not. Php does some processing before 
giving the hand to the select sys call (checking valid fd, raising a warning as 
you mentionned).

However to give more control on Php side, I think a return code different from 
0 
must be returned. Even if it's not a "bug", my opinion is that there is a  
misconception here about raising a warning and having a success return code and 
that thinking that all that should be fined enough for PHP developpers.


Previous Comments:

[2013-04-17 13:59:47] larue...@php.net

I don't think this is a bug.

the warning is threw before do really "select", it is an error in php side. not 
system call side.

and socket_last_error is for the error in system call side.


[2013-04-17 09:52:28] xilon dot jul at gmail dot com

Description:

When a socket ressource previously watched for read I/O in socket_select is 
closed, the socket_select function would return false and throw a warning 
saying 
"Not a valid socket ressource".

The fact is that subsequent call to socket_last_error() returns 0 which 
translates 
to success using socket_strerror().


Test script:
---
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if (false === socket_bind($socket, '0.0.0.0', )) {
die('bind()');
}
$read[] = $socket;
// voluntarily close the socket
socket_close($socket);
// Will throw a warning and return false
$retval = socket_select($read, $w = null, $e = null, 1);
echo socket_last_error(); // returns 0


Expected result:

As the C select system call, closing the socket should return a valid system 
error 
code.

The C counterpart of this PHP sample above gives :

select(): Bad file descriptor (9 => EBADF)



Actual result:
--
The result of socket_last_error is 0.






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


Bug #64659 [Opn]: Encode Error: accented chars returns empty string

2013-04-17 Thread luis dot pessoa67 at ibest dot com dot br
Edit report at https://bugs.php.net/bug.php?id=64659&edit=1

 ID: 64659
 User updated by:luis dot pessoa67 at ibest dot com dot br
 Reported by:luis dot pessoa67 at ibest dot com dot br
-Summary:Encoder Error: accented chars returns empty
+Summary:Encode Error: accented chars returns empty string
 Status: Open
 Type:   Bug
 Package:Strings related
 Operating System:   Windows 7 SP1
 PHP Version:5.4.14
 Block user comment: N
 Private report: N

 New Comment:

I saw php 5.4.14 this bugs should be corrected (Fixed bug #64011).


Previous Comments:

[2013-04-17 15:54:36] luis dot pessoa67 at ibest dot com dot br

Environment Information:

System  Windows NT LUIS 6.1 build 7601 (Windows 7 Business Edition Service Pack 
1) i586
Build Date  Apr 10 2013 21:15:43
CompilerMSVC9 (Visual C++ 2008)
Architecturex86
Configure Command   cscript /nologo configure.js "--enable-snapshot-build" 
"--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" 
"--without-mssql" "--without-pdo-mssql" "--without-pi3web" 
"--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" 
"--with-enchant=shared" "--enable-object-out-dir=../obj/" 
"--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" 
"--with-pgo"
Server API  CGI/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   C:\Windows
Loaded Configuration File   C:\php\php.ini 

-
my php.ini charset defs:

; PHP's built-in default is text/html
default_mimetype = "text/html"
default_charset = "iso-8859-1"


[2013-04-17 15:44:58] luis dot pessoa67 at ibest dot com dot br

Description:

1) First script
php -r "print(htmlentities('ú', ENT_COMPAT, 'ISO-8859-1'));"

results: ú
expected: ú
[OK]

2) Second script
php -r "print(htmlentities('ú'));"
results: 
expected: ú
[Error]

3) According documentation
quote_style: ENT_COMPAT (default)
charset: ISO-8859-1 (default)



---
>From manual page: 
>http://www.php.net/function.htmlentities#refsect1-function.htmlentities-returnvalues
---


Test script:
---
php -r "print(htmlentities('ú'));"

Expected result:

ú

Actual result:
--
string with lenght=0






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


Bug #64659 [Opn]: Encoder Error: accented chars returns empty

2013-04-17 Thread luis dot pessoa67 at ibest dot com dot br
Edit report at https://bugs.php.net/bug.php?id=64659&edit=1

 ID: 64659
 User updated by:luis dot pessoa67 at ibest dot com dot br
 Reported by:luis dot pessoa67 at ibest dot com dot br
 Summary:Encoder Error: accented chars returns empty
 Status: Open
 Type:   Bug
 Package:Strings related
 Operating System:   Windows 7 SP1
 PHP Version:5.4.14
 Block user comment: N
 Private report: N

 New Comment:

Environment Information:

System  Windows NT LUIS 6.1 build 7601 (Windows 7 Business Edition Service Pack 
1) i586
Build Date  Apr 10 2013 21:15:43
CompilerMSVC9 (Visual C++ 2008)
Architecturex86
Configure Command   cscript /nologo configure.js "--enable-snapshot-build" 
"--enable-debug-pack" "--disable-zts" "--disable-isapi" "--disable-nsapi" 
"--without-mssql" "--without-pdo-mssql" "--without-pi3web" 
"--with-pdo-oci=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8=C:\php-sdk\oracle\instantclient10\sdk,shared" 
"--with-oci8-11g=C:\php-sdk\oracle\instantclient11\sdk,shared" 
"--with-enchant=shared" "--enable-object-out-dir=../obj/" 
"--enable-com-dotnet=shared" "--with-mcrypt=static" "--disable-static-analyze" 
"--with-pgo"
Server API  CGI/FastCGI
Virtual Directory Support   disabled
Configuration File (php.ini) Path   C:\Windows
Loaded Configuration File   C:\php\php.ini 

-
my php.ini charset defs:

; PHP's built-in default is text/html
default_mimetype = "text/html"
default_charset = "iso-8859-1"


Previous Comments:

[2013-04-17 15:44:58] luis dot pessoa67 at ibest dot com dot br

Description:

1) First script
php -r "print(htmlentities('ú', ENT_COMPAT, 'ISO-8859-1'));"

results: ú
expected: ú
[OK]

2) Second script
php -r "print(htmlentities('ú'));"
results: 
expected: ú
[Error]

3) According documentation
quote_style: ENT_COMPAT (default)
charset: ISO-8859-1 (default)



---
>From manual page: 
>http://www.php.net/function.htmlentities#refsect1-function.htmlentities-returnvalues
---


Test script:
---
php -r "print(htmlentities('ú'));"

Expected result:

ú

Actual result:
--
string with lenght=0






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


Bug #64658 [Opn->Nab]: BOOLEAN TO VARIABLE RETURN ILOGICAL VALUE

2013-04-17 Thread johannes
Edit report at https://bugs.php.net/bug.php?id=64658&edit=1

 ID: 64658
 Updated by: johan...@php.net
 Reported by:mrsnikivan at gmail dot com
 Summary:BOOLEAN TO VARIABLE RETURN ILOGICAL VALUE
-Status: Open
+Status: Not a bug
 Type:   Bug
 Package:*General Issues
 Operating System:   WINDOW XP
 PHP Version:Irrelevant
 Block user comment: N
 Private report: N

 New Comment:

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

See operator precedence - http://php.net/operators.precedence AND comes after =

This allows code like
   $conn = mysql_connect() or die("Error");


Previous Comments:

[2013-04-17 15:33:21] mrsnikivan at gmail dot com

Description:

I AM USING XAMPP PHP, using assing 

$A= 1==1 AND 2==2; RETURN TRUE

$A= 1==1 AND 2==7; RETURN ILOGICAL, RETURN TRUE (TRUNCATE IN AND)

$A= (1==1 AND 2==7);   RETURN FALSE 

$A= 1==2 AND 2==2; RETURN FALSE



Test script:
---




Expected result:

No truncate assign into instruction "and"  







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


[PHP-BUG] Bug #64659 [NEW]: Encoder Error: accented chars returns empty

2013-04-17 Thread luis dot pessoa67 at ibest dot com dot br
From: luis dot pessoa67 at ibest dot com dot br
Operating system: Windows 7 SP1
PHP version:  5.4.14
Package:  Strings related
Bug Type: Bug
Bug description:Encoder Error: accented chars returns empty

Description:

1) First script
php -r "print(htmlentities('ú', ENT_COMPAT, 'ISO-8859-1'));"

results: ú
expected: ú
[OK]

2) Second script
php -r "print(htmlentities('ú'));"
results: 
expected: ú
[Error]

3) According documentation
quote_style: ENT_COMPAT (default)
charset: ISO-8859-1 (default)



---
>From manual page:
http://www.php.net/function.htmlentities#refsect1-function.htmlentities-returnvalues
---


Test script:
---
php -r "print(htmlentities('ú'));"

Expected result:

ú

Actual result:
--
string with lenght=0

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



[PHP-BUG] Bug #64658 [NEW]: BOOLEAN TO VARIABLE RETURN ILOGICAL VALUE

2013-04-17 Thread mrsnikivan at gmail dot com
From: mrsnikivan at gmail dot com
Operating system: WINDOW XP
PHP version:  Irrelevant
Package:  *General Issues
Bug Type: Bug
Bug description:BOOLEAN TO VARIABLE RETURN ILOGICAL VALUE

Description:

I AM USING XAMPP PHP, using assing 

$A= 1==1 AND 2==2; RETURN TRUE

$A= 1==1 AND 2==7; RETURN ILOGICAL, RETURN TRUE (TRUNCATE IN AND)

$A= (1==1 AND 2==7);   RETURN FALSE 

$A= 1==2 AND 2==2; RETURN FALSE



Test script:
---




Expected result:

No truncate assign into instruction "and"  


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



Bug #64655 [Opn->Fbk]: array_diff_uassoc bug.

2013-04-17 Thread laruence
Edit report at https://bugs.php.net/bug.php?id=64655&edit=1

 ID: 64655
 Updated by: larue...@php.net
 Reported by:jeoe12 at gmail dot com
 Summary:array_diff_uassoc bug.
-Status: Open
+Status: Feedback
 Type:   Bug
 Package:PHP options/info functions
 Operating System:   Ubuntu
 PHP Version:5.3Git-2013-04-17 (snap)
 Block user comment: N
 Private report: N

 New Comment:

actually, I can not understand what the bug you are talking about.

could you please give us a simple test script, and also the expect result


Previous Comments:

[2013-04-17 09:57:21] jeoe12 at gmail dot com

Description:

array_diff_uassoc bug..

this function is diff args[0] to args[n-1]   
* args[n] == "user function" 



if (args[0].value == args[n-1].value) 
   ==> run to "user function" 

but..

PHP Version 5.3.5-1ubuntu7.7 

not run...






Test script:
---
function key_compare_func($key1, $key2)
{
echo $key1. " ". $key2 . "";

if ($key1 == $key2)
return 0;
else if ($key1 > $key2)
return 1;
else
return -1;
}

$array1 = array('1-1' => 1, '1-2' => 2, '1-3' => 3, '1-4' => 4);
$array2 = array('2-1' => 5, '2-2' => 6, '2-3' => 7, '2-4' => 8);

var_dump(array_diff_uassoc2($array1, $array2, 'key_compare_func'));


Expected result:

function php_compat_array_diff_uassoc()

{

$args = func_get_args();
if (count($args) < 3) {
user_error('Wrong parameter count for array_diff_uassoc()', 
E_USER_WARNING);
return;
}
$compare_func = array_pop($args);
if (!is_callable($compare_func)) {
if (is_array($compare_func)) {
$compare_func = $compare_func[0] . '::' . $compare_func[1];
}
user_error('array_diff_uassoc() Not a valid callback ' .


$compare_func, E_USER_WARNING);

return;

}

$array_count = count($args);
for ($i = 0; $i !== $array_count; $i++) {
if (!is_array($args[$i])) {
user_error('array_diff_uassoc() Argument #' .
($i + 1) . ' is not an array', E_USER_WARNING);
return;
}
}
$result = array();
foreach ($args[0] as $k => $v) {
for ($i = 1; $i < $array_count; $i++) {
foreach ($args[$i] as $kk => $vv) {
if ($v == $vv) {
$compare = call_user_func_array($compare_func, array($k, 
$kk));
if ($compare == 0) {
continue 3;
}
}
}

}

$result[$k] = $v;
}
return $result;
}







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


Bug #64654 [Opn]: socket_select returns false and socket_last_error returns 0 (success)

2013-04-17 Thread laruence
Edit report at https://bugs.php.net/bug.php?id=64654&edit=1

 ID: 64654
 Updated by: larue...@php.net
 Reported by:xilon dot jul at gmail dot com
 Summary:socket_select returns false and socket_last_error
 returns 0 (success)
 Status: Open
 Type:   Bug
 Package:Sockets related
 Operating System:   Linux 3.5.0-23-generic
 PHP Version:5.4.14
 Block user comment: N
 Private report: N

 New Comment:

I don't think this is a bug.

the warning is threw before do really "select", it is an error in php side. not 
system call side.

and socket_last_error is for the error in system call side.


Previous Comments:

[2013-04-17 09:52:28] xilon dot jul at gmail dot com

Description:

When a socket ressource previously watched for read I/O in socket_select is 
closed, the socket_select function would return false and throw a warning 
saying 
"Not a valid socket ressource".

The fact is that subsequent call to socket_last_error() returns 0 which 
translates 
to success using socket_strerror().


Test script:
---
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if (false === socket_bind($socket, '0.0.0.0', )) {
die('bind()');
}
$read[] = $socket;
// voluntarily close the socket
socket_close($socket);
// Will throw a warning and return false
$retval = socket_select($read, $w = null, $e = null, 1);
echo socket_last_error(); // returns 0


Expected result:

As the C select system call, closing the socket should return a valid system 
error 
code.

The C counterpart of this PHP sample above gives :

select(): Bad file descriptor (9 => EBADF)



Actual result:
--
The result of socket_last_error is 0.






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


Bug #11058 [Com]: php_network_getaddresses: getaddrinfo failed

2013-04-17 Thread frolow at mail dot ru
Edit report at https://bugs.php.net/bug.php?id=11058&edit=1

 ID: 11058
 Comment by: frolow at mail dot ru
 Reported by:pat at mail dot rit dot edu
 Summary:php_network_getaddresses: getaddrinfo failed
 Status: Not a bug
 Type:   Bug
 Package:Network related
 Operating System:   OpenBSD 2.6
 PHP Version:4.0.6
 Block user comment: N
 Private report: N

 New Comment:

rb - descriptor
By HelpSet.ru


Previous Comments:

[2012-06-08 13:12:26] jono at foodnotblogs dot com

Confirmed this is a problem in my Php 5.3.13 install. With the following line:

file_get_contents("www.google.com");

If I run it in the command line, it works fine. If I run it through apache I 
get the getaddrinfo failed error.

I am using Arch Linux, Kernel 3.3.7. My temporary work around is to do a full 
stop and start of Apache. Restarting the service does not solve the problem.


[2011-10-11 11:59:08] fakefur at gmail dot com

i am having this same problem with PHP 5.3.8 on Arch Linux ... for me it is 
manifesting in the IMAP_OPEN function

the call works if i use an IP Address (but the certificate files so it is not a 
solution for me)

it also works if i do the call from the PHP CLI module (ie, not running in 
apache)

for now i have had to add an entry in my hosts file but obviously this is not a 
good long term solution


[2011-01-10 15:29:29] zlisiecki at gmail dot com

I have the same problem on SuSE, apache with php 5.3.3. I am calling fsockopen 
with 
tls://smtp.gmail.com, 465 and for me it seems php possibly considers tls as 
wrong
characters in this place and the resolver cannot resolv the address. Adding a
proper line with an IP of smtp.gmail.com to /etc/hosts appeared to be a 
provisoric
solution.


[2011-01-06 13:44:51] bostjan at a2o dot si

I was experiencing the same problem because the $host variable had some 
additional spaces at the end. Check with var_dump() and remove invalid 
characters if any are found.

b.


[2010-07-19 12:58:13] office at hermannseib dot com

My solution:
Check whether PHP may read /etc/resolv.conf.
First, do a

  ls -la /etc/resolv.conf

and if it says something like this

-rw-r- 1 root root   /etc/resolv.conf

(i.e, NOT readable to anyone but root and the members of group root, which 
normally means a highly elitist bunch :-), 
then issue the following command as root:

  chmod a+r /etc/resolv.conf

This cured the pesky "getaddrinfo failed" for me.




The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

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


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


[PHP-BUG] Bug #64655 [NEW]: array_diff_uassoc bug.

2013-04-17 Thread jeoe12 at gmail dot com
From: jeoe12 at gmail dot com
Operating system: Ubuntu
PHP version:  5.3Git-2013-04-17 (snap)
Package:  PHP options/info functions
Bug Type: Bug
Bug description:array_diff_uassoc bug.

Description:

array_diff_uassoc bug..

this function is diff args[0] to args[n-1]   
* args[n] == "user function" 



if (args[0].value == args[n-1].value) 
   ==> run to "user function" 

but..

PHP Version 5.3.5-1ubuntu7.7 

not run...






Test script:
---
function key_compare_func($key1, $key2)
{
echo $key1. " ". $key2 . "";

if ($key1 == $key2)
return 0;
else if ($key1 > $key2)
return 1;
else
return -1;
}

$array1 = array('1-1' => 1, '1-2' => 2, '1-3' => 3, '1-4' => 4);
$array2 = array('2-1' => 5, '2-2' => 6, '2-3' => 7, '2-4' => 8);

var_dump(array_diff_uassoc2($array1, $array2, 'key_compare_func'));


Expected result:

function php_compat_array_diff_uassoc()

{

$args = func_get_args();
if (count($args) < 3) {
user_error('Wrong parameter count for array_diff_uassoc()',
E_USER_WARNING);
return;
}
$compare_func = array_pop($args);
if (!is_callable($compare_func)) {
if (is_array($compare_func)) {
$compare_func = $compare_func[0] . '::' . $compare_func[1];
}
user_error('array_diff_uassoc() Not a valid callback ' .


$compare_func, E_USER_WARNING);

return;

}

$array_count = count($args);
for ($i = 0; $i !== $array_count; $i++) {
if (!is_array($args[$i])) {
user_error('array_diff_uassoc() Argument #' .
($i + 1) . ' is not an array', E_USER_WARNING);
return;
}
}
$result = array();
foreach ($args[0] as $k => $v) {
for ($i = 1; $i < $array_count; $i++) {
foreach ($args[$i] as $kk => $vv) {
if ($v == $vv) {
$compare = call_user_func_array($compare_func,
array($k, $kk));
if ($compare == 0) {
continue 3;
}
}
}

}

$result[$k] = $v;
}
return $result;
}


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



[PHP-BUG] Bug #64654 [NEW]: socket_select returns false and socket_last_error returns 0 (success)

2013-04-17 Thread xilon dot jul at gmail dot com
From: xilon dot jul at gmail dot com
Operating system: Linux 3.5.0-23-generic
PHP version:  5.4.14
Package:  Sockets related
Bug Type: Bug
Bug description:socket_select returns false and socket_last_error returns 0 
(success)

Description:

When a socket ressource previously watched for read I/O in socket_select is

closed, the socket_select function would return false and throw a warning
saying 
"Not a valid socket ressource".

The fact is that subsequent call to socket_last_error() returns 0 which
translates 
to success using socket_strerror().


Test script:
---
$socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
if (false === socket_bind($socket, '0.0.0.0', )) {
die('bind()');
}
$read[] = $socket;
// voluntarily close the socket
socket_close($socket);
// Will throw a warning and return false
$retval = socket_select($read, $w = null, $e = null, 1);
echo socket_last_error(); // returns 0


Expected result:

As the C select system call, closing the socket should return a valid
system error 
code.

The C counterpart of this PHP sample above gives :

select(): Bad file descriptor (9 => EBADF)



Actual result:
--
The result of socket_last_error is 0.

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