[PHP] Plugin systems

2005-05-31 Thread Marcus Bointon
I'm looking to build a plugin system for my web application. I'm  
going to need to handle multiple types of plugin. I know that many of  
them exist already, but I'm wanting something that's very object- 
clean and PHP5-aware. I was thinking about using multiple interface  
implementations, so that I could have a plugin that provides a  
particular kind of database access, provides a user interface for  
admin purposes, and a simple display unit perhaps for connection  
status. In this case I'd define a class like:


class mynewplugin extends pluginbase implements database, admin,  
display {

  //...
}

I would then be able to introspect (using class_implements etc) to  
find, for example, all plugins that implement database access. I  
could easily add more plugin types by adding more interface types.  
The overall benefit being that all kind of plugin are handled through  
a single mechanism.


Does this sound like a solid structure and mechanism?

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php + cvs

2005-05-31 Thread Marcus Bointon

On 31 May 2005, at 09:58, Jochem Maas wrote:


Also I hear lots of good things about subversion (SVN), which is a
newer alternative for version control - some even say its better.


I can definitely vouch for Subversion. I'm using it for all my PHP  
stuff. I'd not used cvs a great deal, but I'd always found it awkward  
and svn is certainly easier.


The home page is here: http://subversion.tigris.org/ The  
documentation (an online O'Reilly book) is excellent. It's pretty  
easy to learn (shares most basic commands with cvs), and there are  
many helper apps to work with it, not least TortoiseSVN which looks  
and works just like TortoiseCVS. I'm on OSX with OpenBSD and Linux  
servers and it's been easy to get it working over HTTPS. There are  
some OSX clients (notably svnx), but I find that once you figure out  
the commands, the command line interface is very easy to work with.


Consensus seems to be that if you're just starting out in version  
control, go straight to svn so you can skip all the reasons that made  
them want an upgrade from cvs!


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php + cvs

2005-05-31 Thread Marcus Bointon

On 31 May 2005, at 15:40, Bostjan Skufca @ domenca.com wrote:


is it possible to mount CVS/SVN repository as filesystem?


Yes and no. Both keep stuff as normal files, but often as diffs and  
BDB databases. You really need to go through the appropriate client  
interface to extract data from it meaningfully. Also, you don't  
normally work directly on the repository but on a locally checked out  
version. This is what makes concurrent edits possible. SVN is  
typically implemented as a WebDAV service (possibly using SSL for  
security), and you can simply mount the webdav point as you would any  
other webdav file system. I guess you could check out a version  
remotely, then mount that area via webdav. Not sure what you'd gain  
though.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] Plugin systems

2005-05-31 Thread Marcus Bointon

On 31 May 2005, at 15:21, Jochem Maas wrote:

seems like alot of spreadout functionality to be putting it in a  
single

class (maybe I'm not seeing your example in the proper light).


That's possible, and I would only be able to implement a single  
plugin class within any given file (assuming simplistic namespacing).  
However, I do think that it's quite likely that any single plugin  
will likely only implement one or two interfaces so it should not get  
too messy. Think about photoshop here - you can just chuck plugins in  
the plugins folder, and they are all handled in the same way,  
regardless of whether they add file importing, exporting or image  
processing functions, or even all three at once.



it sounds like lots of work, with the possibility that it will become
overengineered... which has the affect of:

1. making code slow (introspection and reflection are not the  
speediest parts of the engine!)

2. make seemingly simple things difficult because of all the hoops you
have created for yourself.


Built-ins are almost always faster than 'userland' PHP code, and it  
seems that this approach might hit quite a few sweet spots in that  
respect. There's no particular reason this should have any great  
impact on speed as it's not really any different to loading a bunch  
of classes (something which is massively improved with an accelerator  
anyway).


The plugin system needs to do several things:

* locate plugin files (just normal readdir calls)
* within located plugins, locate implementations of particular  
functionality (a simple call to class_implements)

* run preferred implementation

Smarty has quite a neat plugin mechanism, but it's quite limited in  
what it tries o do - for example there's no way you can directly  
build block, modifier and function plugins with identical  
functionality in a single file (though you could do it using a shared  
class and a bunch of includes - exactly the complexity I'm trying to  
avoid).


How might I achieve this without using these built-in functions, and  
why might it be faster and less complex?


There are some very complex plugin systems, such as the one recently  
added to MaxMediaManager which uses this model:


http://www.martinfowler.com/articles/injection.html#UsingAServiceLocator

but I'm wanting to keep things simpler.


but then there is nothing to suggest that you can't make it work
- the kind of thing you suggest doing is a good way of utilizing
the advantages of the object model.

I doubt it will be easy to write it well... but hey thats half the  
fun right?! :-)

