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

v3 only: Unknown Notices from ClassScanner #26

Closed
weierophinney opened this issue Dec 31, 2019 · 2 comments
Closed

v3 only: Unknown Notices from ClassScanner #26

weierophinney opened this issue Dec 31, 2019 · 2 comments
Assignees
Labels
Bug Something isn't working Won't Fix This will not be worked on
Milestone

Comments

@weierophinney
Copy link
Member

Notice: Undefined offset: 585 in /var/www/.../current/vendor/zendframework/zend-code/src/Scanner/ClassScanner.php on line 939

Notice: Uninitialized string offset: 1 in /var/www/.../current/vendor/zendframework/zend-code/src/Scanner/ClassScanner.php on line 971

Notice: Uninitialized string offset: 1 in /var/www/.../current/vendor/zendframework/zend-code/src/Scanner/ClassScanner.php on line 971

Notice: Uninitialized string offset: 1 in /var/www/.../current/vendor/zendframework/zend-code/src/Scanner/ClassScanner.php on line 971

Notice: Undefined offset: 267 in /var/www/.../current/vendor/zendframework/zend-code/src/Scanner/ClassScanner.php on line 939

BTW: I just added a new directory to scan via the great zend annotation module but it fails with a fatal exception in the ClassScanner. Is it possible to add more accurate error messages which make it simple to locate the file?

edit:

  • Error when folder contains empty file.
  • Notice:
Notice: Uninitialized string offset: 1 in /var/www/.../current/vendor/zendframework/zend-code/src/Scanner/TokenArrayScanner.php on line 582 Notice: Uninitialized string offset: 1 in /var/www/.../current/vendor/zendframework/zend-code/src/Scanner/TokenArrayScanner.php on line 582

when you have a php config file with ::class syntax:

<?php

return [
    'xxxx' => [
        'zzzz' => [
            'source_class' => \Test\Bla::class
        ]
    ]
];

Originally posted by @aight8 at zendframework/zend-code#67

@weierophinney
Copy link
Member Author

@aight8, @weierophinney, this issue is when the scanner scans plain php file with "::class" token.
for example:

<?php

use App\Controller\ErrorController;

return [
    'controllers' => [
        'invokables' => [
            ErrorController::class => ErrorController::class,
        ],
        'aliases' => [
            'ErrorController' => ErrorController::class
        ]
    ],
    'zf_annotation' => [
        'scan_modules' => ['App'],
    ],
];

will fail as it recognizes "::class" as "class Name".
as a temporary solution, do not use that and change your code to, eg.:

<?php

return [
    'controllers' => [
        'invokables' => [
            'App\Controller\ErrorController' => 'App\Controller\ErrorController',
        ],
        'aliases' => [
            'ErrorController' => 'App\Controller\ErrorController'
        ]
    ],
    'zf_annotation' => [
        'scan_modules' => ['App'],
    ],
];

image

image


Originally posted by @alex-oleshkevich at zendframework/zend-code#67 (comment)

@Ocramius
Copy link
Member

No longer needed as per #58

@Ocramius Ocramius added Bug Something isn't working Won't Fix This will not be worked on labels Nov 30, 2020
@Ocramius Ocramius self-assigned this Nov 30, 2020
@Ocramius Ocramius added this to the 4.0.0 milestone Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Won't Fix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants