googleapis / googleapis/google-api-php-client-services

Autoload is hitting disc and checking file_exists on an non existing file

Open
#6,303 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
PHP
Stars
1.3k
Forks
320
Avg merge
2h 32m
Merged PRs (30d)
193

Description

#### Environment details

- OS: FreeBSD
- PHP version: 8.3.6
- Package name and version: v0.396.0

#### Description

In https://github.com/googleapis/google-api-php-client-services/blob/main/autoload.php#L5 there is a check for `src/Google/Client.php` file existence.

A fix to remove this is suggested in https://github.com/googleapis/google-api-php-client-services/pull/4199, but now I think we can even remove entire file and tag a new version.

In https://github.com/googleapis/google-api-php-client-services/pull/4199#issuecomment-2118174969 it is suggested to update the code to use the new namespaces, which we did, and we are still seeing accessing non existing file:

```
90220 php-fpm RET __getcwd 0
90220 php-fpm CALL access(0x73a8f48,0)
90220 php-fpm NAMI "/www/sites/.../vendor/google/apiclient-services/../apiclient/src/Google/Client.php"
90220 php-fpm RET access -1 errno 2 No such file or directory
```

Which is totally expected since `autoload.php` contains:

```php
file_exists(__DIR__ . '/../apiclient/src/Google/Client.php')
```

#### Steps to reproduce

1. `include autoload.php`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.