[PHP] Namespace resolution performance implications

2009-07-31 Thread Andrew Mason
Hi Guys / Girls,
We are transitioning our framework to use the namespaces which are
available in php 5.3.

I found an explanation of the resolution rules here :
http://www.sitepoint.com/blogs/2009/07/14/php-namespaces-import-alias-resolution/
( also listed below)

and I was wondering what the performance implications of the different
stages of name resolution are. For example for the code in the
framework it's self would it be preferable to use a \Foo\Bar style
fully qualified class names in order for the resolution to be done at
compile time?

Thanks in advance
Andrew


1. Calls to fully-qualified functions, classes or constants are
resolved at compile-time.

2. Unqualified and qualified names are translated according to the
import rules, e.g. if the namespace A\B\C is imported as C, a call to
C\D\e() is translated to A\B\C\D\e().

3. Inside a namespace, all qualified names not already translated
according to import rules have the current namespace prepended, e.g.
if a call to C\D\e() is performed within namespace A\B, it is
translated to A\B\C\D\e().

4. Unqualified class names are translated according to current import
rules and the full name is substituted for short imported name, e.g.
if class C in namespace A\B is imported as X, new X() is translated to
new A\B\C().

5. Unqualified function calls within a namespace are resolved at
run-time. For example, if MyFunction() is called within namespace A\B,
PHP first looks for the function \A\B\MyFunction(). If that is not
found, it looks for \MyFunction() in the global space.

6. Calls to unqualified or qualified class names are resolved at
run-time. For example, if we call new C() within namespace A\B, PHP
will look for the class A\B\C. If that is not found, it will attempt
to autoload A\B\C.

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



Re: [PHP] Spry, XML, PHP and XSLT Hell

2009-10-05 Thread Andrew Mason
On Tue, Oct 6, 2009 at 4:37 AM, Nathan Nobbe  wrote:
> On Mon, Oct 5, 2009 at 10:10 AM, Matthew Croud wrote:
>
>> Hello,
>>
>> Is there anyone here who uses Spry with XML and PHP and understands XSLT,
>> At the moment i'm in development hell and have a rather bloated question to
>> ask someone who is knowledgeable in the above areas.
>>
>> My head is about to explode and I can't find any answers,
>> If there are Spry/XML folk here i'll spill the beans about my issue.
>>
>
> ive not used spry, but have the rest of the lot.., hell, i think we can give
> it a crack..; lay it on us brother ;)
>
> -nathan
>

I don't know what spry is but I use PHP and XSLT all the time.

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



[PHP] PHP 5.3 Code Documentor

2009-12-09 Thread Andrew Mason
Hi all,
Is anyone aware of a code documentation generator like phpdoc or
doxygen that supports the PHP 5.3 namespaces ?

I tried adding support to doxygen myself but didn't have a whole lot
of luck and didn't have huge amounts of time to spend on learning
flex/yacc.

Andrew

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



Re: [PHP] Can't read $_POST array

2010-08-18 Thread Andrew Mason
On Thu, Aug 19, 2010 at 7:41 AM, Daevid Vincent  wrote:
> You've got something jacked. DO NOT proceed with your coding using this
> hack.
>
> Put this in a blank file named whatever_you_want.php and hit it with your
> web browser.
>
> ---
> -
> 
>
> 
>        
>                foo
>                bar
>        
>        
> 
> ---
> -
>
>> -Original Message-
>> From: Brian Dunning [mailto:br...@briandunning.com]
>> Sent: Wednesday, August 18, 2010 2:23 PM
>> To: PHP-General
>> Subject: Re: [PHP] Can't read $_POST array
>>
>> This was the complete code of the page (this is the POST
>> version not the REQUEST version):
>>
>> > $response = print_r($_POST, true);
>> echo $response;
>> ?>
>>
>> Returns an empty array no matter what POST vars are sent. We
>> fixed it by changing it to this, which I've never even heard
>> of, but so far is working perfectly:
>>
>> > $response = file_get_contents('php://input');
>> echo $response;
>> ?>
>>
>> I have no idea what the problem was. Thanks to everyone for your help.
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>

Does what your posting contain any content like '<' '>' my guess is
that you need to access the content using the filter_ functions.

Andrew

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



Re: [PHP] Re: Which PHP 5.3 documentation generators have you found?

2010-09-30 Thread Andrew Mason
On Fri, Oct 1, 2010 at 6:44 AM, David Harkness
 wrote:
> While we don't use any 5.3 specific features such as namespaces yet, we set
> up our continuous integration system to use Doxygen. It runs significantly
> faster than phpDocumentor, though we put zero effort into tuning either
> system.
>

I started patching Doxygen a while ago but got sort of side tracked.
Out of PHPDocumentor and Doxygen, Doxygen seemed to be the closest as
it had namespace support already for other languages. only the tokens
needed changing. It uses Flex /Bison as the lexer and scanner so it's
pretty flexible. YMMV.

I have a bunch of FaiF code to release but i won't do so until i have
adequate documentation so I'll get around to adding support one of
these days.

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



Re: [PHP] Disk IO performance

2010-11-28 Thread Andrew Mason
On Mon, Nov 29, 2010 at 12:09 PM, Larry Garfield  wrote:
> There are many things that everybody "knows" about optimizing PHP code.  One
> of them is that one of the most expensive parts of the process is loading code
> off of disk and compiling it, which is why opcode caches are such a bit
> performance boost.  The corollary to that, of course, is that more files =
> more IO and therefore more of a performance hit.

I'd just organise them how you think makes most sense and then
optimize if you run into issues.

Kind regards
Andrew M

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



Re: [PHP] Is 5.3.5 really that much slower than 5.2?

2011-03-06 Thread Andrew Mason
> Is anyone else out there in the same boat?

Actually we have found the complete opposite so there might be some
people who are in the same boat as you but certainly not all.

Andrew

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



[PHP] Namespaced code with SabreDAV

2011-10-06 Thread Andrew Mason
Hello all,
I am trying to use the wonderful SabreDAV library to create a webdav
share. I have a demo up and running however the framework / class i'm
using is namespaced, and SabreDAV unfortunately does not have a 5.3
style namespace declaration.

I have an spl_autoload function registered in my base controller and
so long as I prefix the classname with a \ it all works:


 $rootDirectory = new \Sabre_DAV_FS_Directory($rootDir);

// The server object is responsible for making sense out of the WebDAV protocol
$server = new \Sabre_DAV_Server($rootDirectory);


However, SabreDAV it's self has a large amount of other PHP classes
which it calls which obviously aren't prefixed with '\'

Is there a way i can tell PHP any class name that get's instanciated
with 'Sabre_' should resolve to '\Sabre' ?

Many thanks
Andrew

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



[PHP] extending Xpath

2008-05-01 Thread Andrew Mason
Hi,
I was wondering if it was possible to extend the DOMXpath object in a
similar fashion to the DomDocument.

I was hoping to write a wrapper to provide an interface similar to
prepared statements in the db libraries for the xpath processor.


$xpath = new myxpath();

$stmt = $xpath->prepare("/foo/[EMAIL PROTECTED] = '?' ]");
$stmt->bindParam( '?', $potentiallynastystring );
$x = $stmt->execute();

I have tried :

final class timber_utils_domxpath extends DomXpath
{
   public function __construct( DOMDocument $dom )
   {
   echo "in here";
   parent::_construct( $dom );
   }
}


but I get the following error
Fatal error: Call to undefined method DOMXPath::_construct()

Many thanks
Andrew

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