#48672 [NEW]: ORA-12705 when using NLS_LANG

2009-06-24 Thread dima at dimych dot sumy dot ua
From: dima at dimych dot sumy dot ua
Operating system: FreeBSD 6.4
PHP version:  5.2.10
PHP Bug Type: OCI8 related
Bug description:  ORA-12705 when using NLS_LANG

Description:

I`m trying to connect from my FreeBSD box using oracle8 client (from
freebsd-ports) to Oracle 8.1.7 server.
oci_new_connect fails when setting NLS_LANG environment variable. Without
setting NLS_LANG connection successful. Perl script with same parameters
successfully connects.



Reproduce code:
---
PHP script:
?php
putenv('ORACLE_HOME=/usr/local/oracle8-client');

//putenv('NLS_LANG=RUSSIAN_CIS.CL8KOI8R');
putenv('NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1');

$dbh = oci_new_connect('user', 'pass', 'DBNAME');

var_dump($dbh);
var_dump(OCIError());

?

Perl script:

#!/usr/bin/perl
use DBI;

BEGIN {
$ENV{ORACLE_HOME} = '/usr/local/oracle8-client';
#$ENV{NLS_LANG} = 'RUSSIAN_CIS.CL8KOI8R';
$ENV{NLS_LANG} = 'AMERICAN_AMERICA.WE8ISO8859P1';
}

$dbh = DBI-connect(dbi:Oracle:DBNAME, user, 'pass', {AutoCommit = 1,
PrintWarn = 1, PrintError = 1})
or die $DBI::errstr;

print $dbh;
print \n;


Expected result:

successful connection:
bool(true)

Actual result:
--
PHP result:
bool(false)
array(4) {
  [code]=
  int(12705)
  [message]=
  string(59) ORA-12705: invalid or unknown NLS parameter value
specified
  [offset]=
  int(0)
  [sqltext]=
  string(0) 
}
end
Segmentation fault: 11 (core dumped)

Perl result:
DBI::db=HASH(0x8224024)


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



#47641 [Com]: mysql_connect() using TCP with connect_timeout not equal to -1

2009-06-02 Thread dima at dimych dot sumy dot ua
 ID:   47641
 Comment by:   dima at dimych dot sumy dot ua
 Reported By:  dima at dimych dot sumy dot ua
 Status:   Feedback
 Bug Type: MySQL related
 Operating System: FreeBSD 7.1
 PHP Version:  5.2.9
 New Comment:

ttyp3[r...@noc-12:35:15]/home/dima# php -n -d mysql.connect_timeout=60
-r 'mysql_connect(127.0.0.1, test, );'

Fatal error: Call to undefined function mysql_connect() in Command line
code on line 1

ttyp3[r...@noc-12:35:19]/home/dima# php -d mysql.connect_timeout=60 -r
'mysql_connect(127.0.0.1, test, );'
PHP Warning:  mysql_connect(): Can't connect to MySQL server on
'127.0.0.1' (0) in Command line code on line 1

ttyp3[r...@noc-12:36:17]/home/dima# php -d mysql.connect_timeout=60 -r
'mysql_connect(localhost, test, );'
PHP Warning:  mysql_connect(): Access denied for user
'test'@'localhost' (using password: NO) in Command line code on li
ne 1

ttyp3[r...@noc-12:37:05]/home/dima# mysql -V
mysql  Ver 14.14 Distrib 5.1.32, for portbld-freebsd7.1 (i386) using 
5.2


Previous Comments:


[2009-06-02 08:34:17] j...@php.net

Exactly what mysql version are you trying this with? As for me it works

perfectly fine with PHP compiled with Mysql 5.0.37 client lib.

Tried with:

# php -n -d mysql.connect_timeout=60 -r 'mysql_connect(127.0.0.1, 
test, );'




[2009-03-13 10:49:11] dima at dimych dot sumy dot ua

I`m investigated this bug using mysql client trace file.
For additional debug info I modified mysql client library file 
sql-common/client.c. Modifications done in functions mysql_options,
my_connect, wait_for_data. This is diff for source of modified functions
(need for understanding new trace data):
--- client.c2008-11-14 18:37:28.0 +0200
+++ client.c.new2009-03-13 12:36:36.0 +0200
@@ -143,7 +143,14 @@
 int my_connect(my_socket fd, const struct sockaddr *name, uint
namelen,
   uint timeout)
 {
+  DBUG_ENTER(my_connect);
+  DBUG_PRINT(enter, (socket: %d
name:{%d,%d,[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d]} namelen: %lu
timeout: %lu,

+   fd, timeout, name-sa_len, name-sa_family,
name-sa_data[0], name-sa_data[1],
+  
name-sa_data[2],name-sa_data[3],name-sa_data[4],name-sa_data[5],name-sa_data[6],
+  
name-sa_data[7],name-sa_data[8],name-sa_data[9],name-sa_data[10],name-sa_data[11],
+  
name-sa_data[12],name-sa_data[13],namelen,timeout));
 #if defined(__WIN__) || defined(__NETWARE__)
+  DBUG_RETURN(0);
   return connect(fd, (struct sockaddr*) name, namelen);
 #else
   int flags, res, s_err;
@@ -153,11 +160,14 @@
 exactly like the normal connect() call does.
   */

-  if (timeout == 0)
+  if (timeout == 0) {
+DBUG_PRINT(info, (timeout == 0));
+DBUG_RETURN(0);
 return connect(fd, (struct sockaddr*) name, namelen);
-
+  }
   flags = fcntl(fd, F_GETFL, 0); /* Set socket to not block
*/
 #ifdef O_NONBLOCK
+  DBUG_PRINT(info, (O_NONBLOCK));
   fcntl(fd, F_SETFL, flags | O_NONBLOCK);  /* and save the flags.. 
*/
 #endif

@@ -167,10 +177,15 @@
   if ((res != 0)  (s_err != EINPROGRESS))
   {
 errno= s_err;  /* Restore it */
+DBUG_PRINT(error, (res != 0. res: %d errno: %d, res, errno));
+DBUG_RETURN(-1);
 return(-1);
   }
-  if (res == 0)/* Connected quickly!
*/
+  if (res == 0)/* Connected quickly!
*/ {
+DBUG_PRINT(info, (res == 0));
+DBUG_RETURN(0);
 return(0);
+  }
   return wait_for_data(fd, timeout);
 #endif
 }
