I can't seem to get global user function calls to work from namespaces
in the latest 5.3 snaps. This is on Win XP SP2 using Apache 2.2.8 and
the php5apache2_2.dll. Example:
global_file.php
require 'namespace_file.php';
function globalFunc() {
'Global Called!';
}
TestNS::callGlobalFunc();
namespace_file.php
namespace TestNS;
function callGlobalFunc() {
::globalFunc();
}
Hi!
I can't seem to get global user function calls to work from namespaces
in the latest 5.3 snaps. This is on Win XP SP2 using Apache 2.2.8 and
the php5apache2_2.dll. Example:global_file.php
require 'namespace_file.php';
function globalFunc() {
'Global Called!';
}
TestNS::callGlobalFunc();namespace_file.php
namespace TestNS;
function callGlobalFunc() {
::globalFunc();
}
Tried this code (adding echo before 'Global Called!' so that it would
actually output something) - works just fine.
Stanislav Malyshev, Zend Software Architect
stas@zend.com http://www.zend.com/
(408)253-8829 MSN: stas@zend.com
Stanislav Malyshev wrote:
Hi!
Tried this code (adding echo before 'Global Called!' so that it would
actually output something) - works just fine.
I noticed that error yesterday when I was testing on another computer.
It did work on this computer. I'll have to go back today to the first
computer and do some checking.
Basically, I'm making a system to integrate with forum software,
including phpBB3. I was trying to call their add_log function from a
namespace > class > method of mine. It seemed if I called it from the
global space it worked, but not from the namespace. Not sure what was
going on but I'll try to do further checking. Is there anything I could
look at to help troubleshoot this? Thanks
Stanislav Malyshev wrote:
Hi!
Tried this code (adding echo before 'Global Called!' so that it would
actually output something) - works just fine.
I noticed that error yesterday when I was testing on another computer.
It did work on this computer. I'll have to go back today to the first
computer and do some checking.
Basically, I'm making a system to integrate with forum software,
including phpBB3. I was trying to call their add_log function from a
namespace > class > method of mine. It seemed if I called it from the
global space it worked, but not from the namespace. Not sure what was
going on but I'll try to do further checking. Is there anything I could
look at to help troubleshoot this? Thanks
Don't you forget the "echo"?
Dmitry.
Ryan Panning wrote:
I can't seem to get global user function calls to work from namespaces
in the latest 5.3 snaps. This is on Win XP SP2 using Apache 2.2.8 and
the php5apache2_2.dll. Example:global_file.php
require 'namespace_file.php';
function globalFunc() {
'Global Called!';
}
TestNS::callGlobalFunc();namespace_file.php
namespace TestNS;
function callGlobalFunc() {
::globalFunc();
}