Bug #76559 [Com]: curl_*() fail to fall back to global namespace if called from within a namespac

From: Date: Sun, 01 Jul 2018 17:07:31 +0000
Subject: Bug #76559 [Com]: curl_*() fail to fall back to global namespace if called from within a namespac
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-216062@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76559&edit=1 ID: 76559 Comment by: teo8976 at gmail dot com Reported by: teo8976 at gmail dot com Summary: curl_*() fail to fall back to global namespace if called from within a namespac Status: Open Type: Bug Package: cURL related Operating System: debian PHP Version: 5.6.36 Block user comment: N Private report: N New Comment: I see that the error message is fixed in PHP 7. Cool. Previous Comments: ------------------------------------------------------------------------ [2018-07-01 17:05:30] teo8976 at gmail dot com Sorry, my report is bullshit because PHP gives confusing error messages. Actually my issue was that I was calling curl_reset() which only exists starting from 5.5, but I'm on PHP 5.4. The real issue here is that the error message should read "call to undefined function curl_reset()" rather than "call to undefined function NameSpace\\curl_reset()". ------------------------------------------------------------------------ [2018-07-01 15:20:17] danack@php.net Please can you check you have curl installed. I can't reproduce your issue, except when curl is not installed. ------------------------------------------------------------------------ [2018-07-01 15:13:21] teo8976 at gmail dot com Description: ------------ When you call curl_init() or any other curl_xxx() function from within a namespace, without prepending a "\" (which you are not supposed to have to do), you get this stupid error: Call to undefined function Whatever\\The\\Current\\NameSpace\\Is\\curl_init() Test script: --------------- namespace TestNameSpace; class TestClass { function testMethod() { curl_init(); echo "OK"; } } $t=new TestClass(); $t->testMethod(); Expected result: ---------------- OK Actual result: -------------- Call to undefined function TestNameSpace\\curl_reset() ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76559&edit=1

« previous php.bugs (#216062) next »