microsoftgraph / microsoftgraph/msgraph-sdk-php

OPCache bug

Offen
#1,653 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

status:waiting-for-triage type:bug
Vorherrschende Sprache
PHP
Sterne
669
Forks
150
Ø Merge
15 Std. 21 Min.
Gemergte PRs (30 T.)
3

Beschreibung

Describe the bug

Hi,

I'm using your library for Microsoft SSO. I only need to fetch basic user information like: getId, getMail, getGivenName, getSurname, and getUserPrincipalName. I’m doing this with the following script:

However, the doctrine/annotations library recently fixed a bug that affects our integration: https://github.com/doctrine/annotations/pull/446/files

I’m using OPCache, so option opcache.save_comments with the flag value set as 0. So while you are using PhpDoc I'm getting error from: https://github.com/doctrine/annotations/blob/2.0.x/lib/Doctrine/Common/Annotations/AnnotationReader.php#L122

Expected behavior

The only place where PhpDoc data is read is here: https://github.com/microsoft/kiota-abstractions-php/blob/main/src/RequestInformation.php#L66 - and microsoft/kiota-abstractions-php is a dependency of microsoftgraph/msgraph-sdk-php-core.

The dependency chain is quite large, but it seems that in my case, I don’t have any query parameters - and those are likely required for this issue to occur.

How can I work around this problem, aside from enabling comments in the cache?

How to reproduce

Set option opcache.save_comments with the flag value as 0

$tokenRequestContext = new AuthorizationCodeContext(
    tenantId: $config['tenant'],
    clientId: $config['clientId'],
    clientSecret: $config['clientSecret'],
    authCode: $params[self::PARAM_IN_CODE],
    redirectUri: $config['redirectUri'],
);

$graphServiceClient = new GraphServiceClient($tokenRequestContext, $config['scopes']);

$user = $graphServiceClient->me()->get()->wait();

$userData = [
    'id' => $user->getId(),
    'userPrincipalName' => $user->getUserPrincipalName(),
    'userEmail' => $user->getMail(),
    'userFirstName' => $user->getGivenName(),
    'userLastName' => $user->getSurname(),
];

// ...
SDK Version

2.25.0

Latest version known to work for scenario above?

No response

Known Workarounds

No response

Debug output
Click to expand log ```
</details>


### Configuration

_No response_

### Other information

_No response_

Beitragsleitfaden

Beitragsleitfaden öffnen

Erste Schritte

  1. Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
  3. Forke das Repository und arbeite in einem Branch.
  4. Öffne einen Pull Request, der die Issue-Nummer nennt.

Rechercherichtung

Beginne mit src/RequestInformation.php in Zeile 66 und vergleiche dessen PhpDoc-Verwendung mit doctrine/annotations' AnnotationReader.php in Zeile 122. Reproduziere die GET-Anfrage des Benutzers mit opcache.save_comments auf 0 gesetzt und ermittle anschließend, ob das SDK den fehlschlagenden Annotation-Pfad vermeiden oder einen unterstützten Workaround eindeutig dokumentieren kann.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
php
Bereich
api
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
28/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.