Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[2022.09] PHP Warnings #11631

Closed
tobiasd opened this issue Jun 11, 2022 · 24 comments
Closed

[2022.09] PHP Warnings #11631

tobiasd opened this issue Jun 11, 2022 · 24 comments
Labels
Milestone

Comments

@tobiasd
Copy link
Collaborator

tobiasd commented Jun 11, 2022

Please report here any PHP Warning message obtained running the 2022.06 stable or 2022.09-dev versions.

Replaces #11217

@tobiasd tobiasd added the Bug label Jun 11, 2022
@tobiasd tobiasd added this to the 2022.09 milestone Jun 11, 2022
@tobiasd tobiasd pinned this issue Jun 11, 2022
@annando
Copy link
Collaborator

annando commented Jul 16, 2022

$ bin/daemon.php start
Starting worker daemon.
Child process started with pid 15922.
PHP Warning:  session_write_close(): Failed to write session data using user defined save handler. (session.save_path: /var/lib/php/sessions) in Unknown on line 0

@annando

This comment was marked as resolved.

@ghost
Copy link

ghost commented Jul 18, 2022

latest dev
[PHP Warning: sem_acquire(): failed to acquire key 0x66032900: Identifier removed in /src/Core/Lock/Type/SemaphoreLock.php on line 65](url)

@nupplaphil
Copy link
Collaborator

latest dev
[PHP Warning: sem_acquire(): failed to acquire key 0x66032900: Identifier removed in /src/Core/Lock/Type/SemaphoreLock.php on line 65](url)

Annoying and hard to reproduce :( it's on my all-time Todo list once it will happen to me as well...

@ghost
Copy link

ghost commented Jul 27, 2022

PHP Warning:  Undefined array key "public" in /src/Model/Contact.php on line 2972
PHP Warning:  Trying to access array offset on value of type bool in /src/Model/Group.php on line 151
PHP Warning:  Trying to access array offset on value of type bool in /src/Model/Group.php on line 155', referer: https://meld.de/contact?nets=feed
PHP Warning:  Undefined array key "public" in /src/Factory/Api/Mastodon/Relationship.php on line 46'
PHP Warning:  Undefined array key "id" in /src/Module/Api/Twitter/Statuses/Destroy.php on line 49

@Quix0r
Copy link

Quix0r commented Jul 28, 2022

1st is because $cdata doesn't exist (PHP's laziness). I fixed it to $contact
2nd is because group_member does not have any records about what $cid says.
3rd is unknown why?
4th is because $cdata is not an array but is continued to use as such. Any ideas here? @annando @tobiasd @MrPetovan
5th is because of direct access to $request array and not over encapsulating method BaseModule::getRequestValue(). I change this, too.

@Quix0r
Copy link

Quix0r commented Jul 28, 2022

Hmm, $request['id'] should be there, right? I mean in 5th one.

Quix0r added a commit to Quix0r/friendica that referenced this issue Jul 28, 2022
- used `$this->getRequestValue($request, 'foo', <bar>)` instead of `$request['foo'] ?? <bar>`
- fixed wrong variable naming
- changed double-quotes to single
- see friendica#11631 (comment)
Quix0r added a commit to Quix0r/friendica that referenced this issue Jul 28, 2022
- used `$this->getRequestValue($request, 'foo', <bar>)` instead of `$request['foo'] ?? <bar>`
- fixed wrong variable naming
- changed double-quotes to single
- see friendica#11631 (comment)
@ghost
Copy link

ghost commented Jul 29, 2022

2022-07-31T04:33:42Z index [WARNING]: E_WARNING: Trying to access array offset on value of type bool {"code":2,"message":"Trying to access array offset on value of type bool","file":"/src/Protocol/Diaspora.php","line":3157} - {"file":"Diaspora.php","line":3157,"function":"sendParticipation","uid":"f5512c","process_id":1163985}

@Quix0r
Copy link

Quix0r commented Jul 29, 2022

PHP Warning: Trying to access array offset on value of type bool in /src/Protocol/Diaspora.php on line 3157'

What code do you have there? Mine:
$owner = User::getOwnerDataById($first_user['uid']);
Which means that $first_user wasn't fetched and DBA::isResult() wasn't invoked to prevent this.

@ghost
Copy link

ghost commented Jul 29, 2022

What code do you have there? Mine:

$owner = User::getOwnerDataById($first_user['uid']);

@Quix0r
Copy link

Quix0r commented Jul 29, 2022

Ah, same here then. @tobiasd @annando @MrPetovan How do we want to handle this? $first_user is false here.

@ghost
Copy link

ghost commented Aug 2, 2022

PHP Warning: sem_acquire(): failed to acquire key 0x66030188: Identifier removed in /src/Core/Lock/Type/SemaphoreLock.php on line 65

@ghost
Copy link

ghost commented Aug 3, 2022

PHP Warning:  Undefined array key "guid" in /src/Model/FContact.php on line 95
PHP Warning:  Undefined array key "request" in /src/Model/FContact.php on line 109
PHP Warning:  Undefined array key "nick" in /src/Model/FContact.php on line 110
PHP Warning:  Undefined array key "addr" in /src/Model/FContact.php on line 111
PHP Warning:  Undefined array key "guid" in /src/Model/FContact.php on line 112
PHP Warning:  Undefined array key "batch" in /src/Model/FContact.php on line 113
PHP Warning:  Undefined array key "notify" in /src/Model/FContact.php on line 114
PHP Warning:  Undefined array key "poll" in /src/Model/FContact.php on line 115
PHP Warning:  Undefined array key "confirm" in /src/Model/FContact.php on line 116
PHP Warning:  Undefined array key "alias" in /src/Model/FContact.php on line 117
PHP Warning:  Undefined array key "pubkey" in /src/Model/FContact.php on line 118'

@ghost

This comment was marked as resolved.

@Quix0r
Copy link

Quix0r commented Aug 4, 2022

For the last one, I find a possible place, where $item was loaded but not with the said missing field private and I make a PR for it.

@Quix0r
Copy link

Quix0r commented Aug 4, 2022

PHP Warning:  Undefined array key "guid" in /src/Model/FContact.php on line 95
...

For these cases, I would love to add an InvalidArgumentException being thrown when the said array is missing. PHP doesn't render a backtrace if only an E_NOTICE occurs but with a thrown exception it does.

@ghost
Copy link

ghost commented Aug 5, 2022

PHP Warning: sem_acquire(): failed to acquire key 0x66030188: Identifier removed in /src/Core/Lock/Type/SemaphoreLock.php on line 65

@ghost
Copy link

ghost commented Aug 13, 2022

Latest dev and geting a lot of these after the lastest gitpull

PHP Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: number of bound variables does not match number of tokens in /src/Database/Database.php on line 592

@Quix0r
Copy link

Quix0r commented Aug 13, 2022

@copiis I'm not sure where this should come from as Database.php on line 592 is not the cause.

@ghost
Copy link

ghost commented Aug 13, 2022

They are comming every time the worker runns

@Quix0r
Copy link

Quix0r commented Aug 13, 2022

For $this in static context I have a fix up. -> #11843

@AlfredSK
Copy link

PHP Warning: Header may not contain more than a single header, new line detected in .../src/Core/System.php on line 492

2022.09-rc

@MrPetovan
Copy link
Collaborator

Hmm, this will be moved to the 2023.01 version Warning thread.

@AlfredSK
Copy link

Yep, I was late. :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants