f.haeder.net

Back with updated instance but wrong UTF?

I have successfully updated my instance to latest code and migrated to new config file. But as you can see, the UTF-8 is broken. What can I set here to fix it? The database says "utf8mb4_general_ci".
develop friendica
Can you check in src\Database\DBA.php what charset is actually used for the connection?
Tomorrow more, already 04:33 a.m. here. :-/
Sorry, busy and hot day today. Will attempt it this evening. :)
As configured $charset has value utf8mb4.
Do I have to run queries like this to fix it: UPDATE `item-content` SET `body`= REPLACE(`body`,'ö','?');?
Found a better one:
UPDATE
`item-content`

SET
`body` =
CASE
WHEN CONVERT(CAST(CONVERT(`body` USING latin1) AS BINARY) USING utf8) IS NULL THEN `body`
ELSE CONVERT(CAST(CONVERT(`body` USING latin1) AS BINARY) USING utf8)
END;

Source: stackoverflow
Careful with already converted data, like I had with contact table where all converted uni-code characters had been converted to question marks. I then had to re-fetch all these contacts over the "Advanced" tab, still there are some pending. GNUSocial allows me to refresh contacts through scripts. Maybe a good idea for Friendica as well?
While clicking on "re-fetch contact data" in the "Advanced" tab, I get these E_NOTICE with OStatus contacts:

Notice: Undefined index: body in /var/www/../src/Protocol/OStatus.php on line 1163
Notice: Undefined index: title in /var/www/../src/Protocol/OStatus.php on line 1916
Notice: Undefined index: guid in /var/www/../src/Protocol/OStatus.php on line 1925
Notice: Undefined index: tag in /var/www/../src/Model/Item.php on line 2787
Notice: Undefined index: tag in /var/www/../src/Model/Item.php on line 2796
Notice: Undefined index: attach in /var/www/../src/Protocol/OStatus.php on line 1372


Will prepare a PR for them.
Found a parser error in addons:
PHP Parse error: syntax error, unexpected '}', expecting end of file in ./addons/pumpio/pumpio.php on line 228

Parse error: syntax error, unexpected '}', expecting end of file in ./addons/pumpio/pumpio.php on line 228

Errors parsing ./addons/pumpio/pumpio.php
Branch pumpio/import-curly-braces created, PR is on it's way.
More errors while deleting an item:
Notice: Undefined index: remote in /var/www/../include/items.php on line 357
Notice: Undefined index: confirm in /var/www/../include/items.php on line 368
Notice: Undefined index: canceled in /var/www/../include/items.php on line 391

Yes, some of you may say that I can switch off E_NOTICE but that is causing more trouble than solving it. The best practice in my oppinion is, to get to the root of the cause and not supress errors and warnings.

Only a #fixed #bug is a good bug. :-)
Again, some "downtime" (errors) due to updating my develop branch to latest upstream (= main repository) changes.

Latest develop fails to run SQL update

@Friendica Developers I have an error while the db update was running, Friendica was sending me an email about it.
The friendica developers released update 1274 recently,
but when I tried to install it, something went terribly wrong.
This needs to be fixed soon and I can't do it alone. Please contact a
friendica developer if you can not help me on your own. My database might be invalid.
The error message is
Errors encountered performing database changes: ALTER IGNORE TABLE `item` DROP INDEX `contactid_allowcid_allowpid_denycid_denygid`, DROP INDEX `uid_authorlink`, ...


On console I get this error:
Error 1296 occurred during database update:
Got error 64 'Temp file write failure' from InnoDB


