tamagokun / pomander-wordpress

Wordpress tasks for use with Pomander
http://ripeworks.com/pomander/wordpress.html
MIT License
36 stars 5 forks source link

PHP >=5.5 deprecates the /e modifier for preg_replace #14

Closed tcavalli closed 11 years ago

tcavalli commented 11 years ago

PHP >=5.5 deprecates the /e modifier for preg_replace, preg_replace_callback should be used instead

Hi,

I recently started working at LevelSet Solutions where I understand you started developing pomander. Today I ran into an issue with PHP 5.5 and preg_replace using the /e modifier. I have error_reporting set to E_ALL in php.ini as is recommended for a development environment, which caused 'pom setup' to fail. I tracked it down to pomander-wordpress/lib/taks.php:82, so I wrote an equivalent preg_replace_callback to replace the preg_replace using the /e modifier and then pom setup succeeded.

Anyway, just wanted to contribute that change.

tamagokun commented 11 years ago

Greetings! Thanks for the contribution.

Everything looks good, but could you replace create_function with a closure? create_function uses eval and is usually slower and in the global scope.

tamagokun commented 11 years ago

Thank you!

tcavalli commented 11 years ago

No problem, glad to help!

Take care