php-general Digest 14 Mar 2004 19:31:17 -0000 Issue 2646

Topics (messages 180379 through 180395):

Re: gd installation problem
        180379 by: Firman Wandayandi

Re: how to convert array into integer
        180380 by: Firman Wandayandi
        180381 by: Five
        180383 by: Raditha Dissanayake

Re: objects in session
        180382 by: Nick F

Re: Regarding PHP Installation on linux
        180384 by: Raditha Dissanayake

Re: ext/dom: Namespaces
        180385 by: Vivian Steller

Re: [PHP-DEV] PHP5: ext/dom: Namespaces
        180386 by: Derick Rethans

Re: servers in php
        180387 by: Comex

Re: Installation of 4.3.4
        180388 by: edwardspl.ita.org.mo
        180389 by: Jason Wong
        180393 by: edwardspl.ita.org.mo
        180394 by: Jason Wong

memory_limit doesn't work (4.3.3, Mac OS X)
        180390 by: Adam Nohejl
        180392 by: Jason Wong

Re: .sit download problems
        180391 by: Brian Dunning

Mail
        180395 by: Will

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [EMAIL PROTECTED]


----------------------------------------------------------------------
--- Begin Message ---
Hi QT,

Sorry I don't where the turtorial can be found. :( But can you check you
php.ini? this is the most problem have been posted to the list.

Regards,
    Firman

----- Original Message -----
From: "QT" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 14, 2004 9:59 AM
Subject: [PHP] gd installation problem


> dear Sirs,
>
> I did what says in
> http://www.php.net/manual/en/install.windows.php#Installation of Windows
> extensions
>
> but still I can not run php_gd2.dll extensions on win2000
>
> where can I find more solutions about this
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

--- End Message ---
--- Begin Message ---
Hi Kenneth,

You can implode an array first, and convert it to integer, see below.

$number = (int) implode('', $yourarray);

Good Luck,
    Firman

----- Original Message ----- 
From: "Kenneth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 14, 2004 12:48 PM
Subject: [PHP] how to convert array into integer


> To all,
> I have an Array ( [0] => 2 [1] => . [2] => 2 [3] => 0 [4] => 8 )
> but i want to convert it into integer 2.208 in order to use it to plot
> graph....how can i convert it?
> thx,
> Kenneth
> 
> -- 
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> 
> 

--- End Message ---
--- Begin Message ---
"Firman Wandayandi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED]
> Hi Kenneth,
>
> You can implode an array first, and convert it to integer, see below.
>
> $number = (int) implode('', $yourarray);
>
> Good Luck,
>     Firman
>
> ----- Original Message ----- 
> From: "Kenneth" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Sunday, March 14, 2004 12:48 PM
> Subject: [PHP] how to convert array into integer
>
>
> > To all,
> > I have an Array ( [0] => 2 [1] => . [2] => 2 [3] => 0 [4] => 8 )
> > but i want to convert it into integer 2.208 in order to use it to plot
> > graph....how can i convert it?
> > thx,
> > Kenneth
> >
> > -- 
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >

implode(,)

T'hat's a good one. What won't they think of next?
Now I can get rid of my loops.

--- End Message ---
--- Begin Message --- Oh yes! why did i forget that one? :-(

Firman Wandayandi wrote:

Hi Kenneth,

You can implode an array first, and convert it to integer, see below.

$number = (int) implode('', $yourarray);

Good Luck,
   Firman

----- Original Message ----- From: "Kenneth" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, March 14, 2004 12:48 PM
Subject: [PHP] how to convert array into integer





To all,
I have an Array ( [0] => 2 [1] => . [2] => 2 [3] => 0 [4] => 8 )
but i want to convert it into integer 2.208 in order to use it to plot
graph....how can i convert it?
thx,
Kenneth

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php









--
Raditha Dissanayake.
---------------------------------------------------------------
http://www.radinks.com/upload/ Drag and Drop Upload thousands of files and folders in a single
transfer. (HTTP or FTP)

--- End Message ---
--- Begin Message ---
You can use serialize() to convert an object (or array) into
a string, and store that into the session.
To get back it's original value, use unserialize().

<?PHP
$my = new stdClass;
$my->name = 'nick';
$my->comp = 'slow';

$store_this = serialize($my);
// $store_this has value:
// O:8:"stdClass":2:{s:4:"name";s:4:"nick";s:4:"comp";s:4:"slow";}

$original = unserialize($store_this);
// now back to my object.
?>

Hope that helps :)
---
Nick F
sevengraff.com

Marc Serra wrote:
Hi,

I got problem when i want to save object in session.



I got my first page when I create my object and save it to session:



<?php

Require 'test.inc.php';

Session_start();



$test = new test();

$test->Load($_Get['id']);

$_SESSION['save'] = $test;

?>



In my second page I want to retrieve my object

<?php



Require 'test.inc.php';

Session_start();

echo get_class($_SESSION['test']);

?>



When I do get_class($_SESSION['test']); I got the message
"__PHP_Incomplete_Class" instead of "test"



Can you explain me where I can have made an error.



Thx,



Marc.









--- End Message ---
--- Begin Message --- Please refer to the installation guide.

[EMAIL PROTECTED] wrote:

Hi,

I am installing php alone on linux system where apache is already
installed.

I couldn't find make command during installation.

Could anybody solve my problem.

thanks
Balaji

Confidentiality Notice

The information contained in this electronic message and any attachments to this 
message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged 
information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.





--
Raditha Dissanayake.
---------------------------------------------------------------
http://www.radinks.com/upload/ Drag and Drop Upload thousands of files and folders in a single
transfer. (HTTP or FTP)

--- End Message ---
--- Begin Message ---
hello,

once again a post about the tricky namespaces. I played with the following
functions concerning namespaces:

domdocument->createElementNS
domdocument->createAttributeNS
domelement->setAttributeNS
domelement->getAttributeNS
(domelement->hasAttributeNS)

as i found out the behavior of some functions differs when handling
namespaces. maybe we can start a thread thinking about this behavior - at
the moment i don't have the "enlightened" view into this very complex
theme. would be nice if you could help me/us understanding namespaces a bit
more...

ok here are the things i found out. copy the code to your editor and step
through the examples - the important output is given in the comments.
Thanks for taking time to that :)

/*############################ START ############################*/
<pre>