@@ -187,7 +202,10 @@

 static int wait_for_data(my_socket fd, uint timeout)
 {
+  DBUG_ENTER(wait_for_data);
+  DBUG_PRINT(enter, (timeout :%lu, timeout));
 #ifdef HAVE_POLL
+  DBUG_PRINT(info:, (wait using poll));
   struct pollfd ufds;
   int res;

@@ -196,20 +214,30 @@
   if (!(res= poll(ufds, 1, (int) timeout*1000)))
   {
 errno= EINTR;
+DBUG_PRINT(error:, (EINTR));
+DBUG_RETURN(-1);
 return -1;
   }
-  if (res  0 || !(ufds.revents  (POLLIN | POLLPRI)))
+  if (res  0 || !(ufds.revents  (POLLIN | POLLPRI))) {
+DBUG_PRINT(error:, (res  0));
+DBUG_RETURN(-1);
 return -1;
+  }
+  DBUG_RETURN(0);
   return 0;
 #else
+  DBUG_PRINT(info:, (wait using loop));
   SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
   fd_set sfds;
   struct timeval tv;
   time_t start_time, now_time;
   int res, s_err;

-  if (fd = FD_SETSIZE)/* Check if
wrong error */
+  if (fd = FD_SETSIZE) {  /* Check if
wrong error */
+  DBUG_PRINT(info:, (wait using loop));
+DBUG_RETURN(0);
 return 0;  /* Can't use timeout
*/
+  }

   /*
 Our connection is in progress.  We can use the select() call to
wait
@@ -252,8 +280,11 @@
   return -1;
 now_time= my_time(0

#47641 [NEW]: mysql_connect using TCP with connect_timeout not equal to -1

2009-03-13 Thread dima at dimych dot sumy dot ua
From: dima at dimych dot sumy dot ua
Operating system: FreeBSD 7.1
PHP version:  5.2.9
PHP Bug Type: MySQL related
Bug description:  mysql_connect using TCP with connect_timeout not equal to -1

Description:

connecting to mysql server using TCP 
with mysql.connect_timeout set not equal to -1 in php.ini produces
error:
Can't connect to MySQL server on '127.0.0.1' (0)


Reproduce code:
---
1 in php.ini set:
   mysql.connect_timeout = 60

2 create user test with password test in local database

3 create file test.php:
?php
mysql_connect(127.0.0.1, 'test', 'test');
?

Expected result:

Successful connection to database like for:
?php
mysql_connect(localhost, 'test', 'test');
?
or connection to 127.0.0.1 with mysql.connect_timeout = -1




Actual result:
--
PHP Warning:  mysql_connect(): Can't connect to MySQL server on
'127.0.0.1' (0) in /usr/home/dima/test.php on line 2


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



#47641 [Com]: mysql_connect using TCP with connect_timeout not equal to -1

2009-03-13 Thread dima at dimych dot sumy dot ua
 ID:   47641
 Comment by:   dima at dimych dot sumy dot ua
 Reported By:  dima at dimych dot sumy dot ua
 Status:   Open
 Bug Type: MySQL related
 Operating System: FreeBSD 7.1
 PHP Version:  5.2.9
 New Comment:

I`m investigated this bug using mysql client trace file.
For additional debug info I modified mysql client library file 
sql-common/client.c. Modifications done in functions mysql_options,
my_connect, wait_for_data. This is diff for source of modified functions
(need for understanding new trace data):
--- client.c2008-11-14 18:37:28.0 +0200
+++ client.c.new2009-03-13 12:36:36.0 +0200
@@ -143,7 +143,14 @@
 int my_connect(my_socket fd, const struct sockaddr *name, uint
namelen,
   uint timeout)
 {
+  DBUG_ENTER(my_connect);
+  DBUG_PRINT(enter, (socket: %d
name:{%d,%d,[%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d,%d]} namelen: %lu
timeout: %lu,

+   fd, timeout, name-sa_len, name-sa_family,
name-sa_data[0], name-sa_data[1],
+  
name-sa_data[2],name-sa_data[3],name-sa_data[4],name-sa_data[5],name-sa_data[6],
+  
name-sa_data[7],name-sa_data[8],name-sa_data[9],name-sa_data[10],name-sa_data[11],
+  
name-sa_data[12],name-sa_data[13],namelen,timeout));
 #if defined(__WIN__) || defined(__NETWARE__)
+  DBUG_RETURN(0);
   return connect(fd, (struct sockaddr*) name, namelen);
 #else
   int flags, res, s_err;
@@ -153,11 +160,14 @@
 exactly like the normal connect() call does.
   */

-  if (timeout == 0)
+  if (timeout == 0) {
+DBUG_PRINT(info, (timeout == 0));
+DBUG_RETURN(0);
 return connect(fd, (struct sockaddr*) name, namelen);
-
+  }
   flags = fcntl(fd, F_GETFL, 0); /* Set socket to not block
*/
 #ifdef O_NONBLOCK
+  DBUG_PRINT(info, (O_NONBLOCK));
   fcntl(fd, F_SETFL, flags | O_NONBLOCK);  /* and save the flags.. 
*/
 #endif

@@ -167,10 +177,15 @@
   if ((res != 0)  (s_err != EINPROGRESS))
   {
 errno= s_err;  /* Restore it */
+DBUG_PRINT(error, (res != 0. res: %d errno: %d, res, errno));
+DBUG_RETURN(-1);
 return(-1);
   }
-  if (res == 0)/* Connected quickly!
*/
+  if (res == 0)/* Connected quickly!
*/ {
+DBUG_PRINT(info, (res == 0));
+DBUG_RETURN(0);
 return(0);
+  }
   return wait_for_data(fd, timeout);
 #endif
 }
