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

bad pattern on regexp #36

Closed
lorinczelod opened this issue Sep 17, 2015 · 1 comment
Closed

bad pattern on regexp #36

lorinczelod opened this issue Sep 17, 2015 · 1 comment
Labels

Comments

@lorinczelod
Copy link

Hello
the test case:
Tabular Input with kartik-v/yii2-widget-fileinput:

<?= TabularInput::widget([
    'allowEmptyList' => true,
    'models' => $models,
    'attributeOptions' => [
        // ...
    ],
    'columns' => [
        // ...
        [
            'name'  => 'imageFile',
            'title' => 'imageFile',
            'type'  => FileInput::className(),
            'options' => [
                'options' => ['accept' => 'image/*'],
                'pluginEvents' => [
                    'filecleared' => 'function () {
                            console.log('File cleared!);
            }',
                ],
            ],
        ],
    ],
]) ?>

this code generates the next javascript:

jQuery('#item-{multiple-index}-imagefile').fileinput(fileinput_84f9f1b5);
jQuery('#item-{multiple-index}-imagefile').on('filecleared', function () {
    console.log('File cleared');
});

this js code isn't found by this 'if' in BaseRenderer.php:

if (preg_match('/^[^{]+{multiple-index}.*$/', $js) === 1) {

I recommend the m (PCRE_MULTILINE) regexp modifier:

if (preg_match('/^[^{]+{multiple-index}.*$/m', $js) === 1) {

This working for me.

Sincerely, E.

@unclead unclead added the bug label Sep 17, 2015
@unclead
Copy link
Owner

unclead commented Sep 17, 2015

Thx, closed via a0fa5c8

@unclead unclead closed this as completed Sep 17, 2015
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

2 participants