hookpress icon indicating copy to clipboard operation
hookpress copied to clipboard

changing the deprecated ereg() function to preg_match()

Open XPERTPCNET opened this issue 8 years ago • 5 comments

When adding a Webhook, no field items are displaying after selecting actions or filters .

The following error is logged:

PHP Fatal error: Uncaught Error: Call to undefined function ereg() in /path/wp-content/plugins/hookpress/services.php:13

This was this fix: // changing the deprecated ereg() function to preg_match() from: if (ereg('[A-Z]+',$arg))
to: if (preg_match('/[A-Z]+/',$arg))

XPERTPCNET avatar Jun 05 '16 22:06 XPERTPCNET

Hello @mitcho , do you think you will merge the PR for PSR compatibility? If not, we will have to consider to fork the project. What do you think @oltodo and @XPERTPCNET ?

michaelperrin avatar Oct 14 '16 15:10 michaelperrin

I would like to know as well. For php7 not only ereg() is deprecated, also split(). I forked the project and wanted to PR as well.

Willemdumee avatar Oct 21 '16 15:10 Willemdumee

@Willemdumee Maybe you should open an other PR with your additional changes. If @mitcho doesn't merge it, your repository could become the "official" fork, but unfortunately installing the plugin with WP CLI would install the non-forked version...

michaelperrin avatar Nov 09 '16 16:11 michaelperrin

@mitcho any chance of this merging? The plugin is broken on PHP 7.

neiltron avatar Feb 24 '17 15:02 neiltron

From: if (ereg('Opera(https://cdn.freshdesignweb.com/| )([0-9].[0-9]{1,2})', $HTTP_USER_AGENT, $log_version))

To: if (preg_match('/Opera(https://cdn.freshdesignweb.com/| )([0-9].[0-9]{1,2})/', $HTTP_USER_AGENT, $log_version)) I changed like this but error happend, what is solution?

mobilewebguru avatar Apr 15 '19 13:04 mobilewebguru