Skip to content

Conversation

@carcinocron
Copy link

This is wrong:

The following example creates a `@datetime($var)` directive which simply calls `->format()` on `$var`:

    Blade::extend(function($view, $compiler)
    {
        $pattern = $compiler->createMatcher('datetime');

        return preg_replace($pattern, '$1<?php echo $2->format('m/d/Y H:i'); ?>', $view);
    });

This has 2 errors in it:

  1. 'm/d/Y H:i' isn't properly escaped.
  2. @datetime($var) becomes ($var)->format() and crashes instead of $var->format()

Previous discussion: laravel/framework#4770

@carcinocron
Copy link
Author

I have no idea how to fix part 2.

@GrahamCampbell
Copy link
Contributor

Please pull to an earlier branch than the master.

@carcinocron
Copy link
Author

  1. This is only half a bugfix
  2. I have no idea how to do that.

@GrahamCampbell
Copy link
Contributor

You'd have to start again on the 4.2 or 4.1 branch, and make a new pull.

@carcinocron
Copy link
Author

is this correct? #836

@GrahamCampbell
Copy link
Contributor

Looks good. Better close this pull now. Thanks. :)

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

Successfully merging this pull request may close these issues.

2 participants