Re: namespace trouble

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Yeah. Andy has it covered. The notice is just telling you that you have set a value for a variable that is not previously declared. PHP is generous enough to define it on the fly and make it's best guess as to the type but it does want you to know it's not prescribed form. You'll either have to get in the habit of declaring variables or turn that level of error reporting on/off. Regardless of what you have in the php.ini file you can temporarily change it on a script by script basis with the "ini_set ('error_reporting', E_whatever);" and "ini_set ('display_errors', n);" directives in the scripts.

On May 31, 2007, at 9:22 AM, Andy Stratton wrote:

Try this...

<?php

$example = "php variable test";

PrintExample();

function PrintExample(){

global $example;	
echo "$example";	

}

?>

--
Andy Stratton
Software/Network Engineer
COMPASS Information Systems, Inc.
www.compassinfo.net

(410) 923-6300 office
(410) 923-2820 fax
(443) 623-6835 mobile

-----Original Message-----
From: Pascal Desroche [mailto:pascal@xxxxxxx]
Sent: Thursday, May 31, 2007 2:14 AM
To: Andy Stratton
Cc: php-install@xxxxxxxxxxxxx
Subject: Re:  namespace trouble

Yes Anddy, i did this to get every kind of info i could. i just don't
understand why this

<?php

$example = "php variable test";

PrintExample();

function PrintExample(){
	
echo "$example";	

}

?>


Notice: Undefined variable example





Andy Stratton a écrit :
This might have something to do with your 'error_reporting' configuration option if it is giving you a Notice... try suppressing the notices by taking out the E_NOTICE or putting a ~ in front of it to turn it off...

error_reporting  =  E_ALL & ~E_NOTICE

Or if you don't need (or want) the errors/notices, just set display_errors = Off.

Hope this saves you further compiling, etc.

--
Andy Stratton
Software/Network Engineer
COMPASS Information Systems, Inc.
www.compassinfo.net

(410) 923-6300 office
(410) 923-2820 fax
(443) 623-6835 mobile

-----Original Message-----
From: news [mailto:news@xxxxxxxxxxxxx] On Behalf Of pascal desroche
Sent: Wednesday, May 30, 2007 1:49 PM
To: php-install@xxxxxxxxxxxxx
Subject: Re: XML namespaces broken in libxml-based SAX interface

I've since recompiled xml and php5.2 and the XML error is away.
I'm using $GLOBALS['variable'] to access predefined global variables in
functions. It works. don't know if it the right way but...



pascal desroche a écrit :
Hi,

i'm compiled php-5.0.2 on os x 10.3.9 with zlib, apxs, lib-xml, gd
I have some failed tests in the make test procedure and among them
XML namespaces broken in libxml-based SAX interface

the fact is that in a php script, when i'm using a global variable in a
function, I get this
Notice: Undefined variable:


So i suppose it has something to do with libxml
any idea ?

thanx


here is the list of failed tests

FAILED TEST SUMMARY
-------------------------------------------------------------------- -
Test for buffering in core functions with implicit flush off
[tests/func/008.phpt]
Locale settings affecting float parsing [tests/lang/034.phpt]
Bug #29944 (function defined in switch crashes PHP)
[tests/lang/bug29944.phpt]
Bug #22836 (returning references to NULL) [Zend/tests/bug22836.phpt]
Test 5: HTML Test [ext/dom/tests/dom005.phpt]
Bug #14293 (serialize() and __sleep())
[ext/standard/tests/serialize/bug14293.phpt]
Bug #20382 (strtotime ("Monday", $date) produces wrong result on DST
changeover) [ext/standard/tests/time/bug20382.phpt]
Bug #27719: mktime returns incorrect timestamp for dst days
[ext/standard/tests/time/bug27719.phpt]
Bug #27780 (strtotime(+1 xxx) returns a wrong date/time)
[ext/standard/tests/time/bug27780.phpt]
Bug #25666 (XML namespaces broken in libxml-based SAX interface)
[ext/xml/tests/bug25666.phpt]
Bug #26614 (CDATA sections skipped on line count)
[ext/xml/tests/bug26614.phpt]
XML parser test, default namespaces [ext/xml/tests/xml009.phpt]
XML parser test, attributes [ext/xml/tests/xml010.phpt]




Matthew Marino
IT Manager
CSW Inc.
45 Tyburski Road
Ludlow MA 01056
(413)589-1311



[Index of Archives]     [PHP Users]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [Postgresql]     [PHP Books]     [PHP Databases]     [PHP SOAP]
  Powered by Linux