@@ -187,7 +202,10 @@

 static int wait_for_data(my_socket fd, uint timeout)
 {
+  DBUG_ENTER(wait_for_data);
+  DBUG_PRINT(enter, (timeout :%lu, timeout));
 #ifdef HAVE_POLL
+  DBUG_PRINT(info:, (wait using poll));
   struct pollfd ufds;
   int res;

@@ -196,20 +214,30 @@
   if (!(res= poll(ufds, 1, (int) timeout*1000)))
   {
 errno= EINTR;
+DBUG_PRINT(error:, (EINTR));
+DBUG_RETURN(-1);
 return -1;
   }
-  if (res  0 || !(ufds.revents  (POLLIN | POLLPRI)))
+  if (res  0 || !(ufds.revents  (POLLIN | POLLPRI))) {
+DBUG_PRINT(error:, (res  0));
+DBUG_RETURN(-1);
 return -1;
+  }
+  DBUG_RETURN(0);
   return 0;
 #else
+  DBUG_PRINT(info:, (wait using loop));
   SOCKOPT_OPTLEN_TYPE s_err_size = sizeof(uint);
   fd_set sfds;
   struct timeval tv;
   time_t start_time, now_time;
   int res, s_err;

-  if (fd = FD_SETSIZE)/* Check if
wrong error */
+  if (fd = FD_SETSIZE) {  /* Check if
wrong error */
+  DBUG_PRINT(info:, (wait using loop));
+DBUG_RETURN(0);
 return 0;  /* Can't use timeout
*/
+  }

   /*
 Our connection is in progress.  We can use the select() call to
wait
@@ -252,8 +280,11 @@
   return -1;
 now_time= my_time(0);
 timeout-= (uint) (now_time - start_time);
-if (errno != EINTR || (int) timeout = 0)
+if (errno != EINTR || (int) timeout = 0) {
+  DBUG_PRINT(error:, (errno != EINTR. errno: %d, errno));
+  DBUG_RETURN(-1);
   return -1;
+}
   }

   /*
@@ -263,14 +294,19 @@
   */

   s_err=0;
-  if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) s_err,
s_err_size) != 0)
+  if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (char*) s_err,
s_err_size) != 0) {
+DBUG_PRINT(error:, (getscokopt));
+DBUG_RETURN(-1);
 return(-1);
-
+  }
   if (s_err)
   {/* getsockopt could
succeed */
 errno = s_err;
+DBUG_PRINT(error:, (getsockopt errno: %d, errno));
+DBUG_RETURN(-1);
 return(-1);/* but return
an error... */
   }
