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

Error on first test blog... #11

Closed
kershnerd opened this issue Jan 16, 2015 · 12 comments
Closed

Error on first test blog... #11

kershnerd opened this issue Jan 16, 2015 · 12 comments

Comments

@kershnerd
Copy link

I have completed the installation and configuration of Doctrine 2 and created the sql schema and did the crypt step. When I go to my website/blog, I see the that it is routing correctly to an empty blog. Sweet!

I created a test blog entry, a test tag and added the ids of each to the junction table.

When I go to my domain/blog, I get the follow 2 errors (any idea what I might be doing wrong?):

! ) Warning: include(/var/www/module/Application/config/../view/error/about.phtml): failed to open stream: No such file or directory in /var/www/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php on line 506
Call Stack

Time Memory Function Location

1 0.0012 245872 {main}( ) .../index.php:0
2 1.0736 5925496 Zend\Mvc\Application->run( ) .../index.php:26
3 2.0828 10665616 Zend\Mvc\Application->completeRequest( ) .../Application.php:327
4 2.0828 10665696 Zend\EventManager\EventManager->trigger( ) .../Application.php:352
5 2.0828 10665832 Zend\EventManager\EventManager->triggerListeners( ) .../EventManager.php:207
6 2.0829 10667592 call_user_func:{/var/www/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) .../EventManager.php:468
7 2.0829 10667936 Zend\Mvc\View\Http\DefaultRenderingStrategy->render( ) .../EventManager.php:468
8 3.2392 15727168 Zend\EventManager\EventManager->trigger( ) .../DefaultRenderingStrategy.php:113
9 3.2392 15727304 Zend\EventManager\EventManager->triggerListeners( ) .../EventManager.php:207
10 3.2392 15730528 call_user_func:{/var/www/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) .../EventManager.php:468
11 3.2392 15730560 Zend\Mvc\View\Http\DefaultRenderingStrategy->render( ) .../EventManager.php:468
12 3.2392 15730560 Zend\View\View->render( ) .../DefaultRenderingStrategy.php:103
13 3.2395 15731488 Zend\View\View->renderChildren( ) .../View.php:198
14 3.2395 15732504 Zend\View\View->render( ) .../View.php:233
15 3.2396 15733432 Zend\View\Renderer\PhpRenderer->render( ) .../View.php:205

( ! ) Warning: include(): Failed opening '/var/www/module/Application/config/../view/error/about.phtml' for inclusion (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php on line 506
Call Stack

Time Memory Function Location

1 0.0012 245872 {main}( ) .../index.php:0
2 1.0736 5925496 Zend\Mvc\Application->run( ) .../index.php:26
3 2.0828 10665616 Zend\Mvc\Application->completeRequest( ) .../Application.php:327
4 2.0828 10665696 Zend\EventManager\EventManager->trigger( ) .../Application.php:352
5 2.0828 10665832 Zend\EventManager\EventManager->triggerListeners( ) .../EventManager.php:207
6 2.0829 10667592 call_user_func:{/var/www/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) .../EventManager.php:468
7 2.0829 10667936 Zend\Mvc\View\Http\DefaultRenderingStrategy->render( ) .../EventManager.php:468
8 3.2392 15727168 Zend\EventManager\EventManager->trigger( ) .../DefaultRenderingStrategy.php:113
9 3.2392 15727304 Zend\EventManager\EventManager->triggerListeners( ) .../EventManager.php:207
10 3.2392 15730528 call_user_func:{/var/www/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php:468} ( ) .../EventManager.php:468
11 3.2392 15730560 Zend\Mvc\View\Http\DefaultRenderingStrategy->render( ) .../EventManager.php:468
12 3.2392 15730560 Zend\View\View->render( ) .../DefaultRenderingStrategy.php:103
13 3.2395 15731488 Zend\View\View->renderChildren( ) .../View.php:198
14 3.2395 15732504 Zend\View\View->render( ) .../View.php:233
15 3.2396 15733432 Zend\View\Renderer\PhpRenderer->render( ) .../View.php:205

@mamuz
Copy link
Owner

mamuz commented Jan 17, 2015

Hi @kershnerd
your error message is not related to blog module.

Warning: include(/var/www/module/Application/config/../view/error/about.phtml): failed to open stream

You have to fix this first. After that your application is able to show catched exceptions.

@kershnerd
Copy link
Author

I fixed that view error... when I go to /blog/post/1 I get the following error:

Notice: Undefined offset: 0 in /var/www/vendor/mamuz/mamuz-blog/src/MamuzBlog/Crypt/HashIdAdapter.php on line 19

I followed your directions by copying
./vendor/mamuz-blog/config/crypt.local.php.dist
to
./config/autoload/crypt.local.php

... The only other thing I have done was changing the salt value a couple of times. Since then, I have restored back to the original.

Using ZendDeveloperTools, I see that crypt is in the config array:
'crypt' =>
array (size=1)
'hashid' =>
array (size=3)
'sault' => string 'mySecretSault' (length=13)
'minLength' => int 9
'chars' => string 'bcdfghjklmnpqrstvwxyzBCDFGHJKLMNPQRSTVWXYZ1234567890' (length=52)

Any ideas? And thank you so much for the time; I really appreciated it!

@kershnerd
Copy link
Author

Also, /blog gives me a 500 error.

/blog/posts doesn't show me any blogs but I see a clickable tag link. When I click on that tag link, I get another 500 error.

:(

@mamuz
Copy link
Owner

mamuz commented Jan 18, 2015

Notice: Undefined offset: 0 in /var/www/vendor/mamuz/mamuz-blog/src/MamuzBlog/Crypt/HashIdAdapter.php on line 19

Sounds for me that any id to a specific blog entity cannot be read from route.
If you use the out-of-the-box controller MamuzBlog\Controller\PostQueryController you have to dump $encryptedId = $this->params()->fromRoute('id'); in method publishedPostAction.

Be sure your route config is working to get needed params.
When you havent overwrite config provided by the blog module, everything should works.
Or in other words i cannot reproduce it.

Also, /blog gives me a 500 error.

What is the errormessage?

@mamuz
Copy link
Owner

mamuz commented Jan 18, 2015

BTW: i fixed the undefined offset error by checking on existing https://github.com/mamuz/MamuzBlog/releases/tag/1.4.1

@kershnerd
Copy link
Author

When I do a var_dump on $encryptedId from the publishedPostAction (for this route: /blog/post/1), I get 1. Is that action expecting an already encrypted id? I am obviously passing along the actual ID of the blog post.

When I go to /blog and get that 500 error, I am not sure what the error is. I am using all your default config files. I get to the publishedPostsAction and I have pasted a var_dump of $collection below. Something happens after the viewModelFactory()->createFor($collection);

object(Doctrine\ORM\Tools\Pagination\Paginator)[341]
private 'query' =>
object(Doctrine\ORM\Query)[337]
private '_state' => int 2
private '_dql' => string 'SELECT p, t FROM MamuzBlog\Entity\Post p LEFT JOIN p.tags t WHERE p.published = :published ORDER BY p.createdAt DESC' (length=116)
private '_parserResult' => null
private '_firstResult' => int 0
private '_maxResults' => int 2
private '_queryCache' => null
private '_expireQueryCache' => boolean false
private '_queryCacheTTL' => null
private '_useQueryCache' => boolean true
protected 'parameters' =>
object(Doctrine\Common\Collections\ArrayCollection)[339]
private '_elements' =>
array (size=1)
...
protected '_resultSetMapping' => null
protected '_em' =>
object(Doctrine\ORM\EntityManager)[302]
private 'config' =>
object(Doctrine\ORM\Configuration)[147]
...
private 'conn' =>
object(Doctrine\DBAL\Connection)[305]
...
private 'metadataFactory' =>
object(Doctrine\ORM\Mapping\ClassMetadataFactory)[303]
...
private 'unitOfWork' =>
object(Doctrine\ORM\UnitOfWork)[312]
...
private 'eventManager' =>
object(Doctrine\Common\EventManager)[306]
...
private 'proxyFactory' =>
object(Doctrine\ORM\Proxy\ProxyFactory)[315]
...
private 'repositoryFactory' =>
object(Doctrine\ORM\Repository\DefaultRepositoryFactory)[311]
...
private 'expressionBuilder' => null
private 'closed' => boolean false
private 'filterCollection' => null
protected '_hints' =>
array (size=0)
empty
protected '_hydrationMode' => int 1
protected '_queryCacheProfile' => null
protected '_expireResultCache' => boolean false
protected '_hydrationCacheProfile' => null
private 'fetchJoinCollection' => boolean true
private 'useOutputWalkers' => null
private 'count' => null

@mamuz
Copy link
Owner

mamuz commented Jan 18, 2015

You have to request with an encrypted id, something like /blog/post/NZmKqvDnJ, otherwise it's not working. Hidden real id is a security feature here.
When you will use it without encryption, you have to replace the controller with your own.

Route blog without parameters provides you a list of your blog entries, which are flagged as published=1 in your DB . Each entry has an encrypted link inside the display list.
Display list is provided by template MamuzBlog/view/mamuz-blog/post-query/published-posts.phtml

When I go to /blog and get that 500 error, I am not sure what the error is

You should know what is going wrong here. Check your log files. When you have not a log file, then configure your error handling. After that i can support you. Maybe DB connection failed, i dunno.

Check https://github.com/zendframework/ZendSkeletonApplication as an instance to configure a working and usable zf2 application.

@kershnerd
Copy link
Author

Getting closer... here is the error I get when I go to the /blog route:

#0 /var/www/vendor/zendframework/zendframework/library/Zend/ServiceManager/AbstractPluginManager.php(103): Zend\ServiceManager\ServiceManager->get('markdown', true)
#1 /var/www/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(377): Zend\ServiceManager\AbstractPluginManager->get('markdown', NULL)
#2 /var/www/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(396): Zend\View\Renderer\PhpRenderer->plugin('markdown')
#3 /var/www/vendor/mamuz/mamuz-blog/src/MamuzBlog/View/Helper/PostPanelShort.php(36): Zend\View\Renderer\PhpRenderer->__call('markdown', Array)
#4 /var/www/vendor/mamuz/mamuz-blog/src/MamuzBlog/View/Helper/PostPanelShort.php(36): Zend\View\Renderer\PhpRenderer->markdown('This is the des...')
#5 /var/www/vendor/mamuz/mamuz-blog/src/MamuzBlog/View/Helper/PostPanel.php(38): MamuzBlog\View\Helper\PostPanelShort->createContent()
#6 /var/www/vendor/mamuz/mamuz-blog/src/MamuzBlog/View/Helper/PostPanel.php(26): MamuzBlog\View\Helper\PostPanel->render(Object(MamuzBlog\Entity\Post))
#7 [internal function]: MamuzBlog\View\Helper\PostPanel->__invoke(Object(MamuzBlog\Entity\Post))
#8 /var/www/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(399): call_user_func_array(Object(MamuzBlog\View\Helper\PostPanelShort), Array)
#9 /var/www/vendor/mamuz/mamuz-blog/view/mamuz-blog/post-query/published-posts.phtml(7): Zend\View\Renderer\PhpRenderer->__call('postPanelShort', Array)
#10 /var/www/vendor/mamuz/mamuz-blog/view/mamuz-blog/post-query/published-posts.phtml(7): Zend\View\Renderer\PhpRenderer->postPanelShort(Object(MamuzBlog\Entity\Post))
#11 /var/www/vendor/zendframework/zendframework/library/Zend/View/Renderer/PhpRenderer.php(506): include('/var/www/vendor...')
#12 /var/www/vendor/zendframework/zendframework/library/Zend/View/View.php(205): Zend\View\Renderer\PhpRenderer->render(Object(Zend\View\Model\ViewModel))
#13 /var/www/vendor/zendframework/zendframework/library/Zend/View/View.php(233): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#14 /var/www/vendor/zendframework/zendframework/library/Zend/View/View.php(198): Zend\View\View->renderChildren(Object(Zend\View\Model\ViewModel))
#15 /var/www/vendor/zendframework/zendframework/library/Zend/Mvc/View/Http/DefaultRenderingStrategy.php(103): Zend\View\View->render(Object(Zend\View\Model\ViewModel))
#16 [internal function]: Zend\Mvc\View\Http\DefaultRenderingStrategy->render(Object(Zend\Mvc\MvcEvent))
#17 /var/www/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(468): call_user_func(Array, Object(Zend\Mvc\MvcEvent))
#18 /var/www/vendor/zendframework/zendframework/library/Zend/EventManager/EventManager.php(207): Zend\EventManager\EventManager->triggerListeners('render', Object(Zend\Mvc\MvcEvent), Array)
#19 /var/www/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(352): Zend\EventManager\EventManager->trigger('render', Object(Zend\Mvc\MvcEvent))
#20 /var/www/vendor/zendframework/zendframework/library/Zend/Mvc/Application.php(327): Zend\Mvc\Application->completeRequest(Object(Zend\Mvc\MvcEvent))
#21 /var/www/public_html/index.php(17): Zend\Mvc\Application->run()
#22 {main}

@mamuz
Copy link
Owner

mamuz commented Jan 18, 2015

hmm.. this is only the trace..but whats the error message?

@kershnerd
Copy link
Author

File:
/var/www/vendor/zendframework/zendframework/library/Zend/ServiceManager/ServiceManager.php:550
Message:
Zend\View\HelperPluginManager::get was unable to fetch or create an instance for markdown

@mamuz
Copy link
Owner

mamuz commented Jan 18, 2015

I got it. I released a new fixed version: 1.4.2
Markdown module wasnt triggered to be loaded by blog module.
I couldn't reproduce it because another zf2-module loaded it in my environment.

In new release it is working, so you have to update.

Thanks a lot for reporting 👍

@mamuz mamuz added the bug label Jan 18, 2015
@kershnerd
Copy link
Author

That did it! Thanks! Amazing... !

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

No branches or pull requests

2 participants