php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #36764 pdo_oci hangs apache
Submitted: 2006-03-16 21:44 UTC Modified: 2006-03-18 23:10 UTC
From: mauroi at digbang dot com Assigned:
Status: Closed Package: PDO related
PHP Version: 5CVS-2006-03-16 (snap) OS: Win XP SP2
Private report: No CVE-ID:
 [2006-03-16 21:44 UTC] mauroi at digbang dot com
Description:
------------
When using a binary_float field, apache hangs.
I works ok using a binary_double.

Thanks in advance.

Reproduce code:
---------------
sql:

create table foo (field binary_float);
insert into foo values ('23');
commit;

php:

$conn = new PDO('oci:dbname=armani', 'cincuenta', 'cincuenta');
$a = $conn->prepare('SELECT * FROM foo');
$a->execute();
var_dump($a->fetch());

Expected result:
----------------
the row information

Actual result:
--------------
hangs

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-03-16 21:46 UTC] mauroi at digbang dot com
OUCH!
at least, it is an internal development server... otherwise i would be worried because a forgot to change username and password. sorry.
 [2006-03-16 21:53 UTC] mauroi at digbang dot com
Sorry for the additional comment, but i think that you would like to know that under some situations it also happens with binary_double. Consider the following table:

create table foo (
   "char" char(10),
   "varchar" varchar2(10),
   "nchar" nchar(10),
   "nvarchar" nvarchar2(10),
   "number" number,
   "binary_float" binary_float,
   "binary_double" binary_double,
   "date" date,
   "timestamp" timestamp,
   "integer" integer,
   "float" float);
 [2006-03-16 22:45 UTC] mauroi at digbang dot com
The supplied link is for php4. I think you made a mistake.
Tell me if i'm wrong. Thanks.
 [2006-03-17 09:22 UTC] tony2001@php.net
Please try using this CVS snapshot:

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

Sure I did a mistake. 
 [2006-03-17 13:55 UTC] mauroi at digbang dot com
Yes. The same happens. The page keeps loading forever.
 [2006-03-18 20:31 UTC] tony2001@php.net
I'm afraid "The page keeps loading forever" and "hangs" is not enough to understand the problem and I can't reproduce it on Linux with Oracle Instant Client and Oracle 10.
What version of Oracle client and server are you using?
What's in the error_log? Any other info?
 [2006-03-18 20:54 UTC] mauroi at digbang dot com
I'm using oracle instant client (on windows), and oracle 10R2 on linux also.
I tried this script on linux (centos4, same machine):

$conn = new PDO('oci:dbname= :o)', 'user', 'pass');
$a = $conn->prepare('SELECT * FROM foo');
var_dump($a->execute());
echo 'aa';
var_dump($a->fetch());
echo 'bb';

and got this:

"bool(true) aa"
(row information and bb missing)

I don't get anything wrong in the error_log. Just the usual line in the access_log.
Did you insert data on the table? With an empty table it doesn't happen.

Thank you.
 [2006-03-18 21:13 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

All I get is:
array(2) {
  ["FIELD"]=>
  string(4) "1.0E"
  [0]=>
  string(4) "1.0E"
}
(I did "insert into foo values (1)")
 [2006-03-18 21:52 UTC] mauroi at digbang dot com
Well, I tried to generate a backtrace but there's no real crash here.
On windows it hangs, on linux the script doesn't finish (it stops after the fetch, but with no segfault). gdb only shows  "Detaching after fork from child process xxxx".
Is there anything else I can do?
(I can use another datatype. Maybe you could wait for someone that can't live without binary_float).

Thanks....
 [2006-03-18 21:55 UTC] tony2001@php.net
>gdb only shows  "Detaching after fork from child process xxxx".
Please try to run the script with PHP CLI binary.
And check the server - maybe the problem is that Oracle _server_ crashes?
 [2006-03-18 22:40 UTC] mauroi at digbang dot com
Oracle server is working (thank god :o) ).
But I'm terribly sorry I made a mistake and forgot to deactivate the user_error_handler. So this is the warning I get on Linux:
"PDOStatement::fetch() [function.fetch]: column 0 data was too large for buffer and was truncated to fit it
  at PDOStatement->fetch in [...]temp.php:6"
On windows, as I said, it hangs.

I changed pdo_oci/oci_statement.c with the following patch, and it seems to work:
http://webmail.digbang.com/patch_binary_float.txt

Thanks in advance.
 [2006-03-18 23:10 UTC] tony2001@php.net
Thanks for the patch, applied.
But it will be used only if the client library supports those types (i.e. version >= 10.x).
 
PHP Copyright © 2001-2014 The PHP Group
All rights reserved.
Last updated: Fri Apr 18 05:03:21 2014 UTC