by all means hit the list with all your tricky little php5 problems,
I for one will be on the look out for them :-)


I get the feeling that it will actually be quite simple to write -  
that's partly why I'm wondering what's wrong with it ;^)



1. what is the objective you wish to accomplish with such a 'system'?


The system I'm working on implements large chunks of functionality  
internally. I want to make it switchable so that I can reconfigure it  
to use external resources on a dynamic basis. My main aim is to build  
a kind of host environment and reimplement my internal functions as  
plugins so that all implementations of the functionality can share  
the same interfaces. Many applications are built this way - Apache  
and Dreamweaver MX spring to mind.


2. do you have a very strict definition of 'plugin'? (I have always  
found the

word rather woolly/inexact)


That's part of the point. With the mechanism I'm thinking of, I don't  
have to be too precise about what exactly a plugin might do - I only  
need to define the different plugin interfaces (which can be very  
strict) that it might conform to - implementation is wide open.


I'd welcome a discussion of plugin mechanisms generally...

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] php + cvs

2005-05-31 Thread Marcus Bointon

On 31 May 2005, at 17:57, Bostjan Skufca @ domenca.si wrote:

a. It would create a posibility to run application directly from  
CVS if http

server would have access to it


It doesn't work that way - there are almost no circumstances under  
which you would want to access the repository without going through a  
client. The only case I can think of is for backup. You can automate  
checkouts from your repository - Subversion provides scripting hooks  
to do exactly that kind of thing automatically. You can set up a  
trigger like 'whenever someone makes a commit to this branch, do a  
checkout to this directory'.


Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] PHP5 binaries

2005-05-20 Thread Marcus Bointon
It seems that none of the current major Linux distros provide PHP5  
binary installation packages. By major I mean, RedHat, Fedora (it  
will be in F4 when released), Mandriva, Debian, Ubuntu, possibly  
others. Seriously, none have standard PHP5 packages, even optional  
ones. Does no-one use PHP5??? It's not exactly bleeding edge, having  
made a final release nearly a year ago.

I'm trying to set up an automatable installation system for such  
evident rarities as RedHat Enterprise Linux 4, and I just can't find  
anything workable. Even php4 binaries are rare (especially ones with  
flexible options including things like pcntl). Perl is massively  
supported, with binaries for hundreds of extensions widely available.  
Why does PHP get such second-rate treatment? Is it particularly hard  
to build packages for?

I'm quite used to building PHP5 from source, but it's not the most  
elegant way of deploying things. The PHP download page says Most  
Linux distributions come with PHP these days, so if you do not want  
to compile your own, go to your distribution's download site., but  
that's no use if no-one actually provides them for current releases.

Even in the various rpm repositories PHP5 is a rare beast - for  
example rpmforge's members don't include it. rpmbone provides some  
very basic rpms, but they suffer from dependency problems (even when  
accessed via apt-get).

Any other ideas?
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Seeking decent domain registrar

2005-05-16 Thread Marcus Bointon
On 14 May 2005, at 07:53, Richard Lynch wrote:
For the record, no I haven't tried to go to that URL, because I  
don't even
know how to type that symbol.
Ah. I don't think you use a Mac ;^) MacOS (9 and X) has a wonderful  
system for typing any accented characters very easily (from an  
English keyboard) that can be explained and easily remembered in  
about 10 seconds. One simple technique enables me to type  
áéíóúäëïöüàèìòùöâêîôûñõ without having to remember large numbers of  
keystrokes or codes.

