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

Exception when running blog compile #4

Closed
RWOverdijk opened this issue Jan 29, 2013 · 21 comments
Closed

Exception when running blog compile #4

RWOverdijk opened this issue Jan 29, 2013 · 21 comments
Milestone

Comments

@RWOverdijk
Copy link

I've added this module to composer.json and installed. Then, I created data/posts and data/blog. Both have writing and reading access for www. I've copied the sample-post.php to data/posts and then ran php ./public/index.php blog compile. The following was my output:

rwoverdijk$ php ./public/index.php blog compile
Compiling and sorting entriesPHP Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler/Listener/Archives.php on line 28
PHP Stack trace:
PHP 1. {main}() /Library/WebServer/Documents/spxbeta.dev/public/index.php:0
PHP 2. Zend\Mvc\Application->run() /Library/WebServer/Documents/spxbeta.dev/public/index.php:12
PHP 3. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php:297
PHP 4. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
PHP 5. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 6. Zend\Mvc\DispatchListener->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 7. Zend\Mvc\Controller\AbstractController->dispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php:113
PHP 8. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php:107
PHP 9. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
PHP 10. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 11. Zend\Mvc\Controller\AbstractActionController->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 12. PhlyBlog\CompileController->compileAction() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php:88
PHP 13. PhlyBlog\Compiler->compile() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/CompileController.php:233
PHP 14. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler.php:85
PHP 15. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
PHP 16. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
PHP 17. PhlyBlog\Compiler\Listener\Archives->onCompileEnd() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464

Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler/Listener/Archives.php on line 28

Call Stack:
0.0002 226160 1. {main}() /Library/WebServer/Documents/spxbeta.dev/public/index.php:0
0.0351 3092120 2. Zend\Mvc\Application->run() /Library/WebServer/Documents/spxbeta.dev/public/index.php:12
0.0359 3118688 3. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php:297
0.0359 3118688 4. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
0.0360 3120448 5. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0360 3120480 6. Zend\Mvc\DispatchListener->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0445 4247760 7. Zend\Mvc\Controller\AbstractController->dispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/DispatchListener.php:113
0.0445 4248480 8. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractController.php:107
0.0445 4248480 9. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
0.0490 4637040 10. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0490 4637072 11. Zend\Mvc\Controller\AbstractActionController->onDispatch() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0490 4637296 12. PhlyBlog\CompileController->compileAction() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/Mvc/Controller/AbstractActionController.php:88
0.0930 5529872 13. PhlyBlog\Compiler->compile() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/CompileController.php:233
0.0932 5540944 14. Zend\EventManager\EventManager->trigger() /Library/WebServer/Documents/packages/PhlyBlog/src/PhlyBlog/Compiler.php:85
0.0932 5541160 15. Zend\EventManager\EventManager->triggerListeners() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:208
0.0933 5543224 16. call_user_func() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464
0.0933 5543256 17. PhlyBlog\Compiler\Listener\Archives->onCompileEnd() /Library/WebServer/Documents/spxbeta.dev/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:464

@e-belair
Copy link

👍

@RWOverdijk
Copy link
Author

This is 7 months old. Doubt that it will ever be looked at :) I've started working on my own blog a while back. There seems to be no interest, bit it's pretty far along already.

@e-belair
Copy link

ok, i have the same problem and worse, the blogs files are not written into public/blog ....
So, glad for you :) i'll follow your project too ^^

@weierophinney
Copy link
Contributor

I have looked at it; I just haven't been able to reproduce it. :-/

@e-belair
Copy link

Did you try with a fresh install ?
This is what i did:
cloning the project (via composer)
copied config from doc into autoload/
create data/posts/test-de-post.php (copied from sample)
and executed php public/index.php blog compile -a

@e-belair
Copy link

i almost found the problem :)
I deleted the config i pasted from doc and just renamed data/post to data/blog
then i made php public/index.php blog compile -a
Everything working fine now!
So i think the sample config into the doc contain error(s)

@jackdpeterson
Copy link

I'm able to reproduce the same issue.
Here's how I got there:

  1. Create a new Zend Framework 2 project in Zend Studio
  2. Download module as zip file from github. Extract into modules/PhlyBlog
  3. create directories data/{blog|posts}
  4. download PhlyCommon module.
  5. paste in configuration from readme.md + add in an extra ")" on line 200 (in readme.md) to fix the parse error into config/autoload/module.blog.config.global.php.
  6. Add PhlyBlog and PhlyCommon to config/application.config.php
  7. copy sample-post.php into data/blog AND data/posts as per Manuscle's attempt above.
  8. deploy to local Zend Server.
  9. update composer and run composer install (I didn't fiddle with my local php includes yet)
  10. run cmd (Windows 8) and CD to the zend server application path && php public/index.php blog compile -a
    Output:

c:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\SomeBlogProject\1.0.0>php public/index.php blog compile -a
Compiling and sorting entries
Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in C:\Program Files (x86)\Zend\ZendServer\data\apps\http__default__\0\SomeBlogProject\1.0.0\module\PhlyBlog\src\PhlyBlog\Compiler\Listener\Archives.php on line 28

@weierophinney
Copy link
Contributor

@jackdpeterson Did you try the changes @manuscle reported? It doesn't sound like it...

@weierophinney
Copy link
Contributor

@RWOverdijk I'm re-opening, as, at the minimum, there is a documentation issue that needs to be resolved.

@weierophinney weierophinney reopened this Sep 3, 2013
@RWOverdijk
Copy link
Author

Fair enough :)

