Skip to content
This repository has been archived by the owner on Jan 29, 2020. It is now read-only.

v3 only: Unknown Notices from ClassScanner #67

Open
aight8 opened this issue Jun 22, 2016 · 2 comments
Open

v3 only: Unknown Notices from ClassScanner #67

aight8 opened this issue Jun 22, 2016 · 2 comments

Comments

@aight8
Copy link

aight8 commented Jun 22, 2016

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
        ]
    ]
];
@aight8 aight8 changed the title Unknown Notices from ClassScanner v3: Unknown Notices from ClassScanner Jun 22, 2016
@aight8 aight8 changed the title v3: Unknown Notices from ClassScanner v3 only: Unknown Notices from ClassScanner Jun 22, 2016
@alex-oleshkevich
Copy link

alex-oleshkevich commented Aug 15, 2016

@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

@weierophinney
Copy link
Member

This repository has been closed and moved to laminas/laminas-code; a new issue has been opened at laminas/laminas-code#26.

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

No branches or pull requests

3 participants