I'm now back at my old commit so the instance can work again.
@Friendica Developers bug develop friendica update
Okay, fixed here. The flooded `/tmp/` has caused this, to less sleep to figure this out by myself ... :-/ Thank you both again! @Hyp??li????e Pet????van (he/him) @Rebeka Catalina
Quick notice: Notice: Undefined index: url in /home/quix0r/NetBeansProjects/friendica/src/Object/Post.php on line 359. Maybe it does not exist at all in item table? @Hyp??li????e Pet????van (he/him) @Michael Vogel or maybe #tpyo ? uri does exist.
Yupp, no url there.
Now, after an update my right-side pane is gone. I found out that a style.css with display:none hid it.
Found a E_NOTICE here: Notice: Undefined index: title in /var/www/../src/Content/Text/BBCode.php on line 565
And another one: Notice: Undefined index: term in /var/www/../mod/filer.php on line 18
And 4 more:
Notice: Undefined property: stdClass::$type in /var/www/../src/Content/OEmbed.php on line 329
Notice: Undefined property: stdClass::$html in /var/www/../src/Content/OEmbed.php on line 169
Notice: Undefined property: stdClass::$type in /var/www/../src/Content/OEmbed.php on line 170
Notice: Undefined property: stdClass::$type in /var/www/../src/Content/OEmbed.php on line 171
Notice: Undefined property: stdClass::$type in /var/www/../src/Content/OEmbed.php on line 205
@Hyp??li????e Pet????van (he/him) Do you have any ideas of fixing them? I would try property_exists() where needed.
empty() or isset() work as well.
I find mine more clear ... ;-)
And I think I remember that it is lesser recommended for properties of stdClass objects.

And yet another E_NOTICE here: Notice: Undefined index: verb in /var/www/../src/Core/NotificationsManager.php on line 281. It origins from the system notification list view (/notifications/system.
@Hyp??li????e Pet????van (he/him) So, how to address this? Normally, I would check if the array element exists and if not, throw an exception. But that seems to be not wanted, it would however make it traceable where the error origins from (xdebug needs to be properly configured).
You really are a Java developer. :-D

I mostly just see if it is critical if a value isn't as expected. And I prefer failing silently - or at least without the danger of data loss.

Paradigms

:-) #Java teaches you to take really good care of your type-hints. But this will now lead away from the original scope of this thread, I guess.
#Java java paradigm php7 strong-types type-hints weak-types
And 2 more E_NOTICE:

Notice: Undefined index: emailcc in /var/www/../mod/item.php on line 192
Notice: Undefined variable: postopts in /var/www/../mod/item.php on line 632
Branch is ready, going to make a PR.
:D I should also fix the 2nd one ...
PR updated (and rebased ... ;) ).
And one more in addons: Notice: Undefined index: allow_api in /var/www/../addon/xmpp/xmpp.php on line 98
And even more while connecting to a #diaspora account:
Notice: Undefined index: cancel in /var/www/../mod/follow.php on line 22
Notice: Undefined index: addr in /var/www/../src/Protocol/Diaspora.php on line 2921
Notice: Undefined index: uprvkey in /var/www/../src/Protocol/Diaspora.php on line 3172
Notice: Undefined index: addr in /var/www/../src/Protocol/Diaspora.php on line 2921
PR #5404 is out to address these.
#xdebug let suppressed warnings/errors scream:
SCREAM:  Error suppression ignored for
Warning: file_get_contents(/../phptmp/friendica/daemon.pid): failed to open stream: No such file or directory in /../friendica/bin/daemon.php on line 67

This whole thing can be done otherwise:
- remove the @ from it
- use file_exists() or is_readable() to check if file exists
- if so, read it, otherwise skip further parts

This leads to better code. In addition to that, maybe this particular thing can be encapsulated away in a class?
So, I think I rewrite this part a bit.
Some more (still there?) while requesting to follow an OStatus account:
Notice: Undefined index: body in /var/www/../src/Protocol/OStatus.php on line 1163
Notice: Undefined index: title in /var/www/../src/Protocol/OStatus.php on line 1916
Notice: Undefined index: guid in /var/www/../src/Protocol/OStatus.php on line 1925
Notice: Undefined index: tag in /var/www/../src/Model/Item.php on line 2787
Notice: Undefined index: tag in /var/www/../src/Model/Item.php on line 2796
Notice: Undefined index: attach in /var/www/../src/Protocol/OStatus.php on line 1372


