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

Object of class App\View\AppView could not be converted to string #11276

Closed
1 of 3 tasks
patrickquijano opened this issue Oct 5, 2017 · 2 comments
Closed
1 of 3 tasks
Milestone

Comments

@patrickquijano
Copy link

This is a (multiple allowed):

  • bug

  • enhancement

  • feature-discussion (RFC)

  • CakePHP Version: 3.5.3.

  • Platform and Target: Windows 10, PHP 5.6.28, MariaDB 10.1.19

What you did

Added this line in my head tag in the default layout template (Layout/default.ctp):
<title><?= $this->fetch('title'); ?></title>

Added this line in my home template (Pages/home.ctp):
<?= $this->assign('title', __('The quick brown fox.')); ?>

What happened

It's displaying a warning erro:
Warning (4096): Object of class App\View\AppView could not be converted to string [APP/Template\Pages\home.ctp, line 1]

What you expected to happen

No warning/error should show up.

@dereuromark
Copy link
Member

dereuromark commented Oct 5, 2017

You should not be echoing void or chaning methods. In this case

<?php $this->...(); ?>

Would be correct, as <?= ... ?> auto-echos.

@dereuromark dereuromark added this to the 3.5.4 milestone Oct 5, 2017
@patrickquijano
Copy link
Author

My bad. I've been writing and reading codes whole day. Thanks @dereuromark!

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

2 participants