If I did know how to type that non-ASCII symbol, I don't quite  
understand
which of the umpteen extended character sets is going to get used  
by all
the DNS machines, so I'd be kind of surprised if it worked, but,  
hey, if
it all works and everybody is happy, it's all good.
It's easy - it's all unicode mapped into ASCII so it works  
transparently with DNS systems, who don't have to think in anything  
other than plain ASCII. It's up to individual applications to map the  
presentational aspect - raw mappings will work in all applications -  
try going to www.xn--caf-dma.com (the punycode rendering of  
www.café.com).

I feel sorry for anybody who has such a domain name, however, as it's
going to be a real bear to get it listed/indexed correctly by search
engines, I would guess.  Maybe not.  Maybe all the search engines  
are all
ready for the non-ASCII domain names.  [shrug]

I certainly understand that the DNS space is now much bigger, and much
nicer for non-English (or, perhaps more accurately,
non-ASCII/Roman-alphabet) websites who can now get their domain  
name in
their own native language.  And I think that's really great.

But it's sure gonna make it hard for a lot of users to figure out  
how to
get there...
Bear in mind that in languages that DO make use of accented (or just  
plain different) characters, they are utterly normal and everyday.  
Someone who considers cafe to be misspelled relative to café will  
find it EASIER to use the correct version than to have to translate  
into the English dumbing down of their language - that you might  
find it harder is not a consideration.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Seeking decent domain registrar

2005-05-13 Thread Marcus Bointon
On 13 May 2005, at 01:11, Richard Lynch wrote:
On Thu, May 12, 2005 3:40 am, Marcus Bointon said:
Multilingual domain support e.g. café.com
Er.
Maybe they changed the rules, but I don't think that's a valid  
domain name
AT ALL.

So maybe the reason you are having trouble is you are looking for
something that cannot exist...
They did change the rules starting in November 2000, with RFCs  
(3454, 3490, 3491, 3492) finalised in 2003. See http:// 
www.verisign.com/products-services/naming-and-directory-services/ 
naming-services/internationalized-domain-names/index.html This page  
may be of interest too: http://www.imc.org/idna/. Also, have you  
tried going to www.café.com? It works just fine for me (if you're  
using an antique browser like IE6 it may not work, though verisign  
have a free plugin to enable it). http://www.1stdomain.net/ does  
international registrations (though does not handle .co.uk domains).  
From a PHP point of view, http://pear.php.net/package/Net_IDNA/  
what's needed.

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Seeking decent domain registrar

2005-05-12 Thread Marcus Bointon
Somewhat OT - I've had almost entirely poor experiences with domain  
registrars, so I'm looking for recommendations. I need:

.com, .net, .org domains (easy enough!)
.co.uk support
Multilingual domain support e.g. café.com
Online control of DNS server assignment
Specification of external DNS at registration time (so you don't have  
to change it unnecessarily afterwards)
Multiple admin accounts (I run domains for other people in their  
names and I want to keep them separate)
Don't need any forwarding, web hosting, email or anything beyond  
registration
Low-cost would help of course!

I've been googling for registrars, but as yet I've not found anyone  
that offers all this. Can anyone recommend a registrar that has a  
clue and a decent web interface?

Thanks,
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] Re: Valid email address syntax script?

2005-05-04 Thread Marcus Bointon
On 3 May 2005, at 19:18, Matthew Weier O'Phinney wrote:
* Jm [EMAIL PROTECTED]:
Does anyone have a nice email address syntax checking script they'd
like to share? Regular expression-based anyone? TIA.
I use the following regex:
preg_match('/[EMAIL PROTECTED]@([-a-z0-9]+\.)+[a-z]{2,}$/i', $email)
I believe I got it out of the PHP Cookbook, by David Sklar, but I  
can't
remember for certain. It's not 100% accurate, but I rarely have
complaints from users whose emails don't validate.
I've used this one quite heavily. It doesn't go as far as checking  
TLDs, but it's quite tight on RFC2822 and allows things like numeric  
addresses:

