In a site I'm working on, im converting strings to slugs using the answer in this question. It works, but I'm finding there are HUGE memory leak issues. I've done some research and found that this is just currently a bug in PHP.
Are there any alternatives to accomplish something like strings to slug?
EDIT:
There's another interesting angle to this problem. I'm re-developing a scraper that was made using regex
(ugh, i know), so I decided to use DOMDocument / XPath as a solution.
The interesting thing is, the original regex
scrape, also uses the above slugify() function, and there are no memory issues. However, once I setup the DOMDocument scrape, the scrape crashes halfway through and the error is always on the preg_replace()
line in the slugify()
function above.
So despite both scenarios using the exact same slugify() function, only the DOMDocument version crashes on the preg_replace()
line