[PHP-DEV] Bug #11218 Updated: isset() inside for() loops can crash

2001-06-21 Thread danielc

ID: 11218
User Update by: [EMAIL PROTECTED]
Old-Status: Feedback
Status: Open
Bug Type: Scripting Engine problem
Operating system: NT 4.0  SP6a
PHP Version: 4.0.5
Description: isset() inside for() loops can crash

Tested latest snapshot, http://www.zend.com/snapshots/get_latest.php, as of 17:00 
-400.  The problem with isset() inside for loops is fixed.  BUT, there is still a 
problem.  Testing a multidimensional array when only one dimension of the array is set 
causes the test to come out true even when it is not.  See example:

?php

   #  http://bugs.php.net/?id=11218
   #
   #  This if isset() test comes out as true
   #  even though it's actually false.

   echo 'Should not see anything else after this...';

   $Var['SC'] = 'y';

   if ( isset($Var['SC']['hide']) ) {
  echo br /isset() says \$Var['SC']['hide'] is set.;
   }

?

PS:  I'm saddened to hear new versions of PHP are going out with unresolved bugs in 
functions as basic and essential as isset().

Previous Comments:
---

[2001-06-21 12:14:07] [EMAIL PROTECTED]
I was unable to reproduce that problem, however, I did fix bug #10911 which appears to 
be based on the same issue.  Can you please test the latest CVS and see whether it 
solves your problem (note, this fix may not be a part of 4.0.6, since 4.0.6 has 
already been packaged;  It'll definitely be in 4.0.7)

---

[2001-06-05 17:20:08] [EMAIL PROTECTED]
Bug 10911, http://www.php.net/bugs.php?id=10911, was brought to my attention.  Both my 
report above and this other one may be based on the same bug.

---

[2001-05-31 12:33:40] [EMAIL PROTECTED]
?php

# The problem child...
   function Test($FileName, $FileLine, $Opt='', $Col='') {
  for ($Counter = 0; $Counter  3; $Counter++) {
 echo 'br /in for ';
 if ( isset($Col['SC']['hide']) ) {
echo 'in if';
 }
  }
   }
   Test(__FILE__,__LINE__);


# NOW, funny things happen if I change the number of times
# the for loop runs...

#  $Counter  1...
# Everything is fine.

#  $Counter  2...
# Dr Watson notifys of PHP crash, hit OK
# (SeeDr Watson report at end of this posting.)
# Text is displayed in browser.
# PHP no longer running.

#  $Counter  3...
# Nothing returned to browser.
# No Dr Watson reports.
# PHP won't stop executing, takes up 99% of processor time.
# Can't End Process in Task Manger.
# Doesn't stop after max execution time.
# Need to reboot to kill PHP process.
#
# Though, if I execute from command line...
# winds up in same infinite loop, but I can
# kill the PHP process from the task manager.



# So, if that's not strange enough, altering the
# test code in small ways eliminates the problem...


#  remove if / isset segment...
#  okay
/*
   function Test($FileName, $FileLine, $Opt='', $Col='') {
  for ($Counter = 0; $Counter  3; $Counter++) {
 echo 'br /in for ';
  }
   }
   Test(__FILE__,__LINE__);
*/


#  put the if / isset segment back
#  BUT remove the for loop
#  okay
/*
   function Test($FileName, $FileLine, $Opt='', $Col='') {
 if ( isset($Col['SC']['hide']) ) {
echo 'in if';
 }
   }
   Test(__FILE__,__LINE__);
*/


#  put the for loop back
#  BUT do isset on a single dimensional array...
#  okay
/*
   function Test($FileName, $FileLine, $Opt='', $Col='') {
  for ($Counter = 0; $Counter  3; $Counter++) {
 echo 'br /in for ';
 if ( isset($Col['SC']) ) {
echo 'in if';
 }
  }
   }
   Test(__FILE__,__LINE__);
*/


#  perform tasks outside a function.
#  okay
/*
  for ($Counter = 0; $Counter  3; $Counter++) {
 echo 'br /in for ';
 if ( isset($Col['SC']['hide']) ) {
echo 'in if';
 }
  }
*/


#  set the array before running function
#  okay
/*
   $Var['SC']['hide'] = 'y';
   function Test($FileName, $FileLine, $Opt='', $Col='') {
  for ($Counter = 0; $Counter  3; $Counter++) {
 echo 'br /in for ';
 if ( isset($Col['SC']['hide']) ) {
echo 'in if';
 }
  }
   }
   Test(__FILE__,__LINE__,'',$Var);
*/


#  Set a single dimensional array,
#  though continue to perform isset on a two dimensional
#  Doesn't crash
#  --  _BUT_ the if isset() test comes out as TRUE 
#  --  even when it's actually FALSE!
/*
   unset($Var);
   $Var['SC'] = 'y';
   function Test($FileName, $FileLine, $Opt='', $Col='') {
  for ($Counter = 0; $Counter  3; $Counter++) {
 echo 'br /in for ';
 if ( isset($Col['SC']['hide']) ) {
echo 'in if';
 }
  }
   }
   

[PHP-DEV] Bug #11439: Comments shown when lines separated by CR|CR|LF

2001-06-18 Thread danielc

From: [EMAIL PROTECTED]
Operating system: NT 4.0 SP6a
PHP version:  4.0.5
PHP Bug Type: Scripting Engine problem
Bug description:  Comments shown when lines separated by CR|CR|LF

  ISSUE:

Comments are visible in the parsed output.

But, this is only happening when the script has it's lines separated by two carriage 
returns then a line feed (CR|CR|LF) (ASCII Ordinals: 13|13|10).  If the file has lines 
broken by one carriage return then a line feed, things run correctly.

This report may shed light on bug #11303, entitled Comment Characters, submitted by 
another user on 5 June 2001:  http://www.php.net/bugs.php?id=11303

Here's how to recreate the problem...



  STEP 1:

Point your browser to http://www.analysisandsolutions.com/code/sql/strange.php

This is the source code for that page, if you're interested...


?php
header(Content-Type: text/plain; charset=ISO-8859-1);
?
?php echo ?php; ?

#  Comment at TOP
echo htmlheadtitleStrange Behavior/title/head\n;
echo bodypEcho at top/p\n;

?php echo ?; ?

pSome HTML in the middle./p

?php echo ?php; ?

# Comment near bottom.
echo pecho near bottom/p;

?php echo ?; ?

/body/html




  STEP 2:

Save the resulting output to your web server space.

Don't change the file name, file extension or the type of file.

I was using Netscape to view and save the file.
That may or may not be relevant.

FYI, here is a sample of the output.
Don't use this as the script in the next step.


?php
#  Comment at TOP
echo htmlheadtitleStrange Behavior/title/head\n;
echo bodypEcho at top/p\n;

?
pSome HTML in the middle./p

?php
# Comment near bottom.
echo pecho near bottom/p;

?
/body/html




 STEP 3:

Now point your web browser to the copy of strange.php
you saved in your web space.

Then point browser to it and it results in...



#  Comment at TOP
# Comment near bottom.
htmlheadtitleStrange Behavior/title/head
bodypEcho at top/p


pSome HTML in the middle./p



pecho near bottom/p

/body/html




  NOTE:

All of the comments are pushed to the beginning of the
program and then displayed.  Ouch!



-- 
Edit Bug report at: http://bugs.php.net/?id=11439edit=1



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #11451: ODBC under Apache: DLL Initialization Failed

2001-06-18 Thread danielc

From: [EMAIL PROTECTED]
Operating system: NT 4.0 SP6a
PHP version:  4.0.5
PHP Bug Type: ODBC related
Bug description:  ODBC under Apache:  DLL Initialization Failed

Here's my config:
   Windows NT 4.0 SP6a
   Apache 1.3.20, Running as service Logged On As a particular user
   PHP 4.0.5

Apache and PHP runs normally.

BUT, when I hit a PHP parsed page that uses ODBC connections, I get the following 
error message:

   Drwtsn32.exe - DLL Initialization Failed
   Initialization of the dynamic link library F:\WINNT\system32\USER32.dll failed.
   The process is terminating abnormally.


This only happens when I have the Apache Service Log On As a separate user via This 
Account.  There's no problem if I have the Apache Service Log On As the System 
Account.

The special user account in question has full control over all files and directories 
in the F:\Program Files\Apache\* tree.

Everyone has read access on all files and directories in the F:\WINNT\* tree.

I followed the instructions in the User Account for Apache Service to Run As 
(NT/2000) section of http://httpd.apache.org/docs/win_service.html and then rebooted 
the machine.  Still no luck.

Nothing shows up in Apache's error.log.

This may solely be an Apache problem, but I suspect it has to do with the 
interractions between PHP, ODBC and Apache.  Perhaps y'all can trace what's going on.

Probably the same problem reported in bug #8303: http://www.php.net/bugs.php?id=8303

Thanks,

--Dan


-- 
Edit Bug report at: http://bugs.php.net/?id=11451edit=1



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] PHP 4.0 Bug #7582 Updated: ODBC or die inside user defined functions

2001-04-01 Thread danielc

ID: 7582
User Update by: [EMAIL PROTECTED]
Status: Closed
Bug Type: ODBC related
Description: ODBC or die inside user defined functions

Hi kalowsky:

Please give me a URL where I can downlad PHP4.0.5RC4 and I'll be glad to test it out 
again ASAP.

--Dan

Previous Comments:
---

[2001-04-01 20:19:31] [EMAIL PROTECTED]
after trying numerous methods to reproduce this, I cannot.  
The only thing I can phathom is that your 
$RecordSetFieldCount is set inaccurately, but again I 
couldn't reproduce the described behavior when over running 
it.

Mind you, I am using PHP in a CGI format, and on Win98SE.  
PHP version is PHP4.0.5RC4.

---

[2001-02-26 15:11:56] [EMAIL PROTECTED]
Problem still exists in php4_0_5-dev-win32-20010220

---

[2000-12-19 00:10:43] [EMAIL PROTECTED]
The problem still exists in php4_0_4-dev-win32-20001123.

---

[2000-12-07 12:01:42] [EMAIL PROTECTED]
Get the latest build from http://www.php4win.de/
and reopen if problem still exists with it.

--Jani

---

[2000-11-09 21:04:46] [EMAIL PROTECTED]
Please advise where I can obtain a compiled binary of 4.0.4dev for Win32.  I'll be 
glad to test it.  Looks like CVS and snaps.php.net send source code.  Don't know where 
else to turn.

---

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

Full Bug description available at: http://bugs.php.net/?id=7582


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] PHP 4.0 Bug #9486 Updated: seems to be memory related

2001-02-27 Thread danielc

ID: 9486
User Update by: [EMAIL PROTECTED]
Old-Status: Feedback
Status: Open
Bug Type: Reproduceable crash
Description: seems to be memory related

I took the ease of your being able to run the tests via database into account.  The 
queries don't call any fields.  They just call the concat() function.  All you need to 
do with the database is put in host, user, pass, and name of a valid database.

I haven't been able to reproduce it w/o the databse connection.

Previous Comments:
---

[2001-02-27 15:39:18] [EMAIL PROTECTED]
Can you possible reproduce it with a script that does not use databases? It's kinda 
hard to reproduce this way for us.

---

[2001-02-27 15:16:25] [EMAIL PROTECTED]
?php

#  Hi:
#
#  Running PHP 4.0.5-dev Feb 20 2001
#  Windows NT 4.0 SP 6a
#  Apache 1.3.6
#  MySQL 3.23.32
#
#  The problem does not exist in 4.0.4-dev Nov 23 2000.
#
#  Problem arises when doing an isset() on a
#  a multidimensional array inside a function
#  that has that variable as an optional argument
#  but the argument hasn't been set, so it
#  defaults to ''.
#
#  But, it's not that simple.  Problem comes
#  and goes depending on how much memory is
#  being used.
#
#  Also, situation is only happening when
#  using results from mysql_field_name().
#
#  In addition, sometimes the page gets
#  created by PHP and sent to the browser,
#  but PHP crashes anyway.
#
#  I've already spent six hours trying to
#  pinpoint what's going on, though haven't
#  been able to hit the nail on the head yet.
#
#  Good luck.
#
#  --Dan


class Test {

   var $H = 'localhost';
   var $U = 'track';
   var $P = 'flight9';
   var $D = 'SessionTracker';


   function Setup() {
  $this-C = @mysql_connect("$this-H", "$this-U", "$this-P");
  $this-Hand = @mysql_select_db("$this-D", $this-C);
  $this-Res = @mysql_query("$this-Query",$this-C);
  $this-Cols = @mysql_num_fields($this-Res);
   }


   function FieldName($FileName,$FileLine,$ColNum) {
  if ( $Output = @mysql_field_name($this-Res, $ColNum) ) {
 return $Output;
  } else {
 echo "Field Name Had Problem";
  }
   }


   #  BEGIN ALTERNATIVE TEST FUNCTIONS HERE...

   # Uses MySQL data, but doesn't have the "$Col" argument.
   function Good() {
  for ($Count = 0; $Count  $this-Cols; $Count++) {
 $FieldNames[] = $this-FieldName('test','here', $Count);
 if ( !isset($Col[$FieldNames[$Count]]['hide']) ) {
$VisibleFields++;
echo "$Count = $FieldNames[$Count]. ";
 }
  }
   }


   # Doesn't use MySQL data, but uses "$Col" argument.
   function NoProblem($Col='') {
  for ($Count = 0; $Count  3; $Count++) {
 $FieldNames[] = 'dog';
 $FieldNames[] = 'somename';
 $FieldNames[] = 'cat';
 if ( !isset($Col[$FieldNames[$Count]]['hide']) ) {
$VisibleFields++;
echo "$Count = $FieldNames[$Count]. ";
 }
  }

   }


   # This is the function which causes the problems.
   # Uses MySQL data and has a "$Col" argument.
   function Bad($Col='') {
  for ($Count = 0; $Count  $this-Cols; $Count++) {

 #
 #  "Field Name Call -- Short"
 #
  $FieldNames[] = $this-FieldName('test','here', $Count);

 #
 #  "Field Name Call -- Long"
 #
 # $FieldNames[] = $this-FieldName("FieldName() had error when RSATbl() was 
called by $FileName","$FileLine", $Count);

 #  PROBLEM HAPPENS ON NEXT LINE
 #  Commenting it and the closing } gets the
 #  problems to stop.
 if ( !isset($Col[$FieldNames[$Count]]['hide']) ) {

# Commenting out the following line
# completely shifts the pattern of what
# is okay, crashes and infinite loops!
 $VisibleFields++;

echo "$Count = $FieldNames[$Count]. ";
 }

  }# End of for $Count
   }# End of Bad()
}# End of class


$SQL = new Test;



# TEST SCENARIOS FOR RUNNING THE BAD() FUNCTION


# WHEN:---
#   "Field Name Call -- Short"
#   "$VisibleFields++;" is open
#
# Okay if 1 or 2 Columns:
#   $SQL-Query = "SELECT concat('hi') as H";
#   $SQL-Query = "SELECT concat('hi') as H, concat('bye') as B";
# Infinite Loop if 3 Columns:
#   $SQL-Query = "SELECT concat('hi') as H, concat('bye') as B, concat('why') as W";
# Crashes if 4 Columns:
   $SQL-Query = "SELECT concat('hi') as H, concat('bye') as B, concat('why') as W, 
concat('oh') as O";


# WHEN:---
#   "Field Name Call -- Long"
#   "$VisibleFields++;" is open
#
# Okay if 1 Column:
#   

[PHP-DEV] PHP 4.0 Bug #9467: parse error when closing function in require()/include() file

2001-02-26 Thread danielc

From: [EMAIL PROTECTED]
Operating system: NT 4.0 sp 6a
PHP version:  4.0.4pl1
PHP Bug Type: Scripting Engine problem
Bug description:  parse error when closing function in require()/include() file

Hi:

A parse error arises if a function was opened in the main file and closed in a 
require()'d or include()'d file.

I'm actually using PHP 4.0.5-dev for windows, 2001-02-20.  This problem also existed 
in 4.0.4-dev.  Note, the problem does not happen in PHP 3.0.16.

Here are the test scripts:

== req-test.php 
?php

function Tester() {

   include('./req-test.inc');

   # Note, the function has its closing 
   # "}" inside the required file.


echo 'phi there from the main file/p';

Tester();

?

== req-test.inc 
?php
   # This is still inside the function.

   echo 'pHi there from inside the function';
   echo ' that is continued inside the required file/p';

}# End function Tester

?



Thanks,

--Dan


-- 
Edit Bug report at: http://bugs.php.net/?id=9467edit=1



-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] PHP 4.0 Bug #7582 Updated: ODBC or die inside user defined functions

2001-02-26 Thread danielc

ID: 7582
User Update by: [EMAIL PROTECTED]
Status: Open
Bug Type: Reproduceable crash
Description: ODBC or die inside user defined functions

Problem still exists in php4_0_5-dev-win32-20010220

Previous Comments:
---

[2000-12-19 00:10:43] [EMAIL PROTECTED]
The problem still exists in php4_0_4-dev-win32-20001123.

---

[2000-12-07 12:01:42] [EMAIL PROTECTED]
Get the latest build from http://www.php4win.de/
and reopen if problem still exists with it.

--Jani

---

[2000-11-09 21:04:46] [EMAIL PROTECTED]
Please advise where I can obtain a compiled binary of 4.0.4dev for Win32.  I'll be 
glad to test it.  Looks like CVS and snaps.php.net send source code.  Don't know where 
else to turn.

---

[2000-11-03 19:31:44] [EMAIL PROTECTED]
had no crash (w2k,4.0.4dev), try 4.0.4 as far as it is out
and if it still crashes I´ll try sth. different

---

[2000-11-01 22:25:17] [EMAIL PROTECTED]
A crash occurs when ODBC functions are called with an "or die" statement.
BUT this only happens when an error arises
AND the ODBC or die statement is made within a user defined function.

Doing the same thing without a creating a user defined function caused no problem.
Doing the same exact procedures with MySQL functions caused no problem.
This bug didn't exist in PHP 3.0.11.

Samples of each test variation is below, along with a Dr. Watson report.




?php

# This works fine in PHP 3.0.11
# BUT CRASHES IN 4.0.3

echo "h3ODBC field_len or die Called via Function/h3";
echo "PHP Version: " . phpversion();

function SomeFunction() {
   global $RecordSetFieldCount;
   global $RecordSet;

   for ($Counter = 0; $Counter  $RecordSetFieldCount; $Counter++) {
  echo "br /Counter: $Counter";

  # Uncommenting one of these causes crash in 4.0.3.
   $Output[] = @odbc_field_len($RecordSet, $Counter+1) or die ("Went beyond field 
index.");
  # $Output[] = @odbc_field_type($RecordSet, $Counter+1) or die ("Went beyond 
field index.");
  # $Output[] = @odbc_num_fields() or die ("Went beyond field index.");

  # Uncommenting this works fine in both versions.
  # $Output[] = @odbc_field_len($RecordSet, $Counter+1);
  # $Output[] = @odbc_num_fields();

   }
}

$Connection = @odbc_connect("StatsFInAccess", "", "", SQL_CUR_USE_ODBC);
$QueryString = "select * from States order by SC";
$RecordSet = @odbc_exec($Connection,"$QueryString");
$RecordSetFieldCount = 4;
SomeFunction();

?





?php
/*
# This works fine in PHP 3.0.11 and 4.0.3

echo "h3ODBC field_len or die Called Directly/h3";
echo "PHP Version: " . phpversion();

$Connection = @odbc_connect("StatsFInAccess", "", "", SQL_CUR_USE_ODBC);
$QueryString = "select * from States order by SC";
$RecordSet = @odbc_exec($Connection,"$QueryString");
$RecordSetFieldCount = 4;

for ($Counter = 0; $Counter  $RecordSetFieldCount; $Counter++) {
   echo "br /Counter: $Counter";
   $Output[] = @odbc_field_len($RecordSet, $Counter+1) or die ("Went beyond field 
index.");
}

*/
?




?php
/*
# This works fine in PHP 3.0.11 and 4.0.3

echo "h3MySQL field_len or die Called via Function/h3";
echo "PHP Version: " . phpversion();

function SomeFunction() {
   global $RecordSetFieldCount;
   global $RecordSet;

   for ($Counter = 0; $Counter  $RecordSetFieldCount; $Counter++) {
  echo "br /Counter: $Counter";
  $Output[] = @mysql_field_len($RecordSet, $Counter) or die ("Went beyond field 
index.");
   }
}

$Connection = @mysql_connect("localhost", "jdoe", "TheNumberGal");
$Database = @mysql_select_db("StatsF",$Connection);
$QueryString = "select * from States order by SC";
$RecordSet = @mysql_query("$QueryString",$Connection);
$RecordSetFieldCount = 4;
SomeFunction();

*/
?







?php
/*
Microsoft (R) Windows NT (TM) Version 4.00 DrWtsn32
Copyright (C) 1985-1996 Microsoft Corp. All rights reserved.



Application exception occurred:
App:  (pid=242)
When: 11/1/2000 @ 21:22:4.260
Exception number: c005 (access violation)

* System Information *
Computer Name: BASE
User Name: SYSTEM
Number of Processors: 1
Processor Type: x86 Family 6 Model 3 Stepping 4
Windows Version: 4.0
Current Build: 1381
Service Pack: 6
Current Type: Uniprocessor Free
Registered Organization: Analysis and Solutions Company
Registered Owner: Daniel Convissor

* Task List *
   0 Idle.exe
   2 System.exe
  24 SMSS.exe
  32 CSRSS.exe
  38 WINLOGON.exe
  46 SERVICES.exe
  49 LSASS.exe
  75