preg_match('/^(?:[\w\!\#\$\%\\'\*\+\-\/\=\?\^\`\{\|\}\~]+\.)*[\w\!\#\ 
$\%\\'\*\+\-\/\=\?\^\`\{\|\}\~]+@(?:(?:(?:[a-zA-Z0-9](?:[a-zA-Z0-9\-] 
(?!\.)){0,61}[a-zA-Z0-9]?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9\-](?!$)){0,61} 
[a-zA-Z0-9]?)|(?:\[(?:(?:[01]?\d{1,2}|2[0-4]\d|25[0-5])\.){3}(?:[01]? 
\d{1,2}|2[0-4]\d|25[0-5])\]))$/', $email);

I got it from here - they have some more and some commercial products  
that go further:

http://www.hexillion.com/samples/#Regex
Marcus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] Mac OS X compilation problem

2005-04-27 Thread Marcus Bointon
In the past I've had success compiling PHP4 on OS X. However, now I'm 
trying to get PHP5 working and not having much luck. I'm getting 
configure to work, and make goes ok until the final linking stage at 
which point I get this error:

ld: unknown flag: -export-symbols
make: *** [libs/libphp5.bundle] Error 1
It seems that that flag must be set in a make file somewhere (it's not 
in my environment), and it's certainly not documented in the OS X ld 
man pages.

Not sure if it makes any difference, but most of the external modules 
that PHP uses are built from fink. I need some modules that are not 
supported in any of the pre-built fink PHP5 packages, and I'm used to 
compiling it without difficulty on Linux and OpenBSD.

Anyone else run into this or have any idea how I might fix it?
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP] strtotime time zone trouble

2005-01-18 Thread Marcus Bointon
How is this not a bug?
?php
print date('Y-m-d H:i:s', strtotime('now UTC')).\n;
print date('Y-m-d H:i:s', strtotime('now PST')).\n;
?
outputs:
2005-01-18 09:58:09 (correct)
2005-01-18 17:58:09 (incorrect)
The time zone correction is applied in the wrong direction. Does it in 
both current PHP 4 and 5.

Named time zones like these are supposedly deprecated, but the 
suggested alternative in the docs doesn't work at all:

print date('Y-m-d H:i:s', strtotime('now UTC-0800')).\n;
1970-01-01 00:59:59
using 08:00 doesn't work either
Ideas?
Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] strtotime time zone trouble

2005-01-18 Thread Marcus Bointon
On 18 Jan 2005, at 10:53, Tom wrote:
PST = UTC - 8, therefore if you ask for strtotime in PST it will give 
you  now + 8. This is standard in most languages, you are just reading 
the functionality back to front.
ie when you say strtotome('now PST'), what you are asking for is the 
current local time (UTC in your instance) given an input date in PST
OK, I see some logic in that - now how to work around it?
try
print date('Y-m-d H:i:s', strtotime('now') -0800).\n;
That definitely won't work; -0800 will be interpreted as an octal 
value, but it's not a legal value. If it was interpreted as a decimal 
value, it would subtract 800 minutes, which is no use to anyone. 
Numeric offsets are supposed to work inside the strtotime string param, 
according to the docs.

Much of the point of using zone names rather than fixed numeric offsets 
is that it allows for correct daylight savings calculations (assuming 
that locale data is correct on the server).

Let me rephrase the question - how can I get the current time in a 
named time zone using strtotime and without using a numeric offset?

Marcus
--
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] oop too slow

2004-08-19 Thread Marcus Bointon
on 19/8/04 9:49, Krzysztof Gorzelak at [EMAIL PROTECTED] wrote:

 Hi
 I'm trying my new php5 script, but it takes about 1.2s to generate my page.
 That is, how my oop model looks like :
 
 [category]
   |||
 [photo]  [desc]   [products]
 
 
 [products]
 |
 [product]
 |||
 [photo] [desc] [keys]
 
 
 [keys]
 |
 [key]
 |
 [values]
 |
 [value]
 
   Each object gets data from mysql by itself. The generation time of 1
 category [30 products, 10 keys, 5 values ~= 300 mysql queries] takes as I
 said more than a 1s (on quite fast machine). How can this model be improved?
 Do I create too many objects ? What are the oop solutions for such problem ?

This is something that I've wrestled with too. If you make each item you
deal with a clean, self-sufficient object, with self-storage, data hiding
etc, it is inevitable that you run into this problem. It is a symptom of a
fundamental clash between Relational DB and OO points of view. The only
trick I have found to work around it that is OO-clean is to use factory
methods or objects that create multiple objects from a single DB query, so
as well as having a 'get' method that populates an object from a DB, make
another means of creating an object from local data that has been obtained
from a larger query that returned sufficient values to populate multiple
items.

 I also use an extra table to create many-to-many relation betwean a product
 and a key. Is this the only way in mysql ?
 
 [product]
 |
 [product_id, key_id]
   |
   [key]

Yes, that's the correct way to represent a M:M relation in a relational DB.
The join table is an artefact of a relational model, rather than an OO one,
so the answer is to hide the existence of this table within the objects at
either end - so have product and key objects, but not product_key objects.
Each object should have a method that retrieves instances of all the related
objects of the other kind. This is really a different manifestation of the
first problem.

Ultimately the trick is to create separate factory objects or higher-level
methods inside the existing objects that can create multiple instances from
a single database query. Having said that, it's difficult to spot the best
places to do this. For example, you might normally create multiple product
objects from an array of database IDs like so:

foreach($productids as $id)
$products[] = new product($id);

You can see that this would cause a query for each instantiation.

With a product factory class, you might do this instead:

$products = product_factory::get($productids);

Which achieves the same result, but using only a single DB query (hidden
inside the factory class, which does NOT call the product class in the same
way!). The next problem is keeping your product_factory and product classes
in sync - I'm sure there must be a nice pattern to deal with that somewhere.

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] PHP 5 - $_REQUEST undefined???

2004-08-08 Thread Marcus Bointon
I'm getting errors like this:

Notice: Undefined variable: _REQUEST in /var/www/html/index.php on line 57

This is truly weird - why on earth would this superglobal be undefined? (and
there is no unset($_REQUEST) lurking!) As far as I'm aware, there isn't even
an ini option to turn it off.

I'm in the process of upgrading from PHP4 to 5, and this script works ok in
4 - the error is just in 5.

Any ideas?

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] Creating a PHP5 RPM

2004-07-27 Thread Marcus Bointon
I normally compile PHP straight from the regular source, however, this means
that RPM loses track of what PHP version is installed on RedHat Linux (EL3),
causing dependency and version mismatch problems. So it appears that I need
to build an RPM from the normal source, then install it with RPM. However, I
have no idea how to do this - can anyone give me some pointers? Is it as
simple as adding a configure switch like --build-rpm?

Thanks,

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] mysql and mysqli

2004-07-27 Thread Marcus Bointon
I've got mysql 4.1.13 installed on RH EL 3 and I'm trying to build PHP5
against it with both mysql and mysqli extensions. It's quite happy to config
and make with --with-mysql=/usr/local or --with-mysqli, but if I specify
them both together (in either order), I get thousands of errors like this:

/usr/lib/mysql/libmysqlclient.a(my_static.o)(.data+0x6b4): multiple
definition of `my_default_record_cache_size'
/usr/lib/mysql/libmysqlclient.a(my_static.o)(.data+0x6b4): first defined
here

Finally ending with:

collect2: ld returned 1 exit status
make: *** [libphp5.la] Error 1

I installed all of mysql from official RPMs, except for devel and shared
modules which I compiled from the source RPM (These 4.1.13 binary RPMs are
hard-wired to OpenSSL 0.9.6 so you can't use them on any recent OS).

Any ideas to fix this?

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] Preventing static method calls in PHP4

2004-07-22 Thread Marcus Bointon
[repost, not sure if it worked last time]

If I want to prevent a method from being called statically in PHP4, how can
I do it? So far I've tried these techniques:

?php
class A {
var $Anotstatic;
  function A() {
$this-Anotstatic = true;
  }
  function dynamic() {
if (!isset($this) or !is_a($this, 'A') or !(isset($this-Anotstatic) and
$this-Anotstatic))
echo Method called statically\n;
else
echo dynamic-only function\n;
  }
  function test ()
  {
 A::dynamic();
  }
}

class B {
function test() {
  A::dynamic();
}
}

$a = new A();
$a-dynamic();
A::dynamic();
$b = new B;
$b-test();
$a-test();
?

This works for the first 3 tests (so I'm getting there), but not the fourth,
that is a dynamic method being called statically from an instance of the
same class. Is there something I've missed that will allow me to intercept
this style of call?

I know that this problem goes away in PHP5, and that the setting of $this in
static calls from other instances is not a bug (though it's the root of this
problem)!

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] Re: Preventing static method calls in PHP4

2004-07-22 Thread Marcus Bointon
on 22/7/04 10:49, Jason Barnett at [EMAIL PROTECTED] wrote:

 The easiest way I can think of to prevent static method calls is to use the
 $this pseudo variable in your method.  A method *cannot* be used statically if
 the method requires use of $this.

Unfortunately that doesn't work - it is exactly the case that fails in my
example. $this IS set in a static method that's called from any object
instance (even one of a different class), and it's a PHP feature, not a bug.

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] run perl script with php

