Support

Home Forums Event Espresso Premium Warnings for empty needle when table prefix is set to an empty string

Warnings for empty needle when table prefix is set to an empty string

Posted: November 4, 2015 at 4:53 am

Viewing 2 reply threads


Richard Sweeney

November 4, 2015 at 4:53 am

I’m working on a project where the table prefix is set to an empty string. This causes 2 warnings where strpos is used to check the table prefix.

PHP Warning: strpos(): Empty needle in /srv/www/pedagog.malmo/wp-content/plugins/event-espresso-core-reg/core/db_models/helpers/EE_Table_Base.php on line 32

and

PHP Warning: strpos(): Empty needle in /srv/www/pedagog.malmo/wp-content/plugins/event-espresso-core-reg/core/helpers/EEH_Activation.helper.php:55

It’s an edge case admittedly, I’ve never seen an install with an empty prefix, but it can happen! It’s also an easy fix – do you guys have your code on github? I can always submit a pull request!


Richard Sweeney

November 4, 2015 at 4:55 am

In /srv/www/pedagog.malmo/wp-content/plugins/event-espresso-core-reg/core/db_models/helpers/EE_Table_Base.php

if( strpos( $table_name, $prefix ) !== 0 ) {

could simply be changed to

if( ! empty( $prefix ) && strpos( $table_name, $prefix ) !== 0 ) {


Josh

  • Support Staff

November 4, 2015 at 7:53 am

Thanks Richard. I’ve made a ticket for the developers to fix this. Since you asked about if EE is on github, it is! We welcome pull requests.

https://github.com/eventespresso/event-espresso-core

Viewing 2 reply threads

The support post ‘Warnings for empty needle when table prefix is set to an empty string’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso