Update Blob results in PHP Fatal error: Uncaught Error: Object of class <formname>_ini could not be converted to string

I have an ‘Image (Database)’ type field ( mySql data type LONG BLOB) - field name is ‘imageBlob’. When I add an image to the row and click save, the app hangs on ‘processing’ (ajax). When I checked the apache2 error.log I found the error at the end of this post. The following is the offending line (generated by SC, within function nm_acessa_banco(), just underneath the set of statements around $this->Db->Execute($comando) which updates the rest of the row):

$_SESSION[‘scriptcase’][‘sc_sql_ult_comando’] = “UpdateBlob($this->Ini->nm_tabela,
\“imageBlob\”, $this->imageblob, \“id = $this->id&\”)”;

This error does not occur in my dev environment (MacOS), but the error does occur when deployed to my 64bit Ubuntu test server (not sure if that makes a difference).

If I edit the file and comment out this line (not sure of the implications of doing this) the row saves successfully.

Happy to be told I am doing something wrong, but it looks like a bug to me.


Apache Error Log Entry:

[Fri Aug 21 23:23:05.262410 2020] [php7:error] [pid 979] [client] PHP Fatal error: Uncaught Error: Object of class form_member_profile_ini could not be converted to string in /var/www/html/ontrax/prof-form-profile/form_member_profile_apl.php:8521\nStack trace:\n#0 /var/www/html/ontrax/prof-form-profile/form_member_profile_apl.php(1814): form_member_profile_apl->nm_acessa_banco()\n#1 /var/www/html/ontrax/prof-form-profile/index.php(14310): form_member_profile_apl->controle()\n#2 /var/www/html/ontrax/prof-form-profile/form_member_profile_sajax.php(122): ajax_form_member_profile_submit_form()\n#3 /var/www/html/ontrax/prof-form-profile/index.php(13454): sajax_handle_client_request()\n#4 {main}\n thrown in /var/www/html/ontrax/prof-form-profile/form_member_profile_apl.php on line 8521, referer:

Just adding a comment to let Devs know I can create this problem at will. It occurs on every image database blob field across my solution. It is a massive nuisance. Right now, every time I deploy to test (several times a week) I have to go into every source file that updates one of these fields and comment out these lines - it takes me over an hour.

If the Dev team, or the community, can come up with some find / sed command line that I can run that will comment-out all the appropriate lines, I’d really appreciate it. I am just not good enough at these utils, reg expressions and pattern matching to do this myself.

Any workarounds appreciated.

I am not sure if I have the same problem. My forms with longblob (image (database)) fields no longer save the images without error messages, after this the application not longer works(hanging), but only in production. This works perfectly in the development environment!

Yep… exact same problem here. I am 95% sure it is a bug.

Here is my (very inconvenient) work around.

  1. After deployment, open the _apl.php file associated with the problem app in your editor of choice.
  2. Search the file for this text… ‘UpdateBlob($this->Ini->nm_tabela’.
  3. It will not be the first hit, but about 7 lines down you’ll find a line that looks like this…

$_SESSION[‘scriptcase’][‘sc_sql_ult_comando’] = “UpdateBlob($this->Ini->nm_tabela, \”<your_field_name>\", $this-><your_field_name>, \“id = $this->id\”)";

  1. This doesn’t look to do anything functional, but sets up a session variable that obvious provides some kind of trace for the actual UpdateBlob command (next line). Comment out this line.

  2. Repeat for all subsequent Image (Database) BLOBS.

  3. Save file.

Retry. It works for me. Unfortunately I have about 10 different apps that deal with these fields. So every deployment I have to go through this process for each file. Hopefully a bug fix comes soon.

Good Luck.

Any news about this bug. Hey SC, that’s not a pillipalli bug, please fix it fast.

I have about 10 apps in my project which suffer from this problem. I was tired of editing out the offending lines each time I did a deployment. The following perl script automates commenting out the lines that causes the error - there are no apparent operational side effects that I have found so far. To be clear, this is NOT a solution - just a workaround. The following is provided on an “all care no responsibility” basis - please use at your own risk.

Save the Example 1 PERL script into a file, (bloberrcommentout.pl). Save the Example 2 shell script (which runs the PERL script after making a backup) into a file (fixfile). Then execute the shell script as follows:

sudo ./fixfile <full_qualified_app_name>_mob_apl.php
sudo ./fixfile <full_qualified_app_name>_apl.php

Don’t forget to run it for both the mobile and non-mobile versions of the _apl.php file.

# EXAMPLE 1 - Begin PERL Script
use strict;
use warnings;
while() {
print “// $" if ($ =~ /$SESSION[‘scriptcase’][‘sc_sql_ult_comando’] = "UpdateBlob($this->Ini->nm_tabela/);
print "$
” if ($_ !~ /$_SESSION[‘scriptcase’][‘sc_sql_ult_comando’] = "UpdateBlob($this->Ini->nm_tabela/);
# END PERL Script

# EXAMPLE 2 - Shell Script to Execute PERL Script
if [ “$#” -lt “1” ]
echo “Arguments missing.”
echo “Usage: fixfile <input_file>”
TODAY=date '+%Y%m%d_%H%M%S';
echo “— Create backup…”
sudo cp $1 $1.bak_$TODAY
echo “— Creating output…”
sudo ./bloberrcommentout.pl <$1.bak_$TODAY >$1
# END Shell Script

Apologies - When I pasted in the scripts they did not format well above. No indenting.

Near 5 Month later, any news about this issue?

I have not updated to the current release yet - things seem to be more buggy than the release I am on. But I do keep checking the bug list for any sign it might be fixed, but I have not seen anything yet. I get the sense that they prioritise bug fixes for those on paid support plans and do not pay much attention to anything else, including this bug list. But I might be surprised one day.


Got first from PHP 7.4.14 to PHP 7.1.33 and then to PHP 7.3.26. Both attempts were successful. Only under 7.4.14 does it not work. The error can be reproduced!