/* SIMPLE NAMESPACE EXAMPLE */
<?php
        $doc = new DomDocument();
        $xpath = new DomXPath($doc);
        
        /* SIMPLE NAMESPACE EXAMPLE */
        $node1 = $doc->createElementNS("namespaceURI", "nodeName");
        $node1 = $doc->appendChild($node1);
        
        print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
        // Output
        // > <nodeName xmlns="namespaceURI"/>
        
        $namespaces = $xpath->query("//namespace::*");
        foreach($namespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace
        // > xmlns = namespaceURI
        $doc->removeChild($node1);
?>

Right behavior so far!



/* NAMESPACE WITH PREFIX EXAMPLE */
<?php   
        /* NAMESPACE WITH PREFIX EXAMPLE */
        $node2 = $doc->createElementNS("namespaceURI", "prefix:localName");
        $node2 = $doc->appendChild($node2);
        
        print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
        // Output
        // > <prefix:localName xmlns:prefix="namespaceURI"/>
        
        $namespaces = $xpath->query("//namespace::*");
        foreach($namespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace
        // > xmlns:prefix = namespaceURI
        
        // $doc->removeChild($node2);
?>

Still right behavior!


        
/* NAMESPACE WITH EXISTING PREFIX EXAMPLE */
<?php
        /* NAMESPACE WITH EXISTING PREFIX EXAMPLE */
        $node3 = $doc->createElementNS("namespaceURI", "localName");
        $node3 = $node2->appendChild($node3);
        
        print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
        // Output
        // > <prefix:localName xmlns:prefix="namespaceURI"> ¬
        //              <prefix:localName/> ¬
        //       </prefix:localName>
        
        $namespaces = $xpath->query("//namespace::*");
        foreach($namespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
        // > xmlns:prefix = namespaceURI                                               
 (node2)
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node3)
        // > xmlns:prefix = namespaceURI                                               
 (node3)
        
        // $doc->removeChild($node3);
?>

Right behavior, but namespace node will be removed, xpath-expression shows
prefix - thats still right.     



/* IMPORT NAMESPACE NODE WITHOUT CHILDREN EXAMPLE */
<?php
        /* IMPORT NAMESPACE NODE WITHOUT CHILDREN EXAMPLE */
        $newDoc = new DomDocument();
        $newXpath = new DomXPath($newDoc);
        
        $newNode3 = $newDoc->importNode($node3);        // second argument $deep = 
FALSE!!
        $newNode3 = $newDoc->appendChild($newNode3);
        
        print(htmlspecialchars("\n" . $newDoc->saveXML() . "\n"));
        // Output
        // > <localName/>
        
        $newNamespaces = $newXpath->query("//namespace::*");
        foreach($newNamespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (newNode3)
        
        $newDoc->removeChild($newNode3);
?>

Maybe right behavior, but i think loosing the namespace while importing the 
node without its children is a bit dangerous...



/* IMPORT NAMESPACE NODE EXAMPLE */
<?php
        /* IMPORT NAMESPACE NODE EXAMPLE */     
        $newNode3 = $newDoc->importNode($node3, TRUE);  // second argument $deep =
TRUE now!!
        $newNode3 = $newDoc->appendChild($newNode3);
        
        print(htmlspecialchars("\n" . $newDoc->saveXML() . "\n"));
        // Output
        // > <prefix:localName xmlns:prefix="namespaceURI"/>
        
        $newNamespaces = $newXpath->query("//namespace::*");
        foreach($newNamespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (newNode3)
        // > xmlns:prefix = namespaceURI                                               
 (newNode3)
        
        $newDoc->removeChild($newNode3);
?>

Now the namespace node will be imported as well, but it is not possible 
to import the "namespaced" node without its children...



/* SET A NAMESPACE ATTRIBUTE WITHOUT PREFIX AND UNDEFINED NAMESPACE */
<?php   
        /* SET A NAMESPACE ATTRIBUTE WITHOUT PREFIX AND UNDEFINED NAMESPACE */
        //$node3->setAttributeNS("attrNamespaceURI", "attrName", "attrValue");
        // Output
        // > Fatal error:  Uncaught exception 'domexception' with message
'Namespace Error'
?>

Error message is acceptable because attribute nodes could not have their own 
"xmlns" attributes! They have to be defined with a prefix (if their is no 
prefix defined for this namespace!)... Therefor the folling example should 
not occur an error...

<?php   
        /* SET A NAMESPACE ATTRIBUTE WITH EXISTING NAMESPACE */
        //$node3->setAttributeNS("namespaceURI", "attrName", "attrValue");
        // Output would be
        // > <prefix:localName xmlns:prefix="namespaceURI">
        //              <prefix:localName prefix:attrName="attrValue"/>
        //       </prefix:localName>
?>

And it doesn't. Right! The import of this node will be done correctly!



/* SET A NAMESPACE ATTRIBUTE WITH PREFIX AND UNDEFINED NAMESPACE EXAMPLE */
<?php
        $node3->setAttributeNS("attrNamespaceURI", "prefix:attrName", "attrValue");
        
        print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
        // Output
        // > <prefix:localName xmlns:prefix="namespaceURI"> ¬
        //              <prefix:localName xmlns:prefix="attrNamespaceURI"
prefix:attrName="attrValue"/> ¬
        //       </prefix:localName>
        
        $namespaces = $xpath->query("//namespace::*");
        foreach($namespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
        // > xmlns:prefix = namespaceURI                                               
 (node2)
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node3)
        // > xmlns:prefix = attrNamespaceURI                                    (node3)
        
        // $doc->removeChild($node3);
        print("Node3 namespace: " . $node3->namespaceURI . "\n");
        // Output
        // > Node3 namespace: namespaceURI
?>

Seems confusing but namespace of node is still "namespaceURI"
And it will result in a conflict in the following example...



/* IMPORT NAMESPACE NODE WITH NAMESPACE-PREFIX DEFINITION EXAMPLE */
<?php
        /* IMPORT NAMESPACE NODE EXAMPLE */     
        $newNode3 = $newDoc->importNode($node3, TRUE);  // second argument $deep =
TRUE now!!
        $newNode3 = $newDoc->appendChild($newNode3);
        
        print(htmlspecialchars("\n" . $newDoc->saveXML() . "\n"));
        // Output
        // > <prefix:localName xmlns:prefix="attrNamespaceURI"
prefix:attrName="attrValue"/>
        
        $newNamespaces = $newXpath->query("//namespace::*");
        foreach($newNamespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (newNode3)
        // > xmlns:prefix = namespaceURI                                               
 (newNode3)
        print("NewNode3 namespace: " . $newNode3->namespaceURI . "\n");
        // Output
        // > NewNode3 namespace: attrNamespaceURI
        
        $newDoc->removeChild($newNode3);
        $node2->removeChild($node3);
?>

WOW!! NamespaceURI has been changed while importing node - i think 
that this behavior isn't right yet. NamespaceURI shouldn't depend on 
xmlns:prefix attribute - instead it simply should loose its prefix and 
set its "xmlns" attribute to its current namespaceURI!



/* SET A NAMESPACE ATTRIBUTE WITH NEW ATTRIBUTE NODE EXAMPLE */
I'm now changing to node2 -  getting to complicated
<?php
        //$attr2 = $doc->createAttributeNS("attrNamespaceURI", "prefix:attrName");
        // Output
        // > Fatal error:  Uncaught exception 'domexception' with message
'Namespace Error'
?>

It seems that the behavior handling namespaces isn't the same in 
DomDocument::createAttributeNS() and DomElement::setAttributeNS(), as you 
can see in the 
SET A NAMESPACE ATTRIBUTE WITH PREFIX AND UNDEFINED NAMESPACE EXAMPLE

But using a new namespace-prefix it will work correctly.
<?php
        $attr2 = $doc->createAttributeNS("attrNamespaceURI", "newPrefix:attrName");
        // Output:
        // > <prefix:localName xmlns:prefix="namespaceURI"
xmlns:newPrefix="attrNamespaceURI"/>
?>

Note: the "xmlns:newPrefix" declaration will be appended to the root 
node of the document on creation of this NS attribute. This could 
result in trouble while cloning/importing/deleting a node holding an 
"newPrefix"ed attribute!?

<?php
        $node3 = $doc->createElementNS("namespaceURI", "nodeName");
        $node3 = $node2->appendChild($node3);
        $node3->appendChild($attr2);
        
        print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
        // Output
        // > <prefix:localName xmlns:prefix="namespaceURI"
xmlns:newPrefix="attrNamespaceURI">
        //              <prefix:nodeName newPrefix:attrName=""/>
        //       </prefix:localName>
        
        $namespaces = $xpath->query("//namespace::*");
        foreach($namespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
        // > xmlns:newprefix = attrNamespaceURI                                 (node2)
        // > xmlns:prefix = namespaceURI                                               
 (node2)
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node3)
        // > xmlns:newprefix = attrNamespaceURI                                 (node3)
        // > xmlns:prefix = namespaceURI                                               
 (node3)
        $node2->removeChild($node3);
        // Output
        // > <prefix:localName xmlns:prefix="namespaceURI"
xmlns:newPrefix="attrNamespaceURI"/>
?>
As you can see the "xmlns:newPrefix" attribute is still appended to the root 
node of the document. Because of the lack of a (reasonable) possibility to 
remove an "xmlns" declaration the reset of an attribute using this prefix 
will result in an error:

<?php
        // $attr2 = $doc->createAttributeNS("newAttrNamespaceURI",
"newPrefix:attrName");
        // Output
        // > Fatal error:  Uncaught exception 'domexception' with message
'Namespace Error'
?>

I think it would be easier to append the "xmlns" declarations on those nodes 
which have an attribute/child of this namespace.



/* SET AN XMLNS NAMESPACE ATTRIBUTE EXAMPLE */
As I said before there is no (reasonable) possiblity to remove an "xmlns" 
declaration (you could do this by cloning nodes in the hope for a bug in the 
source leading to the loss of this declaration... very uncomforable:).

But there is a possibility to check if a xmlns is defined using xpath (I use 
this xpath in this document all the time).

I found out that you also can set an "xmlns" declaration using the right 
namespaces (which you can find in the sources of libxml and ext/dom).
Have a look:

<?php
        // xmlns Namespace: "http://www.w3.org/2000/xmlns/";
        // xml Namespace: "http://www.w3.org/XML/1998/namespace";
        $node2->setAttributeNS("http://www.w3.org/2000/xmlns/";,
"xmlns:anotherNewPrefix", "anotherNewNamespace");
        
        print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
        // Output
        // > <prefix:localName xmlns:prefix="namespaceURI"
xmlns:newPrefix="attrNamespaceURI"
xmlns:anotherNewPrefix="anotherNewNamespace"/>
        
        $namespaces = $xpath->query("//namespace::*");
        foreach($namespaces as $item) {
                print($item->nodeName . " = " . $item->nodeValue . "\n");
        }
        // Output
        // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
        // > xmlns:anotherNewPrefix = anotherNewNamespace               (node2)
        // > xmlns:newprefix = attrNamespaceURI                                 (node2)
        // > xmlns:prefix = namespaceURI                                               
 (node2)
?>

This is very fine but the behavior (in this case) isn't very logic: setting 
an elements'/attributes' namespace the intepreter checks whether a prefix is 
defined for this namespace or not. Though the following expression should
not 
result in an error while a prefix for the used namespace is defined already:

<?php
        $node2->setAttributeNS("http://www.w3.org/2000/xmlns/";,
"justAnotherNewPrefix", "justAnotherNewNamespace");
        // Output:
        // > Fatal error:  Uncaught exception 'domexception' with message
'Namespace Error'
?>

But unforunately it does! You could solve this problem by simply setting the 
"http://www.w3.org/2000/xmlns/"; namespace as a default namespace like 
"http://www.w3.org/XML/1998/namespace";. Then the behavior would be more 
consequent...

</pre>

/*############################ END ############################*/

Ok I think this is enough about namespaces for today. I hope i could help 
someone understanding namespaces and the problems with it.

Any comments would be appreciated.

Thanks in advance.

vivi

--- End Message ---
--- Begin Message ---
Don't crosspost to two irrelevant lists, please

Derick

On Sun, 14 Mar 2004, Vivian Steller wrote:

> hello,
>
> once again a post about the tricky namespaces. I played with the following
> functions concerning namespaces:
>
> domdocument->createElementNS
> domdocument->createAttributeNS
> domelement->setAttributeNS
> domelement->getAttributeNS
> (domelement->hasAttributeNS)
>
> as i found out the behavior of some functions differs when handling
> namespaces. maybe we can start a thread thinking about this behavior - at
> the moment i don't have the "enlightened" view into this very complex
> theme. would be nice if you could help me/us understanding namespaces a bit
> more...
>
> ok here are the things i found out. copy the code to your editor and step
> through the examples - the important output is given in the comments.
> Thanks for taking time to that :)
>
> /*############################ START ############################*/
> <pre>
>
> /* SIMPLE NAMESPACE EXAMPLE */
> <?php
>         $doc = new DomDocument();
>         $xpath = new DomXPath($doc);
>
>         /* SIMPLE NAMESPACE EXAMPLE */
>         $node1 = $doc->createElementNS("namespaceURI", "nodeName");
>         $node1 = $doc->appendChild($node1);
>
>         print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
>         // Output
>         // > <nodeName xmlns="namespaceURI"/>
>
>         $namespaces = $xpath->query("//namespace::*");
>         foreach($namespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace
>         // > xmlns = namespaceURI
>         $doc->removeChild($node1);
> ?>
>
> Right behavior so far!
>
>
>
> /* NAMESPACE WITH PREFIX EXAMPLE */
> <?php
>         /* NAMESPACE WITH PREFIX EXAMPLE */
>         $node2 = $doc->createElementNS("namespaceURI", "prefix:localName");
>         $node2 = $doc->appendChild($node2);
>
>         print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
>         // Output
>         // > <prefix:localName xmlns:prefix="namespaceURI"/>
>
>         $namespaces = $xpath->query("//namespace::*");
>         foreach($namespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace
>         // > xmlns:prefix = namespaceURI
>
>         // $doc->removeChild($node2);
> ?>
>
> Still right behavior!
>
>
>
> /* NAMESPACE WITH EXISTING PREFIX EXAMPLE */
> <?php
>         /* NAMESPACE WITH EXISTING PREFIX EXAMPLE */
>         $node3 = $doc->createElementNS("namespaceURI", "localName");
>         $node3 = $node2->appendChild($node3);
>
>         print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
>         // Output
>         // > <prefix:localName xmlns:prefix="namespaceURI"> ¬
>         //              <prefix:localName/> ¬
>         //       </prefix:localName>
>
>         $namespaces = $xpath->query("//namespace::*");
>         foreach($namespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
>         // > xmlns:prefix = namespaceURI                                             
>    (node2)
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node3)
>         // > xmlns:prefix = namespaceURI                                             
>    (node3)
>
>         // $doc->removeChild($node3);
> ?>
>
> Right behavior, but namespace node will be removed, xpath-expression shows
> prefix - thats still right.
>
>
>
> /* IMPORT NAMESPACE NODE WITHOUT CHILDREN EXAMPLE */
> <?php
>         /* IMPORT NAMESPACE NODE WITHOUT CHILDREN EXAMPLE */
>         $newDoc = new DomDocument();
>         $newXpath = new DomXPath($newDoc);
>
>         $newNode3 = $newDoc->importNode($node3);        // second argument $deep = 
> FALSE!!
>         $newNode3 = $newDoc->appendChild($newNode3);
>
>         print(htmlspecialchars("\n" . $newDoc->saveXML() . "\n"));
>         // Output
>         // > <localName/>
>
>         $newNamespaces = $newXpath->query("//namespace::*");
>         foreach($newNamespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (newNode3)
>
>         $newDoc->removeChild($newNode3);
> ?>
>
> Maybe right behavior, but i think loosing the namespace while importing the
> node without its children is a bit dangerous...
>
>
>
> /* IMPORT NAMESPACE NODE EXAMPLE */
> <?php
>         /* IMPORT NAMESPACE NODE EXAMPLE */
>         $newNode3 = $newDoc->importNode($node3, TRUE);  // second argument $deep =
> TRUE now!!
>         $newNode3 = $newDoc->appendChild($newNode3);
>
>         print(htmlspecialchars("\n" . $newDoc->saveXML() . "\n"));
>         // Output
>         // > <prefix:localName xmlns:prefix="namespaceURI"/>
>
>         $newNamespaces = $newXpath->query("//namespace::*");
>         foreach($newNamespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (newNode3)
>         // > xmlns:prefix = namespaceURI                                             
>    (newNode3)
>
>         $newDoc->removeChild($newNode3);
> ?>
>
> Now the namespace node will be imported as well, but it is not possible
> to import the "namespaced" node without its children...
>
>
>
> /* SET A NAMESPACE ATTRIBUTE WITHOUT PREFIX AND UNDEFINED NAMESPACE */
> <?php
>         /* SET A NAMESPACE ATTRIBUTE WITHOUT PREFIX AND UNDEFINED NAMESPACE */
>         //$node3->setAttributeNS("attrNamespaceURI", "attrName", "attrValue");
>         // Output
>         // > Fatal error:  Uncaught exception 'domexception' with message
> 'Namespace Error'
> ?>
>
> Error message is acceptable because attribute nodes could not have their own
> "xmlns" attributes! They have to be defined with a prefix (if their is no
> prefix defined for this namespace!)... Therefor the folling example should
> not occur an error...
>
> <?php
>         /* SET A NAMESPACE ATTRIBUTE WITH EXISTING NAMESPACE */
>         //$node3->setAttributeNS("namespaceURI", "attrName", "attrValue");
>         // Output would be
>         // > <prefix:localName xmlns:prefix="namespaceURI">
>         //              <prefix:localName prefix:attrName="attrValue"/>
>         //       </prefix:localName>
> ?>
>
> And it doesn't. Right! The import of this node will be done correctly!
>
>
>
> /* SET A NAMESPACE ATTRIBUTE WITH PREFIX AND UNDEFINED NAMESPACE EXAMPLE */
> <?php
>         $node3->setAttributeNS("attrNamespaceURI", "prefix:attrName", "attrValue");
>
>         print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
>         // Output
>         // > <prefix:localName xmlns:prefix="namespaceURI"> ¬
>         //              <prefix:localName xmlns:prefix="attrNamespaceURI"
> prefix:attrName="attrValue"/> ¬
>         //       </prefix:localName>
>
>         $namespaces = $xpath->query("//namespace::*");
>         foreach($namespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
>         // > xmlns:prefix = namespaceURI                                             
>    (node2)
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node3)
>         // > xmlns:prefix = attrNamespaceURI                                    
> (node3)
>
>         // $doc->removeChild($node3);
>         print("Node3 namespace: " . $node3->namespaceURI . "\n");
>         // Output
>         // > Node3 namespace: namespaceURI
> ?>
>
> Seems confusing but namespace of node is still "namespaceURI"
> And it will result in a conflict in the following example...
>
>
>
> /* IMPORT NAMESPACE NODE WITH NAMESPACE-PREFIX DEFINITION EXAMPLE */
> <?php
>         /* IMPORT NAMESPACE NODE EXAMPLE */
>         $newNode3 = $newDoc->importNode($node3, TRUE);  // second argument $deep =
> TRUE now!!
>         $newNode3 = $newDoc->appendChild($newNode3);
>
>         print(htmlspecialchars("\n" . $newDoc->saveXML() . "\n"));
>         // Output
>         // > <prefix:localName xmlns:prefix="attrNamespaceURI"
> prefix:attrName="attrValue"/>
>
>         $newNamespaces = $newXpath->query("//namespace::*");
>         foreach($newNamespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (newNode3)
>         // > xmlns:prefix = namespaceURI                                             
>    (newNode3)
>         print("NewNode3 namespace: " . $newNode3->namespaceURI . "\n");
>         // Output
>         // > NewNode3 namespace: attrNamespaceURI
>
>         $newDoc->removeChild($newNode3);
>         $node2->removeChild($node3);
> ?>
>
> WOW!! NamespaceURI has been changed while importing node - i think
> that this behavior isn't right yet. NamespaceURI shouldn't depend on
> xmlns:prefix attribute - instead it simply should loose its prefix and
> set its "xmlns" attribute to its current namespaceURI!
>
>
>
> /* SET A NAMESPACE ATTRIBUTE WITH NEW ATTRIBUTE NODE EXAMPLE */
> I'm now changing to node2 -  getting to complicated
> <?php
>         //$attr2 = $doc->createAttributeNS("attrNamespaceURI", "prefix:attrName");
>         // Output
>         // > Fatal error:  Uncaught exception 'domexception' with message
> 'Namespace Error'
> ?>
>
> It seems that the behavior handling namespaces isn't the same in
> DomDocument::createAttributeNS() and DomElement::setAttributeNS(), as you
> can see in the
> SET A NAMESPACE ATTRIBUTE WITH PREFIX AND UNDEFINED NAMESPACE EXAMPLE
>
> But using a new namespace-prefix it will work correctly.
> <?php
>         $attr2 = $doc->createAttributeNS("attrNamespaceURI", "newPrefix:attrName");
>         // Output:
>         // > <prefix:localName xmlns:prefix="namespaceURI"
> xmlns:newPrefix="attrNamespaceURI"/>
> ?>
>
> Note: the "xmlns:newPrefix" declaration will be appended to the root
> node of the document on creation of this NS attribute. This could
> result in trouble while cloning/importing/deleting a node holding an
> "newPrefix"ed attribute!?
>
> <?php
>         $node3 = $doc->createElementNS("namespaceURI", "nodeName");
>         $node3 = $node2->appendChild($node3);
>         $node3->appendChild($attr2);
>
>         print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
>         // Output
>         // > <prefix:localName xmlns:prefix="namespaceURI"
> xmlns:newPrefix="attrNamespaceURI">
>         //              <prefix:nodeName newPrefix:attrName=""/>
>         //       </prefix:localName>
>
>         $namespaces = $xpath->query("//namespace::*");
>         foreach($namespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
>         // > xmlns:newprefix = attrNamespaceURI                                 
> (node2)
>         // > xmlns:prefix = namespaceURI                                             
>    (node2)
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node3)
>         // > xmlns:newprefix = attrNamespaceURI                                 
> (node3)
>         // > xmlns:prefix = namespaceURI                                             
>    (node3)
>         $node2->removeChild($node3);
>         // Output
>         // > <prefix:localName xmlns:prefix="namespaceURI"
> xmlns:newPrefix="attrNamespaceURI"/>
> ?>
> As you can see the "xmlns:newPrefix" attribute is still appended to the root
> node of the document. Because of the lack of a (reasonable) possibility to
> remove an "xmlns" declaration the reset of an attribute using this prefix
> will result in an error:
>
> <?php
>         // $attr2 = $doc->createAttributeNS("newAttrNamespaceURI",
> "newPrefix:attrName");
>         // Output
>         // > Fatal error:  Uncaught exception 'domexception' with message
> 'Namespace Error'
> ?>
>
> I think it would be easier to append the "xmlns" declarations on those nodes
> which have an attribute/child of this namespace.
>
>
>
> /* SET AN XMLNS NAMESPACE ATTRIBUTE EXAMPLE */
> As I said before there is no (reasonable) possiblity to remove an "xmlns"
> declaration (you could do this by cloning nodes in the hope for a bug in the
> source leading to the loss of this declaration... very uncomforable:).
>
> But there is a possibility to check if a xmlns is defined using xpath (I use
> this xpath in this document all the time).
>
> I found out that you also can set an "xmlns" declaration using the right
> namespaces (which you can find in the sources of libxml and ext/dom).
> Have a look:
>
> <?php
>         // xmlns Namespace: "http://www.w3.org/2000/xmlns/";
>         // xml Namespace: "http://www.w3.org/XML/1998/namespace";
>         $node2->setAttributeNS("http://www.w3.org/2000/xmlns/";,
> "xmlns:anotherNewPrefix", "anotherNewNamespace");
>
>         print(htmlspecialchars("\n" . $doc->saveXML() . "\n"));
>         // Output
>         // > <prefix:localName xmlns:prefix="namespaceURI"
> xmlns:newPrefix="attrNamespaceURI"
> xmlns:anotherNewPrefix="anotherNewNamespace"/>
>
>         $namespaces = $xpath->query("//namespace::*");
>         foreach($namespaces as $item) {
>                 print($item->nodeName . " = " . $item->nodeValue . "\n");
>         }
>         // Output
>         // > xmlns:xml = http://www.w3.org/XML/1998/namespace   (node2)
>         // > xmlns:anotherNewPrefix = anotherNewNamespace               (node2)
>         // > xmlns:newprefix = attrNamespaceURI                                 
> (node2)
>         // > xmlns:prefix = namespaceURI                                             
>    (node2)
> ?>
>
> This is very fine but the behavior (in this case) isn't very logic: setting
> an elements'/attributes' namespace the intepreter checks whether a prefix is
> defined for this namespace or not. Though the following expression should
> not
> result in an error while a prefix for the used namespace is defined already:
>
> <?php
>         $node2->setAttributeNS("http://www.w3.org/2000/xmlns/";,
> "justAnotherNewPrefix", "justAnotherNewNamespace");
>         // Output:
>         // > Fatal error:  Uncaught exception 'domexception' with message
> 'Namespace Error'
> ?>
>
> But unforunately it does! You could solve this problem by simply setting the
> "http://www.w3.org/2000/xmlns/"; namespace as a default namespace like
> "http://www.w3.org/XML/1998/namespace";. Then the behavior would be more
> consequent...
>
> </pre>
>
> /*############################ END ############################*/
>
> Ok I think this is enough about namespaces for today. I hope i could help
> someone understanding namespaces and the problems with it.
>
> Any comments would be appreciated.
>
> Thanks in advance.
>
> vivi
>
>

--- End Message ---
--- Begin Message --- On Sat, 13 Mar 2004 19:06:38 -0500, Comex <[EMAIL PROTECTED]> wrote:

I was wondering how to go about making a server in PHP that would accept multiple connections..in windows, so I can't use forks. I'd need to call the program from itself but I don't know how the listening works.


I found an example from the Zend mailing list that allowed this by looping through the clients..thanks.
--- End Message ---
--- Begin Message ---
If I want to install php with the following function on Fedora Core 1 System
:

DOM XML, FTP, Gettext, IMAP, LDAP, MCAL, Mcrypt, MySQL, PostgreSQL, XML, GD,
MM  and MS-SQL 2000

Then which special configure commands ( parameters ) must be compiled with
php ?

Many thank for your help !

Edward.

Jason Wong wrote:

> On Friday 12 March 2004 00:07, [EMAIL PROTECTED] wrote:
>
> > Mine is Fedora Core 1 System ( without any update )...
> > So, which configure commands ( parameters ) must be compiled with this
> > system ?
>
>   ./configure
>
> would do fine. If you want bells and whistles then read the output of
>
>   ./configure --help
>
> and consult the manual.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> Win98 is called Win98 because you need to update at least 98% of your
> hardware before it can be installed
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Sunday 14 March 2004 19:48, [EMAIL PROTECTED] wrote:

If you're going to be asking questions, do take the time to read any answers.

> If I want to install php with the following function on Fedora Core 1
> System
>
>
> DOM XML, FTP, Gettext, IMAP, LDAP, MCAL, Mcrypt, MySQL, PostgreSQL, XML,
> GD, MM  and MS-SQL 2000
>
> Then which special configure commands ( parameters ) must be compiled with
> php ?

Again:

> >   ./configure --help
> >
> > and consult the manual.

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
OK, so you're a Ph.D.  Just don't touch anything.
*/

--- End Message ---
--- Begin Message ---
Just the following configure commands ( parameters ) is good for work ?

./configure --with-apxs2 --with-pear=/usr/share/pear --with-openssl --with-dom
--with-dom-xslt --with-dom-exslt
--with-gd --with-gettext --with-iconv --with-ldap --with-mcrypt --with-mhash
--with-mysql --with-mm --with-xmlrpc
--with-imap --with-imap-ssl --with-xml --with-mssql=/usr/local/freetds
--enable-ftp

Thank for your help !

Edward.

Jason Wong wrote:

> On Sunday 14 March 2004 19:48, [EMAIL PROTECTED] wrote:
>
> If you're going to be asking questions, do take the time to read any answers.
>
> > If I want to install php with the following function on Fedora Core 1
> > System
> >
> >
> > DOM XML, FTP, Gettext, IMAP, LDAP, MCAL, Mcrypt, MySQL, PostgreSQL, XML,
> > GD, MM  and MS-SQL 2000
> >
> > Then which special configure commands ( parameters ) must be compiled with
> > php ?
>
> Again:
>
> > >   ./configure --help
> > >
> > > and consult the manual.
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.biz
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
> ------------------------------------------
> Search the list archives before you post
> http://marc.theaimsgroup.com/?l=php-general
> ------------------------------------------
> /*
> OK, so you're a Ph.D.  Just don't touch anything.
> */
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php

--- End Message ---
--- Begin Message ---
On Sunday 14 March 2004 23:38, [EMAIL PROTECTED] wrote:

Please do not top-post.

> Just the following configure commands ( parameters ) is good for work ?
>
> ./configure --with-apxs2 --with-pear=/usr/share/pear --with-openssl
> --with-dom --with-dom-xslt --with-dom-exslt
> --with-gd --with-gettext --with-iconv --with-ldap --with-mcrypt
> --with-mhash --with-mysql --with-mm --with-xmlrpc
> --with-imap --with-imap-ssl --with-xml --with-mssql=/usr/local/freetds
> --enable-ftp

Have you tried it?

Remember you can keep repeating these steps:

  ./configure [...options...]
  make

until you've got everything sussed out and the 'make' command executes without 
any errors. Those two steps will not affect your system nor make any 
permanent changes to it. So don't be afraid to configure and make to your 
hearts content (or at least until you get it right).

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
zeal, n.:
        Quality seen in new graduates -- if you're quick.
*/

--- End Message ---
--- Begin Message --- Hi,

I have php 4.3.3 on Mac OS X and it doesn't respect the value of memory_limit in php.ini. When I try get_cfg_var("memory_limit") it returns the correct value. But I can allocate as much memory as I want...

Is it a bug or is it possible that I'm doing something wrong?

Thanks for any idea


-- Adam

--- End Message ---
--- Begin Message ---
On Sunday 14 March 2004 22:22, Adam Nohejl wrote:

> I have php 4.3.3 on Mac OS X and it doesn't respect the value of
> memory_limit in php.ini. When I try get_cfg_var("memory_limit") it
> returns the correct value. But I can allocate as much memory as I
> want...

Did you compile php with "--enable-memory-limit"?

> Is it a bug or is it possible that I'm doing something wrong?

Have you checked bugs.php.net?

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.biz
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *
------------------------------------------
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
------------------------------------------
/*
One of the pleasures of reading old letters is the knowledge that they
need no answer.
                -- George Gordon, Lord Byron
*/

--- End Message ---
--- Begin Message ---
Not sure if this will solve your problem, but try tossing in a
Content-Length header so the browser knows how long of a file to look for.

This helped - I can see the correct file length now in the download window. But now the problem is a little different. I can download .zip files with any browser, but .sit files do not decompress (Safari, IE6, anything). The whole file is downloaded correctly, but gives a Stuffit "damaged archive" error. Any thoughts? Here is my code now:


header('Content-Type: '.$file_row['content_type']);
header('Content-Disposition: filename="'.$file_row["filename"].'"');
$size = filesize('../../store/files/'.$file_row['filename']);
header('Content-Length: '.$size);
header('Content-Transfer-Encoding: base64');
readfile('../../store/files/'.$file_row['filename']);

Assume that filename = 'myarchive.sit' and content_type is 'application/sit'
--- End Message ---
--- Begin Message ---
Hello All,
I am having a problem with sending a reply from a form.  It is giving me a
550 error: There is no valid sender in any header line.

My form is:
<?
include ("inc/setup.php");

// Mail reply to Orginial poster
$recipient .= "[EMAIL PROTECTED], $_POST[email]\n";
$mailheaders .= "To: $_POST[email]\n";
$mailheaders .= "From: $_POST[email]\n";

$subject .= "$_POST[subject]";

$msg .= "Please do not reply to this email!!!\n\n";

$msg .= "Here is our answer:               \r$_POST[message]\n\n";

$msg .= "Please use your username/password that was assigned to you.\n\n";

mail($recipient, $mailheaders, $subject, $msg);

$add_reply = "INSERT into $table_name25 values ('', now(),
'$_POST[subject]', '$_POST[name]',
'$_POST[email]', '$_POST[message]')";
mysql_query($add_reply,$conn) or die(mysql_error());

header("Location: support_archive.php");
exit;
?>

And when I recieive the one email there are no from and reply to in the
email client.  Plus it is in the subject line!!!  What the heck am I doing
wrong???

Thanks in advance,
~WILL~

--- End Message ---

Reply via email to