@e-belair
Copy link

@weierophinney is the 'entries_url_template', by_year_url_template, by_month_url_template and by_day_url_template are really used into your module?

@e-belair e-belair mentioned this issue Sep 18, 2013
@jackdpeterson
Copy link

@weierophinney , @manuscle I've tried manuscle's updated readme example, as well as deleting the autoload configuration file and renaming the directory as well. Also re-attempted installing using composer method. No such luck.

When I do a var_dump of the $e->getEvent() in Compiler\Listener\Archives->onCompileEnd() it's saying NULL instead of finding any posts.

@e-belair
Copy link

@jackdpeterson be carefull, the end of the sample example (the 'di' part ) is optional.
Can you try without any config file? It should work by using the PlyBlog module config.

@jackdpeterson
Copy link

My Solution! ^/ ...

  1. re-run composer's install (looks like I had something wonky on my end)
  2. set configuration as follows:

return array(
'blog' => array(
'posts_path' => 'content/posts/',
),

);

  1. re-run.

@e-belair
Copy link

good :)

@pavkatar
Copy link
Contributor

pavkatar commented Feb 7, 2014

I had the problem too and the solution was to change the author in the post entity, because it was not validated by the authorFilter. Also I've fork the project with a little update, which will throw an exception if the post is invalid and will show you where is the problem :) https://github.com/pavkatar/PhlyBlog/commits?author=pavkatar

@weierophinney
Copy link
Contributor

Can you submit that as a pull request, please?
On Feb 7, 2014 9:03 AM, "Pavel Nikolov" [email protected] wrote:

I had the problem too and the solution was to change the author in the
post entity, because it was not validated by the authorFilter. Also I've
fork the project with a little update, which will throw an exception if the
post is invalid and will show you where is the problem :)
https://github.com/pavkatar/PhlyBlog/commits?author=pavkatar


Reply to this email directly or view it on GitHubhttps://github.com//issues/4#issuecomment-34438520
.

@vrkansagara
Copy link
Contributor

vrkansagara commented Oct 12, 2015

$ php public/index.php blog compile -a
Compiling and sorting entries............................................................................................................[ DONE ]
Compiling entries======================================================================

The application has thrown an exception!

Zend\View\Exception\RuntimeException

Zend\View\View::render: no renderer selected!

/home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-view/src/View.php:178
#0 /home/vallabh/git/vrkansagara.in/vendor/phly/phly-blog/src/PhlyBlog/Compiler/Listener/Entries.php(76): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#1 /home/vallabh/git/vrkansagara.in/vendor/phly/phly-blog/src/PhlyBlog/Compiler/Listener/Entries.php(50): PhlyBlog\Compiler\Listener\Entries->createEntries()
#2 /home/vallabh/git/vrkansagara.in/vendor/phly/phly-blog/src/PhlyBlog/CompileController.php(251): PhlyBlog\Compiler\Listener\Entries->compile()
#3 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-mvc/src/Controller/AbstractActionController.php(82): PhlyBlog\CompileController->compileAction()
#4 [internal function]: Zend\Mvc\Controller\AbstractActionController->onDispatch(Object(Zend\Mvc\MvcEvent))
#5 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#6 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#7 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php(118): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#8 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-mvc/src/DispatchListener.php(93): Zend\Mvc\Controller\AbstractController->dispatch(Object(Zend\Console\Request), Object(Zend\Console\Response))
#9 [internal function]: Zend\Mvc\DispatchListener->onDispatch(Object(Zend\Mvc\MvcEvent))
#10 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-eventmanager/src/EventManager.php(444): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#11 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-eventmanager/src/EventManager.php(205): Zend\EventManager\EventManager->triggerListeners('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#12 /home/vallabh/git/vrkansagara.in/vendor/zendframework/zend-mvc/src/Application.php(314): Zend\EventManager\EventManager->trigger('dispatch', Object(Zend\Mvc\MvcEvent), Object(Closure))
#13 /home/vallabh/git/vrkansagara.in/public/index.php(38): Zend\Mvc\Application->run()

#14 {main}

Previous Exception(s):

any one have any idea that what's wrong here.
Thanks.

[Solutions 👍 ]
I have to add prepareCompilerView inside the Module.php and write custom view strategy for it.

@istian
Copy link

istian commented Apr 19, 2016

having same issue.
used module.config.php as is, run php public/index.php blog compile -a.

Catchable fatal error: Argument 1 passed to iterator_to_array() must implement interface Traversable, null given in C:\Users\foobar\Development\php\myZf2Test\vendor\phly\phly-blog\src\PhlyBlog\Compiler\Listener\Archives.php on line 28

also, running php public/index.php blog compile with or without flags gives this:

Compiling and sorting entries..........................................................................................................................[ DONE ]

but then, no directory written in public folder.

@vrkansagara
Copy link
Contributor

Hey @istian can you look into the blog post file if there is any html entities have not closed properly than fix it first.

@vrkansagara
Copy link
Contributor

Hi ! All commenters ,

After working so much long time on this library , I have figured out that how it's work. Please feel free to ask me direct regarding this library.
Thanks.

@weierophinney weierophinney added this to the 2.0.0 milestone Oct 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants