#36029 [NEW]: Can not parse NULL as reference

2006-01-16 Thread f dot engelhardt at 21torr dot com
From: f dot engelhardt at 21torr dot com
Operating system: Linux
PHP version:  5.1.2
PHP Bug Type: Variables related
Bug description:  Can not parse NULL as reference

Description:

In C and most other programming languages it is possible to parse NULL as
a reference parameter to a function (a NULL-Pointer). In PHP i need to
allocate a variable, that can be given to the function. So there is no way
to parse a NULL-Pointer.

Reproduce code:
---
?php

function bTest($paData)
{
  if (is_null($paData))
  {
// cleanup
return true;
  }
  // handle data
  return true;
}

bTest(NULL);

?

Expected result:

Should work

Actual result:
--
Fatal error: Cannot pass parameter 1 by reference in ...

-- 
Edit bug report at http://bugs.php.net/?id=36029edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=36029r=trysnapshot44
Try a CVS snapshot (PHP 5.1): 
http://bugs.php.net/fix.php?id=36029r=trysnapshot51
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=36029r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36029r=fixedcvs
Fixed in release: 
http://bugs.php.net/fix.php?id=36029r=alreadyfixed
Need backtrace:   http://bugs.php.net/fix.php?id=36029r=needtrace
Need Reproduce Script:http://bugs.php.net/fix.php?id=36029r=needscript
Try newer version:http://bugs.php.net/fix.php?id=36029r=oldversion
Not developer issue:  http://bugs.php.net/fix.php?id=36029r=support
Expected behavior:http://bugs.php.net/fix.php?id=36029r=notwrong
Not enough info:  
http://bugs.php.net/fix.php?id=36029r=notenoughinfo
Submitted twice:  
http://bugs.php.net/fix.php?id=36029r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36029r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=36029r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36029r=dst
IIS Stability:http://bugs.php.net/fix.php?id=36029r=isapi
Install GNU Sed:  http://bugs.php.net/fix.php?id=36029r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=36029r=float
No Zend Extensions:   http://bugs.php.net/fix.php?id=36029r=nozend
MySQL Configuration Error:http://bugs.php.net/fix.php?id=36029r=mysqlcfg


#35338 [Fbk-Opn]: PDO freezes while retreiving binary data from postgres

2005-11-25 Thread f dot engelhardt at 21torr dot com
 ID:   35338
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
-Status:   Feedback
+Status:   Open
 Bug Type: PDO related
 Operating System: Linux
 PHP Version:  5CVS-2005-11-22 (CVS)
 Assigned To:  wez
 New Comment:

I am sorry, but i have to tell you, that nothing changed.
After executing the insert script, there was only the following in the
database:
id  data
4   \377\330\377\340

There has to more data.
I know, that when using the pg_ functions i have to pg_escape_bytea()
function on the binary data, and when i
read it, i have to use the pg_unescape_bytea() function.
Maybe this isn´t done.


Previous Comments:


[2005-11-25 04:38:16] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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

I've made some adjustments in CVS; please try the next PHP 5.1 snapshot
and let me know how it goes.



[2005-11-23 13:53:52] [EMAIL PROTECTED]

Assigned to the maintainer.