+  DBUG_RETURN(0);
   return (0);  /* ok */
 #endif /* HAVE_POLL */
 }
@@ -3023,6 +3059,7 @@
   DBUG_PRINT(enter,(option: %d,(int) option));
   switch (option) {
   case MYSQL_OPT_CONNECT_TIMEOUT:
+  DBUG_PRINT(enter,(arg: %lu,*(uint*) arg));
 mysql-options.connect_timeout= *(uint*) arg;
 break;
   case MYSQL_OPT_READ_TIMEOUT:

--- END OF DIFF ---
doing connect using
?php mysql_connect

#35062 [Bgs-Opn]: socket_read() produces warnings on non blocking sockets

2005-11-04 Thread dima at dimych dot sumy dot ua
 ID:   35062
 User updated by:  dima at dimych dot sumy dot ua
 Reported By:  dima at dimych dot sumy dot ua
-Status:   Bogus
+Status:   Open
 Bug Type: Sockets related
 Operating System: FreeBSD 4.9-STABLE #0
 PHP Version:  4.4.1RC1
 New Comment:

I`m look everyware in the Internet and don`t find any workaround for
this problem. And error logs still growing...

This code decreases count of warnings:
-- code --
$startTime = microtime_float(true);
socket_send($socket, $package, strLen($package), 0);
socket_set_block($socket);
$to = array('sec' = 0, 'usec' = 50);
socket_set_option($socket, SOL_SOCKET, SO_RCVTIMEO, $to);
if (socket_read($socket, 4096)) {
  socket_close($socket);
  return microtime_float() - $startTime;
}
socket_close($socket);
-- end of code --
my ping function launches once per 5 minutes for around 50 hosts, but
not all of them alive. Dead hosts causes warnings.


Previous Comments:


[2005-11-02 14:37:46] dima at dimych dot sumy dot ua

I`m not agree what it is bogus

part of code from ext/sockets/sockets.c:
-- code --
if (type == PHP_NORMAL_READ) {
retval = php_read(php_sock-bsd_socket, tmpbuf, length,
0);
} else {
retval = recv(php_sock-bsd_socket, tmpbuf, length,
0);
}

if (retval == -1) {
PHP_SOCKET_ERROR(php_sock, unable to read from
socket, errno);
efree(tmpbuf);
RETURN_FALSE;
}
-- end of code --
As you can see any processing for EAGAIN not exists. Warning will be
generated in any case. 

1. I`m developing icmp ping function and no reply is not an error in
my program.
2. Function, what can say is any data to receive, not exists.
3. I do not want to turn warnings off. Because I need them in other
places.



[2005-11-02 14:18:22] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.





[2005-11-02 08:52:06] dima at dimych dot sumy dot ua

Description:

Use of socket_read() on non blocking sockets produces warinigs like:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable

I`m storing all php errors in log file /var/log/php.log.
This warning causes overflow of /var partition because socket_read()
called to wait icmp message. 


Reproduce code:
---
$socket = socket_create(AF_INET, SOCK_RAW, 1);
socket_connect($socket, $host, null);
$startTime = microtime_float(true);
socket_send($socket, $data, strLen($data), 0);
socket_set_nonblock($socket);
while((microtime_float() - $startTime)  0.5) {
  $mt = microtime_float();
  if (socket_read($socket, 255)) {
 break;
  }
}
socket_close($socket);


Expected result:

no warnings in php.log

Actual result:
--
I`m receive huge count of warinigs in my php.log file like this:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable






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


#35062 [Bgs]: socket_read() produces warnings on non blocking sockets

2005-11-02 Thread dima at dimych dot sumy dot ua
 ID:   35062
 User updated by:  dima at dimych dot sumy dot ua
 Reported By:  dima at dimych dot sumy dot ua
 Status:   Bogus
 Bug Type: Sockets related
 Operating System: FreeBSD 4.9-STABLE #0
 PHP Version:  4.4.1RC1
 New Comment:

I`m not agree what it is bogus

part of code from ext/sockets/sockets.c:
-- code --
if (type == PHP_NORMAL_READ) {
retval = php_read(php_sock-bsd_socket, tmpbuf, length,
0);
} else {
retval = recv(php_sock-bsd_socket, tmpbuf, length,
0);
}

if (retval == -1) {
PHP_SOCKET_ERROR(php_sock, unable to read from
socket, errno);
efree(tmpbuf);
RETURN_FALSE;
}
-- end of code --
As you can see any processing for EAGAIN not exists. Warning will be
generated in any case. 

1. I`m developing icmp ping function and no reply is not an error in
my program.
2. Function, what can say is any data to receive, not exists.
3. I do not want to turn warnings off. Because I need them in other
places.


Previous Comments:


[2005-11-02 14:18:22] [EMAIL PROTECTED]

Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.





[2005-11-02 08:52:06] dima at dimych dot sumy dot ua

Description:

Use of socket_read() on non blocking sockets produces warinigs like:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable

I`m storing all php errors in log file /var/log/php.log.
This warning causes overflow of /var partition because socket_read()
called to wait icmp message. 


Reproduce code:
---
$socket = socket_create(AF_INET, SOCK_RAW, 1);
socket_connect($socket, $host, null);
$startTime = microtime_float(true);
socket_send($socket, $data, strLen($data), 0);
socket_set_nonblock($socket);
while((microtime_float() - $startTime)  0.5) {
  $mt = microtime_float();
  if (socket_read($socket, 255)) {
 break;
  }
}
socket_close($socket);


Expected result:

no warnings in php.log

Actual result:
--
I`m receive huge count of warinigs in my php.log file like this:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable






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


#35062 [NEW]: socket_read() produces warninigs on non blocking sockets

2005-11-01 Thread dima at dimych dot sumy dot ua
From: dima at dimych dot sumy dot ua
Operating system: FreeBSD 4.9-STABLE #0
PHP version:  4.4.1RC1
PHP Bug Type: Sockets related
Bug description:  socket_read() produces warninigs on non blocking sockets

Description:

Use of socket_read() on non blocking sockets produces warinigs like:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable

I`m storing all php errors in log file /var/log/php.log.
This warning causes overflow of /var partition because socket_read()
called to wait icmp message. 


Reproduce code:
---
$socket = socket_create(AF_INET, SOCK_RAW, 1);
socket_connect($socket, $host, null);
$startTime = microtime_float(true);
socket_send($socket, $data, strLen($data), 0);
socket_set_nonblock($socket);
while((microtime_float() - $startTime)  0.5) {
  $mt = microtime_float();
  if (socket_read($socket, 255)) {
 break;
  }
}
socket_close($socket);


Expected result:

no warnings in php.log

Actual result:
--
I`m receive huge count of warinigs in my php.log file like this:
socket_read() unable to read from socket [35]: Resource temporarily
unavailable


-- 
Edit bug report at http://bugs.php.net/?id=35062edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35062r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=35062r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=35062r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=35062r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=35062r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=35062r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=35062r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=35062r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35062r=support
Expected behavior:   http://bugs.php.net/fix.php?id=35062r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=35062r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=35062r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=35062r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35062r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=35062r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=35062r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35062r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35062r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=35062r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35062r=mysqlcfg