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

ErrorException (E_NOTICE) Undefined index: function #244

Closed
Nuranto opened this issue Jun 7, 2019 · 6 comments
Closed

ErrorException (E_NOTICE) Undefined index: function #244

Nuranto opened this issue Jun 7, 2019 · 6 comments

Comments

@Nuranto
Copy link

Nuranto commented Jun 7, 2019

vendor/sentry/sentry/src/Stacktrace.php

$functionName = sprintf('%s::%s', $backtraceFrame['class'], $backtraceFrame['function']);

The (stupid) error (which I get with sentry disabled) was :

 FatalErrorException (E_UNKNOWN)
Switch statements may only contain one default clause

Just a switch with 2 default:

@stayallive
Copy link
Collaborator

Hey @Nuranto could you show us a little more specific when this occurs and on what PHP version you are running we cannot seem to reproduce it on our side?

@Nuranto
Copy link
Author

Nuranto commented Jun 12, 2019

PHP 7.3.5

:./current# composer show | grep sentry
sentry/sdk                             2.0.3              This is a metapackage shipping sentry/sentry with a re...
sentry/sentry                          2.1.0              A PHP SDK for Sentry (http://sentry.io)
sentry/sentry-laravel                  1.0.2              Laravel SDK for Sentry (https://sentry.io)

This time, it happenned because I had two default: case in a switch. But it happenned already before on different errors. I will log it here next time it happens.

@stayallive
Copy link
Collaborator

Thanks! It will help if we have a reproducible case to see why this is happening!

@Nuranto
Copy link
Author

Nuranto commented Jun 12, 2019

Just tried to reproduce with double default in a switch in a controller, but I can't reproduce. So it is clearly not error-related.
I will try to give you more data.

@Nuranto
Copy link
Author

Nuranto commented Jun 12, 2019

Ok, I found a way to reproduce :

<?php

namespace App;

class Toto {
    public function toto() {
        switch('toto') {
                default:
                default:
            }
    }
}

and inside a blade view :

@php $toto = new \App\Toto(); @endphp

@stayallive
Copy link
Collaborator

stayallive commented Jun 14, 2019

@Nuranto many thanks for giving us this case, it seems related to xdebug (which was the missing link in our tests).

We're tracking a fix here: getsentry/sentry-php#823, so I'll close this one.

Many thanks for giving us a reproducible case!

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

No branches or pull requests

2 participants