2004-07-22 Thread Marcus Bointon
on 22/7/04 10:42, Tassos T at [EMAIL PROTECTED] wrote:

 i faced a small problem i have a perl script but i want to execute that
 in a php script. unfortunately i cannot convert to php.

No problem, look at:

http://uk2.php.net/manual/en/function.system.php
http://uk2.php.net/manual/en/function.exec.php
http://uk2.php.net/manual/en/function.passthru.php

E.g. system('myperlscript.pl');

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



[PHP] Preventing static method calls in PHP4

2004-07-21 Thread Marcus Bointon
If I want to prevent a method from being called statically in PHP4, how can
I do it? So far I've tried these techniques:

?php
class A {
var $Anotstatic;
  function A() {
$this-Anotstatic = true;
  }
  function dynamic() {
if (!isset($this) or !is_a($this, 'A') or !(isset($this-Anotstatic) and
$this-Anotstatic))
echo Method called statically\n;
else
echo dynamic-only function\n;
  }
  function test ()
  {
 A::dynamic();
  }
}

class B {
function test() {
  A::dynamic();
}
}

$a = new A();
$a-dynamic();
A::dynamic();
$b = new B;
$b-test();
$a-test();
?

This works for the first 3 tests (so I'm getting there), but not the fourth,
that is a dynamic method being called statically from an instance of the
same class. Is there something I've missed that will allow me to intercept
this style of call?

I know that this problem goes away in PHP5, and that the setting of $this in
static calls from other instances is not a bug (though it's the root of this
problem)!

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



Re: [PHP] Zend Enc and 0T Q

2004-07-21 Thread Marcus Bointon
on 21/7/04 16:59, PHP Gen at [EMAIL PROTECTED] wrote:

 News to me, I thought each encryptor has its own
 style of encrypting the phpwill check up but I
 think thats true.

Mmcache says explicitly that its output is compatible with Zend encoder.
Also note that encryption is not the same as encoding.

Marcus
-- 
Marcus Bointon
Synchromedia Limited: Putting you in the picture
[EMAIL PROTECTED] | http://www.synchromedia.co.uk

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



<    1   2