简体   繁体   English

PHP BLOB字段数据与原始数据不同

[英]PHP BLOB Field data different than original data

I have a weird issue when dealing with a BLOG field coming from an iOS NSData source. 在处理来自iOS NSData源的BLOG字段时,我遇到一个奇怪的问题。 I pass it through to a PHP web service. 我将其传递给PHP Web服务。

The original source has a length of 10159. The PHP source has a length of 10159 when it gets to the web service. 原始源的长度为10159。PHP源到达Web服务时的长度为10159。 I enabled General Logging in MYSQL and verified that the prepared statement is actually getting original bytes that were sent from the client. 我在MYSQL中启用了常规日志记录,并验证了准备好的语句实际上正在获取从客户端发送的原始字节。

Here is the PHP code: 这是PHP代码:

//call the stored procedure
$stmt2 = $this->db->prepare("CALL sp_event_master_create(?,?,?,?,?,?,?,?,?,?,?,?, @event_master_id)");
$stmt2->bind_param('sssssssbsssi',   
    $event_name,
    $event_location,
    $mysql_start_date,
    $mysql_end_date,
    $event_website,
    $event_facebook,
    $event_description,
    $event_image,
    $event_contact_name,
    $event_contact_number,
    $event_contact_email,
    $event_app_user_id);

//set the image to be uploaded
$stmt2->send_long_data(7, $event_image);

When I query the BLOB field on the getById web service call, the size returned back to the client has ballooned to 22,325. 当我查询getById Web服务调用上的BLOB字段时,返回给客户端的大小已膨胀至22,325。 The first bytes of the return look nothing like the original bytes sent to the database. 返回的第一个字节看起来与发送到数据库的原始字节完全不同。

I tried to use base64_decode the blob returned but that didn't work. 我尝试使用base64_decode返回的Blob,但是没有用。 I know that I must have a setting incorrectly setup for the field or the database. 我知道我必须为字段或数据库设置了错误的设置。

PHP VERSION : 5.5.3 PHP版本 :5.5.3

MYSQL VERSION : 5.5.34 MYSQL版本 :5.5.34

The issue seems to actually be in RESKIT not in PHP or MYSQL. 问题似乎实际上在RESKIT中,而不是PHP或MYSQL中。 I converted the field to a MEDIUMTEXT and the data that is in the database is correct. 我将该字段转换为MEDIUMTEXT,并且数据库中的数据正确。 I can see on the web service calls that the JSON data matches what was sent. 我可以在Web服务调用上看到JSON数据与发送的数据匹配。

I have posted on the google group for reskit: https://groups.google.com/forum/#!topic/restkit/zMh98jCdGF0 我已经在Google组上发布了reskit: https ://groups.google.com/forum/#! topic / restkit / zMh98jCdGF0

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM