Scout24 / restapi-php-sdk

SDK für PHP-Entwickler um die Arbeit mit der API von ImmobilienScout24 zu vereinfachen. Über die API erhält man Ergebnislisten, Objektdaten, uvm. von ImmobilienScout und kann diese Daten inhherhalb seines Webservice integrieren. Die Dokumentation zum SDK findet man unter https://github.com/Immocaster/php-sdk/wiki.
65 stars 45 forks source link

session_start(); Notice #38

Open s4shi87 opened 8 years ago

s4shi87 commented 8 years ago

Wenn das Projekt schon die Session per session_start(); gestartet hat, dann kommt eine Notice Meldung, weil in /Immobilienscout/Rest.php in Zeile 2 die Session erneut gestartet wird.

Notice: A session had already been started - ignoring session_start()
in vendor/immocaster/php-sdk/Immocaster/Immobilienscout/Rest.php at line 2

Es ist zwar nur eine Notice, aber bitte beheben ... oder ein Workaround vorschlagen :)

apfelbox commented 8 years ago

This makes it impossible to use this API with any existing framework, as they do their own session management, which breaks if this library just globally starts the session.

jan-koch commented 8 years ago

There might be a way to integrate this with WordPress.

I think this code snippet helps: function register_session(){ if( !session_id() ) session_start(); } add_action('init','register_session');

Just tested it in a flat WP installation where I integrated this API as a plugin. With this code in the main plugin file, I don't get any "headers already sent" messages and the API returns region data, all properties for an account, and the other demo function calls seem to work as well.

Without the snippet I do get the warnings - API works too though.

Not sure how this affects compatibility to other plugins with session handling!