And one from when the daemon is running:
Notice: Undefined offset: 0 in /../src/Model/GContact.php on line 970
Gee, getting more: ( ! ) Notice: Undefined index: marital in /../mod/profiles.php on line 250 and also later for line 314.
Interesting, that $item has really no element 'body':Image/photo cc !Friendica Developers
:-( Comments are not getting to mentioned forums ... Makes sense, of course. :-) Because the main post is not propagated. cc @Hyp☀️li🌷e Pet🌸van (he/him) @Michael Vogel
Editing a photo causes E_NOTICEs:

Notice: Undefined index: group_allow in /var/www/../mod/photos.php on line 356
Notice: Undefined index: contact_allow in /var/www/../mod/photos.php on line 357
Notice: Undefined index: group_deny in /var/www/../mod/photos.php on line 358
Notice: Undefined index: contact_deny in /var/www/../mod/photos.php on line 359
Another one when I view notifications:
Notice: Undefined index: verb in /var/www/../src/Core/NotificationsManager.php on line 276
Here, $it misses that element.

E_NOTICE in .htconfig.php ?

Hi @Friendica Developers I'm getting this error on my instance (this):

PHP Notice:  Use of undefined constant REGISTER_CLOSED - assumed 'REGISTER_CLOSED' in /var/www/../.htconfig.php on line 38
PHP Stack trace:
PHP   1. {main}() /var/www/../bin/daemon.php:0
PHP   2. include() /var/www/../bin/daemon.php:41


I get this every time I start or stop the daemon (as you can see in backtrace).
@Friendica Developers develop friendica update
Yeah, this is possibly annoying but no critical bug. The daemon is loading the config without having included the boot.php where the constant is defined.
Okay, it always starts and stops, just a bit annoying.

Update of develop branch

Dear @Friendica Developers I have now updated to latest develop code and rebased my branch. There have always been a scripts/dbstructure.php around. How do I now update? The offline documentation does not provide any information about this.
@Friendica Developers develop friendica update
There is the command bin/console dbstructure Maybe that helps?
That must be new then. :-) Thank you, it is now running.
Fixed some issues here, had difference in `composer.lock`, thanks to @Hyp??li????e Pet????van (he/him) for making me aware of it and solving the problem.
And I got this on ./bin/console dbstructure update:

ALTER IGNORE TABLE `gserver` MODIFY `register_policy` tinyint NOT NULL DEFAULT 0 COMMENT '', MODIFY `registered-users` int unsigned NOT NULL DEFAULT 0 COMMENT '', MODIFY `network` char(4) NOT NULL DEFAULT '' COMMENT '', ADD `relay-subscribe` boolean NOT NULL DEFAULT '0' COMMENT 'Has the server subscribed to the relay system', ADD `relay-scope` varchar(10) NOT NULL DEFAULT '' COMMENT 'The scope of messages that the server wants to get', COMMENT = 'Global servers';

Error 1060 occurred during database update:
Duplicate column name 'relay-subscribe'


You may want to split this combined SQL statement into single statements then at least all the other parts will work.
This SQL query was automatically generated by the DBStructure::update process that compares your current database schema with the target Friendica current schema. Basically, the script concluded that your gserver table was missing a column and tried to add it back again. I'm not sure why it doesn't see the current column though. This would be a question for @Michael Vogel, he created the DB update routine.
Splitting it would decrease the performance drastically when adding several fields. You could execute the several queries by hand. Then execute the script again.
Have done it here. I have also updated my instance again because of the #bug with user accounts.
#bug

Local "connect" not working

I think I found a #bug in #friendica, latest develop code. I have rebased my branch to latest changes and revert all of my is_filled_array() changes to dba::is_result().

So what I did was I created an account for my wife and tried to connect to but all I got was a redirect and no entry in table 'intro'. There is also no entry of her account in 'fcontact'.

So what is wrong?
#bug #friendica bug develop friendica
Ah, validate_url() misses to check $h with is_array(). Please try to cherry-pick my latest commits in branch rhaeder-develop (changed develop branch).
Ah, validate_url() misses to check $h with is_array(). Please try to cherry-pick my latest commits in branch rhaeder-develop (changed develop branch).
Later posts Earlier posts