microsoftgraph / microsoftgraph/msgraph-sdk-php

OPCache bug

Abierto
#1,653 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

status:waiting-for-triage type:bug
Lenguaje dominante
PHP
Estrellas
669
Forks
150
Merge medio
15 h 21 min
PR fusionados (30 d)
3

Descripción

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_

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comienza con src/RequestInformation.php en la línea 66 y compara su uso de PhpDoc con AnnotationReader.php de doctrine/annotations en la línea 122. Reproduce la solicitud GET del usuario con opcache.save_comments establecido en 0 y determina después si el SDK puede evitar la ruta de anotación que falla o documentar claramente una solución alternativa compatible.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
php
Área
api
Tipo de issue
Error
Dificultad
4/5
Tiempo estimado
3-5 días
Estado de actividad
Estancado
Claridad
Bastante claro
Aptitud para principiantes
28/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.