#23325 [Com]: PHP can't connect if db name has dashes

2008-06-03 Thread donnyk at gmail dot com
 ID:   23325
 Comment by:   donnyk at gmail dot com
 Reported By:  fritz at lateral dot net
 Status:   No Feedback
 Bug Type: MSSQL related
 Operating System: Win 2000
 PHP Version:  4.3.1
 New Comment:

This bug still exists in 5.2.6, code to reproduce remains the same.

mssql_select_db('mysilly-database'); will result in an error claiming
that mysilly does not exist within sysdatabases (a mssql system table).


Previous Comments:


[2007-11-30 17:40:53] byoung at bigbluehat dot com

2007 - PHP 5.2.3 still have this issue.

Connection to MSSQL databases with dash continues to fail (using
FreeTDS 0.63). Databases without dashes in the name connect without
error.



[2006-10-10 18:00:36] chris at sugarcrm dot com

2006 - PHP 4.4.2/4 and PHP 5.1.2/4 still have this issue.

The same code use-case is valid: try to connect to a MSSql database
with dashes in the name, and the connection will fail.



[2003-05-09 07:35:01] [EMAIL PROTECTED]

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to Open. Thank you.





[2003-04-30 06:13:24] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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





[2003-04-28 07:29:08] fritz at lateral dot net

Try creating a database called php-bugs-list and one 
called php_bugs_list.

mssql_connect('localhost','username','pwd') or die 
'mssql_connect error';
mssql_select_db('php-bugs-list') or die 
'mssql_select_db error';

mssql_connect('localhost','username','pwd') or die 
'mssql_connect error';
mssql_select_db('php_bugs_list') or die 
'mssql_select_db error';

I am not 'demanding' a fix - I have learnt that I will 
avoid errors by having no dashes in the database name. 
My problem is solved.
I tried to share this with other php users, If you want 
to use this information to improve php you are welcome 
to it - but please don't waste my time by being anal 
about how the bug is reported.

And that's the end of it, AFAIAC.



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

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



#34972 [Com]: STDIN won't allow nonblocking.

2007-08-19 Thread donnyk at gmail dot com
 ID:   34972
 Comment by:   donnyk at gmail dot com
 Reported By:  VJTD3 at VJTD3 dot com
 Status:   Open
 Bug Type: Streams related
 Operating System: *
 PHP Version:  php5.1-200603270630
 Assigned To:  wez
 New Comment:

i also have the same problem, i've tried the latest snapshot on windows
to no avail.  It works on my linux systems however.


Previous Comments:


[2007-08-10 13:01:48] VJTD3 at VJTD3 dot com

?php

 stream_set_blocking(STDIN, FALSE);
 echo fread(STDIN, 10);

?

notice how it just sits there? (blocking) it should exit instantly with
a null echo. (same as a tcp connection where if you just do a read that
is too fast with nonblocking it never gets a chance to fetch the data.)

what is happening is that php is blocking waiting for input
(specifically enter (line ending))

problem:
if you are echoing debug information and want to use key functionality
in tandem you can't because everything is blocked till you hit enter.



[2007-07-25 01:00:00] 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.



[2007-07-17 14:28:03] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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

For Windows (installer):

  http://snaps.php.net/win32/php5.2-win32-installer-latest.msi

I can't reproduce this (or very likely didn't understand the problem :)



[2006-03-27 14:12:28] VJTD3 at VJTD3 dot com

error in last message, stream_select() was ment.

code using stream_select() that still blocks:

?php

 set_time_limit('0');

 # note for php4 or lower STDIN isn't a defined constant.
 if (version_compare(phpversion(), '5.0.0', '')) {
  define('STDIN', fopen('php://stdin', 'r'));
 }

 for ($i=1;$i11;$i++) {
  unset($read);
  $read[] = STDIN;
  stream_select($read, $write = null, $except = null, $tv = 0);
  if (count($read)) {
   $data4 = @fread(STDIN, 1500);
   $data4 = str_replace(\r\n, \n, $data4);
   $data4 = str_replace(\n\r, \n, $data4);
   $data4 = str_replace(\r, \n, $data4);
   $data4 = str_replace(\n, '', $data4);
  }
  echo 'pass: '.$i.' - data: '.(strlen(@$data4) ? $data4 :
'empty').\n;
  unset($data4);
  sleep('1');
 }

?

the second you type/click a arrow key/anything it goes into blocking
mode again.



[2006-03-27 13:32:01] VJTD3 at VJTD3 dot com

bug #36030 is very similar to my bug, they might be related.

It looks like anything to STDIN (reguardless of access method like
php://stdin and constant('STDIN') and STDIN are all effected.)

When doing anything, be it select, timeout, or anything to monitor
the resource where a window is set (ie to timeout the blocking, set
nonblocking, or similar.) the input stalls (it's not really a stall,
it's just waiting for the input.) or fails (such as timeout setting that
fails and returns false.)

Tested on:
php4-STABLE-200603270430
php5.1-200603270630
php6.0-200602191730

Also tested as well on their *nix snaps version and all with the same
result. (blocking when they should not be blocking.)

Better code to make debugging easier and includes examples from
suggestions that don't work:

?php

 set_time_limit('0');

 # note for php4 or lower STDIN isn't a defined constant.
 if (version_compare(phpversion(), '5.0.0', '')) {
  define('STDIN', fopen('php://stdin', 'r'));
 }

 echo 'notice how the data loads unblocked reguardless if there is
data.'.\n;
 $demo1 = @fsockopen('yahoo.com', 80, $errno, $errstr, 60);
 stream_set_blocking($demo1, FALSE);
 fwrite($demo1, 'GET /'.\n\n);
 for ($i=1;$i11;$i++) {
  $data1 = @fread($demo1, 1500);
  $data1 = str_replace(\r\n, \n, $data1);
  $data1 = str_replace(\n\r, \n, $data1);
  $data1 = str_replace(\r, \n, $data1);
  $data1 = str_replace(\n, '', $data1);
  echo 'pass: '.$i.' - data: '.(strlen($data1) ? $data1 :
'empty').\n;
  sleep('1');
 }

 echo 'notice how the data loads unblocked and clearly there is no data
because this IP is invalid to connect to.'.\n;
 $demo2 = @fsockopen('0.0.0.0', 80, $errno, $errstr, 1);
 stream_set_blocking($demo2, FALSE);
 for ($i=1;$i11;$i++) {
  # this is expected to be a invalid resource.
  $data2 = @fread($demo2, 1500);
  $data2 = str_replace(\r\n, \n, $data2);
  $data2 = str_replace(\n\r, \n, $data2);
  $data2 = str_replace(\r, \n, $data2);
  $data2 = str_replace(\n, '', $data2);
  echo 'pass: '.$i.' - data: '.(strlen($data2) ? $data2 :
'empty').\n;
  sleep('1