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

The PDF can't be built #202

Open
ghost opened this issue Jun 5, 2020 · 4 comments
Open

The PDF can't be built #202

ghost opened this issue Jun 5, 2020 · 4 comments
Labels

Comments

@ghost
Copy link

ghost commented Jun 5, 2020

I tried to build the PDF of the book but got the following error:

vendor/bin/apidoc guide --template=pdf --interactive=0 ../book/ ./pdf PHP Fatal error: Cannot use 'Object' as class name as it is reserved in /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Object.php on line 77 PHP Stack trace: PHP 1. {main}() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2-apidoc/apidoc:0 PHP 2. require() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2-apidoc/apidoc:33 PHP 3. spl_autoload_call() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/Yii.php:27 PHP 4. yii\BaseYii::autoload() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/Yii.php:27 PHP 5. include() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/BaseYii.php:288 PHP 6. spl_autoload_call() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/di/Container.php:98 PHP 7. yii\BaseYii::autoload() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/di/Container.php:98 PHP 8. include() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/BaseYii.php:288 PHP 9. spl_autoload_call() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Component.php:98 PHP 10. yii\BaseYii::autoload() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Component.php:98

Fatal error: Cannot use 'Object' as class name as it is reserved in /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Object.php on line 77

Call Stack: 0.0002 359864 1. {main}() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2-apidoc/apidoc:0 0.0009 364416 2. require('/home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/Yii.php') /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2-apidoc/apidoc:33 0.0018 430872 3. spl_autoload_call() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/Yii.php:27 0.0018 430920 4. yii\BaseYii::autoload() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/Yii.php:27 0.0022 432328 5. include('/home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/di/Container.php') /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/BaseYii.php:288 0.0022 432328 6. spl_autoload_call() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/di/Container.php:98 0.0022 432376 7. yii\BaseYii::autoload() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/di/Container.php:98 0.0026 434376 8. include('/home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Component.php') /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/BaseYii.php:288 0.0026 434376 9. spl_autoload_call() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Component.php:98 0.0026 434416 10. yii\BaseYii::autoload() /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Component.php:98

make: *** [Makefile:6: book.pdf] Fehler 255

I just followed the steps of the provided readme.md file.

I am using Arch Linux and use the current version of php, composer and texlive in the repository.

@samdark
Copy link
Owner

samdark commented Jun 5, 2020

Fatal error: Cannot use 'Object' as class name as it is reserved in /home/sebastian/Downloads/yii2-cookbook-master/build/vendor/yiisoft/yii2/base/Object.php on line 77

What version of Yii do you have?

@ghost
Copy link
Author

ghost commented Jun 5, 2020

I can't really tell from the composer.json file of the project, but the changelog of the yii package goes up to version 2.0.10, so i guess this is the installed version. Is there a better way to get the version of the installed Yii framework?

Edit: The composer.lock file says version 2.0.10 is installed.

@samdark
Copy link
Owner

samdark commented Jun 5, 2020

You need at least 2.0.13 to use it with PHP 7.

@ghost
Copy link
Author

ghost commented Jun 5, 2020

I could get it to work, but there were some steps needed beforehand:

  1. Install the php-mcrypt extension as Yii2 needs it
  2. Update the composer.json to the following:
{
    "require": {
        "yiisoft/yii2": "~2.0.35",
        "yiisoft/yii2-apidoc": "~2.1.0",
        "bower-asset/jquery": "~3.4.1"
    },
    "repositories": [
        {
            "type": "composer",
            "url": "https://asset-packagist.org"
        }
    ]
}

After that i can run make but i still get an error:

vendor/bin/apidoc guide --template=pdf --interactive=0 ../book/ ./pdf
Updating cross references and backlinks... done.
Searching files to process... done.
Rendering markdown files: 35% (17/48) ETA: n/a   Error: array_unique() expects parameter 1 to be array, null given
make: *** [Makefile:6: book.pdf] Fehler 1

I am using Arch Linux with PHP 7.4 by the way.

@samdark samdark added the bug label Jun 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant