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

Segfault accurs on large sql dump when preg_replace working #458

Closed
sectus opened this issue Jul 25, 2013 · 15 comments

Comments

Projects
None yet
4 participants
@sectus
Copy link
Contributor

commented Jul 25, 2013

This complex pattern raise error on large sql dump.

Is this preg_replace necessary?

@Ragazzo

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2013

known php bug, you can increase pcre.recursion_limit on your system.

@sectus

This comment has been minimized.

Copy link
Contributor Author

commented Jul 25, 2013

@Ragazzo, I know it. Also I know that is not php bug.

What is the point of this replacing? Is it necessasry?

@Ragazzo

This comment has been minimized.

Copy link
Contributor

commented Jul 25, 2013

removing comments and other, and preparing sql to be executed by strings i think.

@tiger-seo

This comment has been minimized.

Copy link
Member

commented Jul 25, 2013

Actually it's PHP bug. My workaround was mysql.exe :-)

@sectus

This comment has been minimized.

Copy link
Contributor Author

commented Jul 25, 2013

What is the issue without this preg_replace?

Every issue told me that is not php bug. But it does not matter.

@tiger-seo

This comment has been minimized.

Copy link
Member

commented Jul 25, 2013

AFAIU, it's being used to sanitize sql string

@sectus

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2013

It is not nessasary to parse sql manually (even comments only) i think. Mysql could do it better : )

Also commit didn't help me.

@tiger-seo

This comment has been minimized.

Copy link
Member

commented Jul 26, 2013

What do you mean by mysql does it better?

@sectus

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2013

There is no needing to remove comments. Mysql could successfully ignore them.

@DavertMik

This comment has been minimized.

Copy link
Member

commented Jul 26, 2013

large sql dump

MySQL can do this better.

mysql test_db < test_dump.sql

Codeception is not a dumpter itself, it has just a simple workaround to load dumps. For faster and more stable loading of dumps you should load them via mysql or mysqldump. It's much faster then parse them via PHP.

@DavertMik DavertMik closed this Jul 26, 2013

@sectus

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2013

  1. I could not understand why are you want to delete comments from dump.
  2. Where i could place exec('mysql db < dump.sql') to achieve same result?
@tiger-seo

This comment has been minimized.

Copy link
Member

commented Jul 26, 2013

Where i could place exec('mysql db < dump.sql') to achieve same result?

turn off db populate in codeception.yml and run mysql.exe before running the tests

@Ragazzo

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2013

@sectus about dump loading, if you use some fw, for example Yii, you can simply create custom-helper and in beforeSuite event load dump like Yii::app()->db->createCommand($sqlDump)->execute().
Thats all.

@sectus

This comment has been minimized.

Copy link
Contributor Author

commented Jul 26, 2013

@tiger-seo , i need load dump before every test.
@Ragazzo , sure, i can load dump in my application...

But, can use explain me why you need to remove comments?

@Ragazzo

This comment has been minimized.

Copy link
Contributor

commented Jul 26, 2013

it was only a guess based on that regular expression, as you see, other developers explained why this thing is there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.