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

preg_match(): No ending delimiter '/' found #6

Open
rubenheymans opened this issue Oct 23, 2014 · 9 comments
Open

preg_match(): No ending delimiter '/' found #6

rubenheymans opened this issue Oct 23, 2014 · 9 comments

Comments

@rubenheymans
Copy link

When I add the first image, I get this error

 in C:\wamp\www\www.vangompelrenette.be\vendor\costa-rico\yii2-images\models\Image.php at line 64
55565758596061626364656667686970717273        ]);
    }
    */

    public function clearCache(){
        $subDir = $this->getSubDur();

        $dirToRemove = $this->getModule()->getCachePath().DIRECTORY_SEPARATOR.$subDir;

        if(preg_match('/'.preg_quote($this->modelName, '/').DIRECTORY_SEPARATOR, $dirToRemove)){
            BaseFileHelper::removeDirectory($dirToRemove);

        }

        return true;
    }

    public function getExtension(){
        $ext = pathinfo($this->getPathToOrigin(), PATHINFO_EXTENSION);
@CostaRico
Copy link
Owner

Try to exchange

 if(preg_match('/'.preg_quote($this->modelName, '/').DIRECTORY_SEPARATOR, $dirToRemove))

to

 if(preg_match('/'.preg_quote($this->modelName, '/').DIRECTORY_SEPARATOR.'/', $dirToRemove))

And I'll fix it soon in repo.

Thx a lot.

@rubenheymans
Copy link
Author

thanks

@CostaRico
Copy link
Owner

Is it works?

@rubenheymans
Copy link
Author

I just removed the line but I'll try this on monday

@rubenheymans
Copy link
Author

this is not working, same error

@mertergun
Copy link

Any progress? Because I am facing the same problem right now:

PHP Warning 'yii\base\ErrorException' with message 'preg_match(): No ending delimiter '/' found'

in ......\vendor\costa-rico\yii2-images\models\Image.php:39

PS: Only if the server is running on windows

@rubenheymans
Copy link
Author

yes windows is the issue, DIRECTORY_SEPARATOR should be a /, not a \
I think web dirs should always just use a /, not DIRECTORY_SEPARATOR constant

@rubenheymans
Copy link
Author

if(preg_match('/'.preg_quote($this->modelName, '/').'/', $dirToRemove)) (not tested)

@mertergun
Copy link

Thank you for dealing with this. And also I think there is a smilar issue at Image::getPath() which causes errors on windows

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

3 participants