|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #6527 empty field returned are not empty
Submitted: 2000-09-04 06:44 UTC Modified: 2000-12-13 05:56 UTC
From: lenar at city dot ee Assigned:
Status: Closed Package: Sybase-ct (ctlib) related
PHP Version: 4.0.1pl2 OS: Linux Debian 2.2
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: lenar at city dot ee
New email:
PHP Version: OS:


 [2000-09-04 06:44 UTC] lenar at city dot ee
When fetching a record from sybase with sybase_fetch_row
and some fields contain no value ("") then in resulting array there are spaces instead.

list($space) = sybase_fetch_row(sybase_query("SELECT phone FROM users WHERE LENGTH(phone) = 0"));

now $space == " ".

This is not what I want. I want strlen($space) == 0.

Hope this bug will be fixed.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2000-09-04 06:56 UTC] lenar at city dot ee
And don't say it's sybase's fault. At least in ISQL it works. It's ASE 6 here and in ISQL over ctlib I get very proper results:

SELECT '**', '*'+phone+'*', LENGTH(phone) FROM users WHERE LENGTH(phone) = 0

result records:

**  **  0
**  **  0

**  * *  0

or something more bizarre.

So please check it out.


 [2000-09-05 03:14 UTC]
Note that the empty string is NOT the same thing in
Sybase as a's what ISQL shows us.

2> go

 -- -----------------
 ** **
 ** **
<... snip ...>
(18 rows affected)

2> go

 -- -----------------
 ** * *
<... snip ...>
 ** * *
 ** * *

(389 rows affected)

And what version of Sybase ASE are you using?
6.0? There is no (AFAIK) Linux port earlier than
11.5, so something is definitely wrong here.
 [2000-09-05 08:16 UTC] lenar at city dot ee
In ISQL I can do the same way you did and the results are ok:

select '**', '*'+phone+'*' from users where phone = ''

And I get:

** **
** **

so on...

and the result can't be NULL beacuse the phone field is defined as NOT NULL DEFAULT ''
so it always contains a string '' whenever it's not explictly specified to something else.

We are here using Sybase ASE (Adaptive Server Anywhere) ver 6.0.3 and this is not the same
thingas ASA 11.x. The versioning sequence is different. ASE supports open client connectivity
and we are using ASA 11.9.x ct-libs client side libraries to provide the connectivity to our applications
on windows platform and to php-sybase-ct on linux platform. This is because ASE isn't coming default 
with these libraries, but provides protocol-level compatibility when it's lot cheaper than ASA itself.
Maybe I find time to debug php-sybase module myself but right now I just reported that in my opinion 
the problem still exists and still needs attention. Maybe the problem resides in these client libraries, but right now I don't know.

 [2000-09-06 13:12 UTC]
#1: You have got yourself ass-backwards
ASA = /A/daptive /S/erver /A/nywhere
ASE = /A/daptive /S/erver /E/nterprise

Please edit your last comment with this
in mind, as I cannot understand what you
are trying to say.

My guess is that you are using the /ASE/
libraries to connect to an /ASA/ database,
which (AFAIK) has no officially defined

Long story short: Connecting to /ASE/ behaves
the way that /ASE/ always behaves. I'm fairly
sure that this is NOT a PHP bug, but is due
to the way that Sybase CT-Lib handles this.
 [2000-09-06 13:13 UTC]
Unless you can convince me otherwise (getting sybase
products correct would be a good start) I will close
this bug...
 [2000-09-06 14:02 UTC] lenar at city dot ee

I'm really sorry messing the names up.

Anyway when you change the ASA to ASE and vice versa in my comment then
the meaning is correct. 

I really don't know where is the source of this problem, but I can only
say that connecting to ASA (Anywhere) server with ISQL over network the
behavior is correct (empty strings not spaces instead).

And if this is the Sybase problem then do they know about it? Have somebody been
in contact with them regarding this case? If yes, then what have they said?

 [2000-12-06 21:50 UTC]
This is actually incorrect behavior on the part of their
ISQL utility according to Sybase's own documentation.
 [2000-12-13 05:30 UTC]
Just to document:
In the Sybase documentation manual "SQL Reference: Datatypes and System Tables", on page 7-27:

The empty string ("") is treated as a single space. In *char* and *nchar* *not null* columns, the result is a (column-length) field of spaces.

You can get around this by adding rtrim(field) in place of
field in the select clause.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Wed May 22 19:01:31 2024 UTC