[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.



[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script: 

?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh-prepare($q);
if ($stmt) 
{
  $stmt-bindParam(':data',$sData);
  if (!$stmt-execute())
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  //header('Content-Type: image/jpeg');
  echo $sData;
  flush();
  exit;
} else {
  print_r($dbh-errorInfo());
}

?


This script is working with MySQL, but not with Postgresql



[2005-11-22 22:36:40] [EMAIL PROTECTED]

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?




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

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


#35338 [Opn]: PDO freezes while retreiving binary data from postgres

2005-11-25 Thread f dot engelhardt at 21torr dot com
 ID:   35338
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
 Status:   Open
 Bug Type: PDO related
 Operating System: Linux
 PHP Version:  5CVS-2005-11-22 (CVS)
 Assigned To:  wez
 New Comment:

It works, if i specify PDO::PARAM_LOB with the bindParam() call in the
insert script:

$stmt-bindParam(':data',$sData,PDO::PARAM_LOB);

I am not sure, if it should work without this, but it is working on
postgresql if i do it like this.
It also works with mysql, but that was working also without the
PDO::PARAM_LOB parameter.

So my question is:
Is it desired that binary data can be inserted into a table without
PDO::PARAM_LOB or not?


Previous Comments:


[2005-11-25 11:05:56] f dot engelhardt at 21torr dot com

I am sorry, but i have to tell you, that nothing changed.
After executing the insert script, there was only the following in the
database:
id  data
4   \377\330\377\340

There has to more data.
I know, that when using the pg_ functions i have to pg_escape_bytea()
function on the binary data, and when i
read it, i have to use the pg_unescape_bytea() function.
Maybe this isn´t done.



[2005-11-25 04:38:16] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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

I've made some adjustments in CVS; please try the next PHP 5.1 snapshot
and let me know how it goes.



[2005-11-23 13:53:52] [EMAIL PROTECTED]

Assigned to the maintainer.



[2005-11-23 12:28:51] f dot engelhardt at 21torr dot com

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.



[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script: 

?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh-prepare($q);
if ($stmt) 
{
  $stmt-bindParam(':data',$sData);
  if (!$stmt-execute())
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  //header('Content-Type: image/jpeg');
  echo $sData;
  flush();
  exit;
} else {
  print_r($dbh-errorInfo());
}

?


This script is working with MySQL, but not with Postgresql



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

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


#35338 [Fbk-Opn]: PDO freezes while retreiving binary data from postgres

2005-11-23 Thread f dot engelhardt at 21torr dot com
 ID:   35338
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
-Status:   Feedback
+Status:   Open
 Bug Type: PDO related
 Operating System: Linux
 PHP Version:  5CVS-2005-11-22 (CVS)
 New Comment:

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script: 

?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh-prepare($q);
if ($stmt) 
{
  $stmt-bindParam(':data',$sData);
  if (!$stmt-execute())
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  //header('Content-Type: image/jpeg');
  echo $sData;
  flush();
  exit;
} else {
  print_r($dbh-errorInfo());
}

?


This script is working with MySQL, but not with Postgresql


Previous Comments:


[2005-11-22 22:36:40] [EMAIL PROTECTED]

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?




[2005-11-22 20:57:09] f dot engelhardt at 21torr dot com

Description:

I tried to write binary data into a postgresql table, that work, but i
can not get this data out the table anymore.

Reproduce code:
---
?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh-prepare($q);
if ($stmt) 
{
  $stmt-bindColumn('DATA',$sData);
  if (!$stmt-execute())
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  if (!$stmt-fetch(PDO::FETCH_BOUND))
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  header('Content-Type: image/jpeg');
  echo $sData;
} else {
  print_r($dbh-errorInfo());
}

?


Table foobar only has a bytea column named data

Expected result:

should display the image

Actual result:
--
the php-process does not do anything, the browser waits for an answer
(i waited 5 minutes, but nothing happened)





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


#35338 [Opn]: PDO freezes while retreiving binary data from postgres

2005-11-23 Thread f dot engelhardt at 21torr dot com
 ID:   35338
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
 Status:   Open
 Bug Type: PDO related
 Operating System: Linux
 PHP Version:  5CVS-2005-11-22 (CVS)
 New Comment:

Sorry, i forgot to give you another hint:
The data in the postgresql database in the first script was added with
the pg_-functions into a bytea field.
As explained some minutes ago, inserting binary data into a bytea field
in postgres via pdo failes with no error output.
Maybe i am using the wrong datatype for binary data in postgres, but i
only found bytea for binary puroses.


Previous Comments:


[2005-11-23 12:25:07] f dot engelhardt at 21torr dot com

Exact the same script (replacing pgsql by mysql in the new PDO line) it
works with mysql.
I also tried it with CLI, the same error.

And i found out another bug. I tried to insert data into the table with
pdo into a postgresql database, but there are only some bytes inserted,
not all.

Script: 

?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0224');

$sData =
file_get_contents('/home/bowman/.fluxbox/backgrounds/NVA-91.jpg');

$q = 'INSERT INTO foobar (data) VALUES (:data)';
$stmt = $dbh-prepare($q);
if ($stmt) 
{
  $stmt-bindParam(':data',$sData);
  if (!$stmt-execute())
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  //header('Content-Type: image/jpeg');
  echo $sData;
  flush();
  exit;
} else {
  print_r($dbh-errorInfo());
}

?


This script is working with MySQL, but not with Postgresql



[2005-11-22 22:36:40] [EMAIL PROTECTED]

Are you able to reproduce it with something different than PgSQL?
Sqlite, for example?
Are you able to reproduce it with PHP CLI?




[2005-11-22 20:57:09] f dot engelhardt at 21torr dot com

Description:

I tried to write binary data into a postgresql table, that work, but i
can not get this data out the table anymore.

Reproduce code:
---
?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh-prepare($q);
if ($stmt) 
{
  $stmt-bindColumn('DATA',$sData);
  if (!$stmt-execute())
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  if (!$stmt-fetch(PDO::FETCH_BOUND))
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  header('Content-Type: image/jpeg');
  echo $sData;
} else {
  print_r($dbh-errorInfo());
}

?


Table foobar only has a bytea column named data

Expected result:

should display the image

Actual result:
--
the php-process does not do anything, the browser waits for an answer
(i waited 5 minutes, but nothing happened)





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


#35338 [NEW]: PDO freezes while retreiving binary data from postgres

2005-11-22 Thread f dot engelhardt at 21torr dot com
From: f dot engelhardt at 21torr dot com
Operating system: Linux
PHP version:  5CVS-2005-11-22 (CVS)
PHP Bug Type: PDO related
Bug description:  PDO freezes while retreiving binary data from postgres

Description:

I tried to write binary data into a postgresql table, that work, but i can
not get this data out the table anymore.

Reproduce code:
---
?php

$dbh = new PDO('pgsql:host=localhost;dbname=test','root','fo0224');

$q = 'SELECT data FROM foobar';
$stmt = $dbh-prepare($q);
if ($stmt) 
{
  $stmt-bindColumn('DATA',$sData);
  if (!$stmt-execute())
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  if (!$stmt-fetch(PDO::FETCH_BOUND))
  {
print_r($stmt-errorInfo());
die('DAMN');
  }
  header('Content-Type: image/jpeg');
  echo $sData;
} else {
  print_r($dbh-errorInfo());
}

?


Table foobar only has a bytea column named data

Expected result:

should display the image

Actual result:
--
the php-process does not do anything, the browser waits for an answer (i
waited 5 minutes, but nothing happened)

-- 
Edit bug report at http://bugs.php.net/?id=35338edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35338r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=35338r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=35338r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=35338r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=35338r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=35338r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=35338r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=35338r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35338r=support
Expected behavior:   http://bugs.php.net/fix.php?id=35338r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=35338r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=35338r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=35338r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35338r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=35338r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=35338r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35338r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35338r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=35338r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35338r=mysqlcfg


#35155 [Csd]: prepared statement with blob field does not work

2005-11-21 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
 Status:   Closed
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5CVS-2005-11-09 (snap)
 Assigned To:  andrey
 New Comment:

Thanks a lot, i tried it now again with the latest cvs and it is
working. I hope 5.1 will be stable soon.
Kind Regards

Florian Engelhardt


Previous Comments:


[2005-11-21 22:11:09] [EMAIL PROTECTED]

Well not bogus. This is fixed in the upcoming 5.1.0 . AFAIK there will
be no release in the 5.0 branch after 5.0.5 where the problem exists.



[2005-11-21 22:06:05] [EMAIL PROTECTED]

Z_STRLEN_PP() macro does not use the strlen() function. It's a macro to
access the real length from the zval** (PP). So, from what I see it
should work correctly. PHP reads the file and is \0 aware so the length
in the zval that represents the string should be ok.
I have done a test and for me it seems to work ok. See the md5() hash
of what's in the column. Just mysql cmdline client does not show the
whole string but stops at the \0. Try with the function LENGTH() and it
will work (shows 8 for me).

mysql create table blob_test (a mediumblob);
Query OK, 0 rows affected (0.19 sec)
-
php -r '
$c=new mysqli(127.0.0.1, root,);
var_dump($c);
$s=$c-prepare(INSERT INTO test.blob_test VALUES(?));
$v=\0bbb;
$s-bind_param(s,$v);
var_dump($s-execute(), $s-execute());'

---

mysql select md5(), md5(\0bbb), md5(a), a from
blob_test\G
*** 1. row ***
 md5(): 74b87337454200d4d33f80c4663dc5e5
md5(\0bbb): f04bbe8400c631e6bab90d30900ccc69
  md5(a): f04bbe8400c631e6bab90d30900ccc69
   a: 
*** 2. row ***
 md5(): 74b87337454200d4d33f80c4663dc5e5
md5(\0bbb): f04bbe8400c631e6bab90d30900ccc69
  md5(a): f04bbe8400c631e6bab90d30900ccc69
   a: 
2 rows in set (0.00 sec)




[2005-11-17 08:33:56] f dot engelhardt at 21torr dot com

Is there someone working on the bug, i havent heard anything for a
couple of days now.



[2005-11-14 12:07:04] f dot engelhardt at 21torr dot com

Note: with the PDO it is working as expectet, but we can not use
software that is still in a beta stadium.



[2005-11-12 01:22:11] [EMAIL PROTECTED]

Georg, see the feedback.



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

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


#35155 [Asn]: prepared statement with blob field does not work

2005-11-14 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
 Status:   Assigned
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5CVS-2005-11-09 (snap)
 Assigned To:  georg
 New Comment:

Note: with the PDO it is working as expectet, but we can not use
software that is still in a beta stadium.


Previous Comments:


[2005-11-12 01:22:11] [EMAIL PROTECTED]

Georg, see the feedback.



[2005-11-11 11:33:32] f dot engelhardt at 21torr dot com

case MYSQL_TYPE_VAR_STRING:
convert_to_string_ex(stmt-param.vars[i]);
stmt-stmt-params[i].buffer = Z_STRVAL_PP(stmt-param.vars[i]);
stmt-stmt-params[i].buffer_length =
strlen(Z_STRVAL_PP(stmt-param.vars[i]));
break;

php-5.0.5/ext/mysqli/mysqli_api.c:574

This line is the problem, you can not use strlen to read the length of
binary data, or this convert_to_string_ex() function destroys the
data.

Kind regards

Florian Engelhardt



[2005-11-11 11:18:27] f dot engelhardt at 21torr dot com

Hello,

i have a hint for you: The size inserted into the database is exactly
the size, that strlen() returns, BUT: strlen stops on  the first \0 and
in a real binary file, this sign can be everywhere, not just at the end.
In your case, i 
found this:

php-5.0.5/ext/mysqli/mysqli_api.c:161

case 's': /* string */
bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING;
bind[ofs].buffer = NULL;
bind[ofs].buffer_length = 0;
bind[ofs].is_null = stmt-param.is_null[ofs];

I tried this, and i found out, that it works with
MYSQL_TYPE_VAR_STRING, but you have to specify the length. If i insert
the right lengt, everything works as expected.

So you just have to define the length for the data that is in the bound
variable.

Kind regards

Florian Engelhardt



[2005-11-11 09:55:55] f dot engelhardt at 21torr dot com

Well, i allready tried this:

?php

mysqli_connect(..);
mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');

$one = 1;
$two = 2;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iis',$one,$two,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

Exaclty the same problem.

Fix it.

Kind Regards

Florian Engelhardt



[2005-11-11 08:51:46] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

from http://www.php.net/mysql_stmt_bind_param

Character Description
b corresponding variable is a blob and will be send in
packages

For sending a blob in packages, you have to use
mysql_stmt_send_long_data. If you don't want to do this (e.g. your data
doesn't need escaping and is  max_allowed_package) use type s
(=string).



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

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


#35155 [Bgs-Opn]: prepared statement with blob field does not work

2005-11-11 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
-Status:   Bogus
+Status:   Open
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5CVS-2005-11-09 (snap)
 Assigned To:  georg
 New Comment:

Well, i allready tried this:

?php

mysqli_connect(..);
mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');

$one = 1;
$two = 2;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iis',$one,$two,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

Exaclty the same problem.

Fix it.

Kind Regards

Florian Engelhardt


Previous Comments:


[2005-11-11 08:51:46] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

from http://www.php.net/mysql_stmt_bind_param

Character Description
b corresponding variable is a blob and will be send in
packages

For sending a blob in packages, you have to use
mysql_stmt_send_long_data. If you don't want to do this (e.g. your data
doesn't need escaping and is  max_allowed_package) use type s
(=string).



[2005-11-09 16:07:10] f dot engelhardt at 21torr dot com

This Problem is very annoying, becouse i am using innodb tables with
foreign key constraints, and if i use mysqli_stmt_send_long_data() for
any of the fields, all the other arent NULL anymore. So my constraint
fails!

Example:
?php

$GLOBALS['CONN'] = mysqli_connect(...);

mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2')
;

$one = NULL;
$two = NULL;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

without mysqli_stmt_send_long_data() i have the problem as described,
and with mysqli_stmt_send_long_data() on the blob field, mysql tells
me, that the constraint gets violated!
This can only happen, if the variables $one and $two are not  NULL.



[2005-11-08 23:28:54] [EMAIL PROTECTED]

Assigned to the maintainer.



[2005-11-08 23:26:59] f dot engelhardt at 21torr dot com

it doesn´t work, but the behavior changed a little:
Every insert without mysqli_stmt_send_long_data()
inserts 0 Bytes into the blob field, with this function
it works as in the other version (5.0.5)



[2005-11-08 17:43:53] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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





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

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


#35155 [Opn]: prepared statement with blob field does not work

2005-11-11 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
 Status:   Open
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5CVS-2005-11-09 (snap)
 Assigned To:  georg
 New Comment:

Hello,

i have a hint for you: The size inserted into the database is exactly
the size, that strlen() returns, BUT: strlen stops on  the first \0 and
in a real binary file, this sign can be everywhere, not just at the end.
In your case, i 
found this:

php-5.0.5/ext/mysqli/mysqli_api.c:161

case 's': /* string */
bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING;
bind[ofs].buffer = NULL;
bind[ofs].buffer_length = 0;
bind[ofs].is_null = stmt-param.is_null[ofs];

I tried this, and i found out, that it works with
MYSQL_TYPE_VAR_STRING, but you have to specify the length. If i insert
the right lengt, everything works as expected.

So you just have to define the length for the data that is in the bound
variable.

Kind regards

Florian Engelhardt


Previous Comments:


[2005-11-11 09:55:55] f dot engelhardt at 21torr dot com

Well, i allready tried this:

?php

mysqli_connect(..);
mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');

$one = 1;
$two = 2;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iis',$one,$two,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

Exaclty the same problem.

Fix it.

Kind Regards

Florian Engelhardt



[2005-11-11 08:51:46] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

from http://www.php.net/mysql_stmt_bind_param

Character Description
b corresponding variable is a blob and will be send in
packages

For sending a blob in packages, you have to use
mysql_stmt_send_long_data. If you don't want to do this (e.g. your data
doesn't need escaping and is  max_allowed_package) use type s
(=string).



[2005-11-09 16:07:10] f dot engelhardt at 21torr dot com

This Problem is very annoying, becouse i am using innodb tables with
foreign key constraints, and if i use mysqli_stmt_send_long_data() for
any of the fields, all the other arent NULL anymore. So my constraint
fails!

Example:
?php

$GLOBALS['CONN'] = mysqli_connect(...);

mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2')
;

$one = NULL;
$two = NULL;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

without mysqli_stmt_send_long_data() i have the problem as described,
and with mysqli_stmt_send_long_data() on the blob field, mysql tells
me, that the constraint gets violated!
This can only happen, if the variables $one and $two are not  NULL.



[2005-11-08 23:28:54] [EMAIL PROTECTED]

Assigned to the maintainer.



[2005-11-08 23:26:59] f dot engelhardt at 21torr dot com

it doesn´t work, but the behavior changed a little:
Every insert without mysqli_stmt_send_long_data()
inserts 0 Bytes into the blob field, with this function
it works as in the other version (5.0.5)



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

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


#35155 [Opn]: prepared statement with blob field does not work

2005-11-11 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
 Status:   Open
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5CVS-2005-11-09 (snap)
 Assigned To:  georg
 New Comment:

case MYSQL_TYPE_VAR_STRING:
convert_to_string_ex(stmt-param.vars[i]);
stmt-stmt-params[i].buffer = Z_STRVAL_PP(stmt-param.vars[i]);
stmt-stmt-params[i].buffer_length =
strlen(Z_STRVAL_PP(stmt-param.vars[i]));
break;

php-5.0.5/ext/mysqli/mysqli_api.c:574

This line is the problem, you can not use strlen to read the length of
binary data, or this convert_to_string_ex() function destroys the
data.

Kind regards

Florian Engelhardt


Previous Comments:


[2005-11-11 11:18:27] f dot engelhardt at 21torr dot com

Hello,

i have a hint for you: The size inserted into the database is exactly
the size, that strlen() returns, BUT: strlen stops on  the first \0 and
in a real binary file, this sign can be everywhere, not just at the end.
In your case, i 
found this:

php-5.0.5/ext/mysqli/mysqli_api.c:161

case 's': /* string */
bind[ofs].buffer_type = MYSQL_TYPE_VAR_STRING;
bind[ofs].buffer = NULL;
bind[ofs].buffer_length = 0;
bind[ofs].is_null = stmt-param.is_null[ofs];

I tried this, and i found out, that it works with
MYSQL_TYPE_VAR_STRING, but you have to specify the length. If i insert
the right lengt, everything works as expected.

So you just have to define the length for the data that is in the bound
variable.

Kind regards

Florian Engelhardt



[2005-11-11 09:55:55] f dot engelhardt at 21torr dot com

Well, i allready tried this:

?php

mysqli_connect(..);
mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');

$one = 1;
$two = 2;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iis',$one,$two,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

Exaclty the same problem.

Fix it.

Kind Regards

Florian Engelhardt



[2005-11-11 08:51:46] [EMAIL PROTECTED]

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php

from http://www.php.net/mysql_stmt_bind_param

Character Description
b corresponding variable is a blob and will be send in
packages

For sending a blob in packages, you have to use
mysql_stmt_send_long_data. If you don't want to do this (e.g. your data
doesn't need escaping and is  max_allowed_package) use type s
(=string).



[2005-11-09 16:07:10] f dot engelhardt at 21torr dot com

This Problem is very annoying, becouse i am using innodb tables with
foreign key constraints, and if i use mysqli_stmt_send_long_data() for
any of the fields, all the other arent NULL anymore. So my constraint
fails!

Example:
?php

$GLOBALS['CONN'] = mysqli_connect(...);

mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2')
;

$one = NULL;
$two = NULL;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

without mysqli_stmt_send_long_data() i have the problem as described,
and with mysqli_stmt_send_long_data() on the blob field, mysql tells
me, that the constraint gets violated!
This can only happen, if the variables $one and $two are not  NULL.



[2005-11-08 23:28:54] [EMAIL PROTECTED]

Assigned to the maintainer.



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

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


#35155 [Asn]: prepared statement with blob field does not work

2005-11-09 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
 Status:   Assigned
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5CVS-2005-11-09 (snap)
 Assigned To:  georg
 New Comment:

This Problem is very annoying, becouse i am using innodb tables with
foreign key constraints, and if i use mysqli_stmt_send_long_data() for
any of the fields, all the other arent NULL anymore. So my constraint
fails!

Example:
?php

$GLOBALS['CONN'] = mysqli_connect(...);

mysqli_select_db(..);

$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2')
;

$one = NULL;
$two = NULL;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;

?

without mysqli_stmt_send_long_data() i have the problem as described,
and with mysqli_stmt_send_long_data() on the blob field, mysql tells
me, that the constraint gets violated!
This can only happen, if the variables $one and $two are not  NULL.


Previous Comments:


[2005-11-08 23:28:54] [EMAIL PROTECTED]

Assigned to the maintainer.



[2005-11-08 23:26:59] f dot engelhardt at 21torr dot com

it doesn´t work, but the behavior changed a little:
Every insert without mysqli_stmt_send_long_data()
inserts 0 Bytes into the blob field, with this function
it works as in the other version (5.0.5)



[2005-11-08 17:43:53] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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





[2005-11-08 17:06:50] f dot engelhardt at 21torr dot com

it seems to work with mysqli_stmt_send_long_data(), but it has to work
without, as the doc says, you only have to use it, if you send data
larger than max_allowed_packet. This value is set to 16M, that data is
only 2mb.

Kind regards



[2005-11-08 17:06:19] [EMAIL PROTECTED]

RTFM:

http://www.php.net/manual/en/function.mysqli-stmt-send-long-data.php



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

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


#35155 [NEW]: prepared statement with blob field does not work

2005-11-08 Thread f dot engelhardt at 21torr dot com
From: f dot engelhardt at 21torr dot com
Operating system: Linux 2.6
PHP version:  5.0.5
PHP Bug Type: MySQLi related
Bug description:  prepared statement with blob field does not work

Description:

Inserting a data into a blob column only inserts some of the data, in most
cases between 1 and 200 Bytes, but not allways the same and never all data
(which is in this case about 2 mb). I also tried it with
mysqli_stmt_send_long_data(), but that was not working either.

The table is as followes:

CREATE TABLE `dbfs_data_chunk` (
  `fileid` smallint(5) unsigned NOT NULL,
  `version` smallint(5) unsigned NOT NULL default '0',
  `data` mediumblob,
  PRIMARY KEY  (`fileid`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

MySQL-Version: 5.0.15

If i do a base64_encode() it works, but this isn´t a solution, only a bad
workaround, which is not acceptable.

I also tried MyISAM, the same result.

Reproduce code:
---
?php

$GLOBALS['CONN'] = mysqli_connect(...);


$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');

$one = 1;
$two = 2;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;


?

Expected result:

Should insert the binary data into the table

Actual result:
--
only 1 to 200 Bytes get inserted.

-- 
Edit bug report at http://bugs.php.net/?id=35155edit=1
-- 
Try a CVS snapshot (php4):   http://bugs.php.net/fix.php?id=35155r=trysnapshot4
Try a CVS snapshot (php5.0): 
http://bugs.php.net/fix.php?id=35155r=trysnapshot50
Try a CVS snapshot (php5.1): 
http://bugs.php.net/fix.php?id=35155r=trysnapshot51
Fixed in CVS:http://bugs.php.net/fix.php?id=35155r=fixedcvs
Fixed in release:http://bugs.php.net/fix.php?id=35155r=alreadyfixed
Need backtrace:  http://bugs.php.net/fix.php?id=35155r=needtrace
Need Reproduce Script:   http://bugs.php.net/fix.php?id=35155r=needscript
Try newer version:   http://bugs.php.net/fix.php?id=35155r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=35155r=support
Expected behavior:   http://bugs.php.net/fix.php?id=35155r=notwrong
Not enough info: 
http://bugs.php.net/fix.php?id=35155r=notenoughinfo
Submitted twice: 
http://bugs.php.net/fix.php?id=35155r=submittedtwice
register_globals:http://bugs.php.net/fix.php?id=35155r=globals
PHP 3 support discontinued:  http://bugs.php.net/fix.php?id=35155r=php3
Daylight Savings:http://bugs.php.net/fix.php?id=35155r=dst
IIS Stability:   http://bugs.php.net/fix.php?id=35155r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=35155r=gnused
Floating point limitations:  http://bugs.php.net/fix.php?id=35155r=float
No Zend Extensions:  http://bugs.php.net/fix.php?id=35155r=nozend
MySQL Configuration Error:   http://bugs.php.net/fix.php?id=35155r=mysqlcfg


#35155 [Bgs-Opn]: prepared statement with blob field does not work

2005-11-08 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
-Status:   Bogus
+Status:   Open
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5.0.5
 New Comment:

it seems to work with mysqli_stmt_send_long_data(), but it has to work
without, as the doc says, you only have to use it, if you send data
larger than max_allowed_packet. This value is set to 16M, that data is
only 2mb.

Kind regards


Previous Comments:


[2005-11-08 17:06:19] [EMAIL PROTECTED]

RTFM:

http://www.php.net/manual/en/function.mysqli-stmt-send-long-data.php



[2005-11-08 15:29:36] f dot engelhardt at 21torr dot com

Description:

Inserting a data into a blob column only inserts some of the data, in
most cases between 1 and 200 Bytes, but not allways the same and never
all data (which is in this case about 2 mb). I also tried it with
mysqli_stmt_send_long_data(), but that was not working either.

The table is as followes:

CREATE TABLE `dbfs_data_chunk` (
  `fileid` smallint(5) unsigned NOT NULL,
  `version` smallint(5) unsigned NOT NULL default '0',
  `data` mediumblob,
  PRIMARY KEY  (`fileid`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

MySQL-Version: 5.0.15

If i do a base64_encode() it works, but this isn´t a solution, only a
bad workaround, which is not acceptable.

I also tried MyISAM, the same result.

Reproduce code:
---
?php

$GLOBALS['CONN'] = mysqli_connect(...);


$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');

$one = 1;
$two = 2;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;


?

Expected result:

Should insert the binary data into the table

Actual result:
--
only 1 to 200 Bytes get inserted.





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


#35155 [Fbk-Opn]: prepared statement with blob field does not work

2005-11-08 Thread f dot engelhardt at 21torr dot com
 ID:   35155
 User updated by:  f dot engelhardt at 21torr dot com
 Reported By:  f dot engelhardt at 21torr dot com
-Status:   Feedback
+Status:   Open
 Bug Type: MySQLi related
 Operating System: Linux 2.6
 PHP Version:  5.0.5
 New Comment:

it doesn´t work, but the behavior changed a little:
Every insert without mysqli_stmt_send_long_data()
inserts 0 Bytes into the blob field, with this function
it works as in the other version (5.0.5)


Previous Comments:


[2005-11-08 17:43:53] [EMAIL PROTECTED]

Please try using this CVS snapshot:

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





[2005-11-08 17:06:50] f dot engelhardt at 21torr dot com

it seems to work with mysqli_stmt_send_long_data(), but it has to work
without, as the doc says, you only have to use it, if you send data
larger than max_allowed_packet. This value is set to 16M, that data is
only 2mb.

Kind regards



[2005-11-08 17:06:19] [EMAIL PROTECTED]

RTFM:

http://www.php.net/manual/en/function.mysqli-stmt-send-long-data.php



[2005-11-08 15:29:36] f dot engelhardt at 21torr dot com

Description:

Inserting a data into a blob column only inserts some of the data, in
most cases between 1 and 200 Bytes, but not allways the same and never
all data (which is in this case about 2 mb). I also tried it with
mysqli_stmt_send_long_data(), but that was not working either.

The table is as followes:

CREATE TABLE `dbfs_data_chunk` (
  `fileid` smallint(5) unsigned NOT NULL,
  `version` smallint(5) unsigned NOT NULL default '0',
  `data` mediumblob,
  PRIMARY KEY  (`fileid`,`version`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

MySQL-Version: 5.0.15

If i do a base64_encode() it works, but this isn´t a solution, only a
bad workaround, which is not acceptable.

I also tried MyISAM, the same result.

Reproduce code:
---
?php

$GLOBALS['CONN'] = mysqli_connect(...);


$s =
file_get_contents('/usr/portage/distfiles/vim-runtime-20050601.tar.bz2');

$one = 1;
$two = 2;

$q = 'INSERT INTO dbfs_data_chunk VALUES (?,?,?)';
$stmt = mysqli_stmt_init($GLOBALS['CONN']);
mysqli_stmt_prepare($stmt,$q);
mysqli_stmt_bind_param($stmt,'iib',$one,$two,$s);
//mysqli_stmt_send_long_data($stmt,2,$s);
mysqli_stmt_execute($stmt);
mysqli_stmt_close($stmt);

exit;


?

Expected result:

Should insert the binary data into the table

Actual result:
--
only 1 to 200 Bytes get inserted.





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