|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #31681 when using trim(...) loop stops
Submitted: 2005-01-24 21:42 UTC Modified: 2005-02-02 01:00 UTC
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: joesterg at hotmail dot com Assigned:
Status: No Feedback Package: Strings related
PHP Version: 5.0.3 OS: Windows 2000 Server
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
48 - 17 = ?
Subscribe to this entry?

 [2005-01-24 21:42 UTC] joesterg at hotmail dot com
Whenever trim(...) is used on the 
line, the loop stops. 
However, splitting the line in two:
makes the loop work as expected...

Reproduce code:
$num_columns = $this->DBResult->Fields->Count();
        for($i=0; $i < $num_columns; $i++) {
          toLog("DB_ADO.query","3.0: i=".$i.", Fields=".$colstr."/".$name.", num_columns=".$num_columns);
          toLog("DB_ADO.query","3.1: i=".$i.", Fields=".$colstr."/".$name."/".$value.", num_columns=".$num_columns);
          toLog("DB_ADO.query","3.2: this->DBResultSet[rowcount][name]=".$this->DBResultSet[$rowcount][$name]);

Expected result:
DBCon is an ADO connection to SQL Server 2000.

I expect to have the code loop through the columns found in the query, assigning each column a value in the DBResultSet array.

Seeing the following in the log:

2005.01.24-21.43:02***DB_ADO.query***1: select statement
2005.01.24-21.43:02***DB_ADO.query***2: num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.0: i=0, Fields=4/id, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=0, Fields=4/id/4, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=4
2005.01.24-21.43:02***DB_ADO.query***3.0: i=1, Fields=jqj/username, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=1, Fields=jqj/username/jqj, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=jqj
2005.01.24-21.43:02***DB_ADO.query***3.0: i=2, Fields=8ad8757baa8564dc136c1e07507f4a98/password, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=2, Fields=8ad8757baa8564dc136c1e07507f4a98/password/8ad8757baa8564dc136c1e07507f4a98, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=8ad8757baa8564dc136c1e07507f4a98
2005.01.24-21.43:02***DB_ADO.query***3.0: i=3, Fields=J?rgen ?stergaard/realname, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=3, Fields=J?rgen ?stergaard/realname/J?rgen ?stergaard, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=J?rgen ?stergaard
2005.01.24-21.43:02***DB_ADO.query***3.0: i=4,, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=4,, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]
2005.01.24-21.43:02***DB_ADO.query***3.0: i=5, Fields=-/phone, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=5, Fields=-/phone/-, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=-
2005.01.24-21.43:02***DB_ADO.query***3.0: i=6, Fields=-/fax, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=6, Fields=-/fax/-, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=-
2005.01.24-21.43:02***DB_ADO.query***3.0: i=7, Fields=DEA/companycode, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=7, Fields=DEA/companycode/DEA, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=DEA
2005.01.24-21.43:02***DB_ADO.query***3.0: i=8, Fields=ADMIN/role, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=8, Fields=ADMIN/role/ADMIN, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=ADMIN
2005.01.24-21.43:02***DB_ADO.query***3.0: i=9, Fields=EN/languagecode, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.1: i=9, Fields=EN/languagecode/EN, num_columns=10
2005.01.24-21.43:02***DB_ADO.query***3.2: this->DBResultSet[rowcount][name]=EN

Actual result:
From the log:
2005.01.24-21.41:15***DB_ADO.query***1: select statement
2005.01.24-21.41:15***DB_ADO.query***2: num_columns=10
2005.01.24-21.41:15***DB_ADO.query***3.0: i=0, Fields=4/id, num_columns=10


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2005-01-24 21:50 UTC]
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.
 [2005-01-24 21:54 UTC] joesterg at hotmail dot com
Ok, I can provide that, but you also need a setup with a SQL Server 2000 to replicate this fully...
 [2005-01-25 15:06 UTC]
Please read the comment again:

"no external resources" 

If you can't come up with an isolated test case we can't fix anything.

 [2005-02-02 01:00 UTC] 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".
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Wed Nov 29 09:01:28 2023 UTC