Calling is_single() outside the loop

At first, you’re calling a WordPress function directly inside a new instance of your class which can lead to a null wp_query state which produces a log when calling your code.

To fix this you should move the call to a place somewhere like the init hook, like this:

class Something() {
    public function __construct() {
        add_action('init', [$this, 'my_func']);
    }
    public function my_func() {
        if ( is_single() ) {
            require_once( '/lib/control.php' );
        }
    }
}

new Something();

Your function will be run after the WordPress initialization is ended and before any headers so, the global $wp_query instance now knows what’s happening.

If the above solution didn’t work for you, You can also try these:

  1. Move your call inside the single.php file of your theme. (easy, messy)
  2. Double check if your single.php file had been wrapped with a loop.

  3. Try to replace is_single method with $wp_query->is_single() and see what happens. (don’t forget to add global $wp_query at the first line of your function)

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)