File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44- host and proxy parameter have to be set before calling geocode(). Values are now
55 stricter. In the last 30 days no customer used either option.
66- Explicitly enforce SSL certificate verification in both CURL and fopen.
7- - Add proxy support to fopen fallback
7+ - Proxy now requires CURL extension; raises explicit error with fopen fallback
88- Fix stream context not being passed to file_get_contents
99
10103.3.4 -- Mon Dec 15 2025
Original file line number Diff line number Diff line change @@ -83,6 +83,9 @@ protected function getJSON($query)
8383 $ ret = $ this ->getJSONByCurl ($ query );
8484 return $ ret ;
8585 } elseif (ini_get ('allow_url_fopen ' )) {
86+ if ($ this ->proxy ) {
87+ throw new \Exception ('Proxy support requires the CURL extension ' );
88+ }
8689 $ ret = $ this ->getJSONByFopen ($ query );
8790 return $ ret ;
8891 } else {
@@ -92,18 +95,12 @@ protected function getJSON($query)
9295
9396 protected function getJSONByFopen ($ query )
9497 {
95- $ httpOptions = [
96- 'user_agent ' => $ this ->user_agent ,
97- 'timeout ' => $ this ->timeout
98- ];
99- if ($ this ->proxy ) {
100- $ httpOptions ['proxy ' ] = $ this ->proxy ;
101- $ httpOptions ['request_fulluri ' ] = true ;
102- }
103-
10498 $ context = stream_context_create (
10599 [
106- 'http ' => $ httpOptions ,
100+ 'http ' => [
101+ 'user_agent ' => $ this ->user_agent ,
102+ 'timeout ' => $ this ->timeout
103+ ],
107104 'ssl ' => [
108105 'verify_peer ' => true ,
109106 'verify_peer_name ' => true
Original file line number Diff line number Diff line change @@ -83,7 +83,11 @@ public function testProxy()
8383 }
8484 // https://opencagedata.com/api#testingkeys
8585 $ geocoder = new Geocoder ('6d0e711d72d74daeb2b0bfd2a5cdfdba ' );
86- $ geocoder ->setProxy ($ proxy );
86+ try {
87+ $ geocoder ->setProxy ($ proxy );
88+ } catch (\Exception $ e ) {
89+ $ this ->markTestSkipped ('PROXY environment variable is not a valid proxy URL: ' . $ proxy );
90+ }
8791 $ query = "82 Clerkenwell Road, London " ;
8892 $ result = $ geocoder ->geocode ($ query );
8993
You can’t perform that action at this time.
0 commit comments