Skip to content

Commit 59750b8

Browse files
authored
Merge pull request facebookarchive#599 from voku/autoload_polyfills
fixed issue#598
2 parents 535eb8a + 40252bf commit 59750b8

File tree

4 files changed

+13
-1
lines changed

4 files changed

+13
-1
lines changed

src/Facebook/autoload.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
throw new Exception('The Facebook SDK requires PHP version 5.4 or higher.');
3333
}
3434

35+
if (defined('FACEBOOK_SDK_POLYFILLS_LOADED') === false) {
36+
require_once __DIR__ . 'polyfills.php';
37+
}
38+
3539
/**
3640
* Register the autoloader for the Facebook SDK classes.
3741
*

src/Facebook/polyfills.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
*
2323
*/
2424

25+
define('FACEBOOK_SDK_POLYFILLS_LOADED', 1);
26+
2527
/**
2628
* @see https://github.com/sarciszewski/php-future/blob/master/src/Security.php#L37-L51
2729
*/

tests/FacebookTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,12 @@ class FacebookTest extends \PHPUnit_Framework_TestCase
4141
'app_secret' => 'foo_secret',
4242
];
4343

44+
public function testLoadPolyfills()
45+
{
46+
$this->assertEquals(true, defined('FACEBOOK_SDK_POLYFILLS_LOADED'));
47+
$this->assertEquals(1, FACEBOOK_SDK_POLYFILLS_LOADED);
48+
}
49+
4450
/**
4551
* @expectedException \Facebook\Exceptions\FacebookSDKException
4652
*/

tests/HttpClients/FacebookStreamHttpClientTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public function testCanSendNormalRequest()
9595
$this->streamMock
9696
->shouldReceive('getResponseHeaders')
9797
->once()
98-
->andReturn(explode("\n", trim($this->fakeRawHeader)));
98+
->andReturn(explode(PHP_EOL, trim($this->fakeRawHeader)));
9999
$this->streamMock
100100
->shouldReceive('fileGetContents')
101101
->once()

0 commit comments

Comments
 (0)