ID:               47982
 Updated by:       paj...@php.net
 Reported By:      markac at home dot pl
-Status:           Open
+Status:           Feedback
-Bug Type:         PDO related
+Bug Type:         MySQL related
 Operating System: XP
 PHP Version:      5.2CVS-2009-04-16 (snap)
-Assigned To:      
+Assigned To:      mysql
 New Comment:

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 the script requires a 
database to demonstrate the issue, please make sure it creates 
all necessary tables, stored procedures etc.

Please avoid embedding huge scripts into the report.

and mysql != PDO



Previous Comments:
------------------------------------------------------------------------

[2009-04-16 08:50:30] markac at home dot pl

Sorry, replace $avatar to $user->avatar from all. Function argument is
an object $user, 'avatar' and 'id' is properties.

------------------------------------------------------------------------

[2009-04-16 08:46:49] markac at home dot pl

Description:
------------
PDO adding extra bytes (F3 F3 F3 F3) to begining binary data.

I'm use SOAP extension to retrieving data from client. When I save data
to file or using MySQL directly, all is ok. When I use PDO to store the
same data to column (MySQL), PDO adding extra data and image is broken.

Reproduce code:
---------------
$server = new SoapServer('file.wsdl', array('cache_wsdl' =>
WSDL_CACHE_NONE)); 

/* Connect to an ODBC database using driver invocation */
$dsn = 'mysql:dbname=db;host=localhost;charset=UTF-8';
$user = 'root';
$password = '';
        

$pdo = new PDO($dsn, $user, $password);
$pdo->exec('SET CHARACTER SET utf8');

        
    //NOT WORK! Adding Image is broken
    $sth = $pdo->prepare('UPDATE users SET 
      avatar = :avatar
      WHERE id = :id
    '); 
    
    //$avatar is server function argument. See
$server->addFunction('UpdateUser);
    $sth->bindParam(':avatar', $avatar, PDO::PARAM_LOB);
    $sth->bindParam(':id', $user->id, PDO::PARAM_INT);

    return $sth->execute();

    //THIS WORK!
    file_put_contents('image.jpg', $user->avatar);
    
    /* AND THIS WORK!
    mysql_query('update users set avatar = "' .
addslashes($user->avatar) . '" where id = ' . $user->id);
    */    




  $server->addFunction('UpdateUser);
  $server->handle();
  
Sorry for my english.



------------------------------------------------------------------------


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

Reply via email to