Re: [PHP-DEV] buildbot

2004-05-24 Thread Hartmut Holzgraefe
Sebastian Bergmann wrote:
  I just read about buildbot [1] on the Mono mailinglist. Would this (or
  a similar solution) not be helpfull?
  --
  [1] http://buildbot.sourceforge.net/
a) easy to set up? esp. if compared to mozilla tinderbox? ;)
  (http://www.mozilla.org/tinderbox.html)
b) who is going to provide the builders?
c) how does this approach scale with the multitude of different extension
   setups in addition with lots of external libraries relied upon that
   come in different versions?
--
Hartmut Holzgraefe  [EMAIL PROTECTED]
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


RE: [PHP-DEV] PDO (was: SQLite API deficiency)

2004-05-24 Thread Marc Boeren

Hi,

 I apologize for not going to the end of the thread to see if 
 you posted a link online somewhere to this, but I would love
 a copy none the less.

It wasn't posted yet, but you can find it here:

http://www.guidance.nl/php/dbx/dbx.p

Cheerio, Marc.

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] overloading class properties

2004-05-24 Thread Maxx
Hello!

Trying to use ZE2's new features for my framework I fell in trouble with
(probably) abnormal behaviour of overloaded class properties which has been
declared as expected long time ago.

First of all, I do admit this feature has been discussed before, but despite
of all that I apologize for bringing this issue back and I'd like you to pay
a bit of your attention to the subject.

The problem is following:
?php
class A {
 public $pub;
 private $pri;

 function __get($name) {
  echo __get($name)\n;
  return $this;
 }
}
$a = new A;

echo $a-pub; // no error, but direct access. no __get() call is being made
echo $a-pri; // results in Fatal error. no __get() call is being made
?

In neither of two echo'es the call to __get() is being made.

Short question: Why is that?

Long question: Isn't that clear that when there is a __get() declared in a
class, this 'magic' method should be called on ANY access to a class
property?

Those who want it to behave like it does at the moment, may always emulate
desired functionality with Reflection API:

function __get($name) {
  $class = new ReflectionClass(__CLASS__);
  if($class-getProperty($name)-isPrivate()) trigger_error( ... );
  return $this-$name;
}

...but, please, give some freedom to those who want it! Let __get()/__set()
be called on EVERY attempt to access a property, because the current
realization makes Overloading practically USELESS for any serious use, since
you don't have a 100% control over accessing to class' properties.

Thanks in advance for your time and effort to helping us out with this one.
   Maxx

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] New PDFlib extension for PHP5

2004-05-24 Thread Rainer Schaaf
Hello,

 I'm maintaining the PDFlib wrapper code for the pdf extenions of
 PHP. I did a major rewrite of the wrapper for PDFlib 6 and PHP 5 and
 wanted to ask whether it is good idea to check in this code now (short
 before the release of PHP 5).

 My idea is to add this new Wrappercode as an extra module and keep
 the existing wrapper code for peoples using the old PDFlib 4 version.
 This is necessary because there are incompatible changes between
 PDFlib 4 and 5 which made a new wrapper module necessary. Here the
 details about the new wrapper code:


 
This PDFlib Wrapper Code works with PDFlib 5 and higher.

A new module was introduced, as PDFlib 5 supports a method to
handle the special returnvalues needed for PHP in the PDFlib core now.

This is necessary, as the new concept of optionlists in PDFlib allows
to pass handles to PDFlib objects and filenames inside of optionlists.

Before the wrapper added some offset to handles returned by PDFlib
to fit into scheme used by php to return 0 in case of errors, whereas
in PDFlib the errorcode is -1 and 0 is a valid handle.

As the optionlist may contain filenames on various places the
VIRTUAL_DIR support and the CHECK_OPEN_BASEDIR checks implemented
in the wrapper will not work reliable too. So VIRTUAL_DIR support
and the CHECK_OPEN_BASEDIR checking is disabled here too, as it would
only work for some of the files used with PDFlib.

The main changes:
- only official PDFlib API's are included (exception pdf_open_memory_image)
- supports PDFlib 5 and PDFlib 6
- builds with older PHP Version too
  (tested with PHP 4.1.0, 4.2.1, 4.3.0, and 5.0.0RC2.)
- adds an Object Oriented API to PDFlib (for PHP 5 only)
- uses PHP exceptions (for PHP 5 only)
- disables VIRTUAL_DIR support (use SerachPath instead)
- disables CHECK_OPEN_BASEDIR checks
- changed old API's with varargs to only accept all args now

I think it is worth to include this now, so that PHP5 comes with this
new code, but I wanted to discuss this first.
 

  

-- 
Best regards,

Rainer Schaaf   [EMAIL PROTECTED]http://www.pdflib.com
Personalize PDF: PDFlib Personalization Server and Block plugin
___PDFlib - a library for generating PDF on the fly

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



RE: [PHP-DEV] New PDFlib extension for PHP5

2004-05-24 Thread Wez Furlong
Hello Rainer,

A few of us have been planning to move the pdflib extension into PECL
(http://pecl.php.net) for a little while now; it sounds like an excellent time
to make this move, because it will allow you to make supplemental releases
outside of the PHP 5 core release cycle.

Here is a possible release plan:

1/  Move the current code into PECL
2/  Make a release (so that people may choose to use the code they are used
to)
3/  Merge your new code and bump the extension version to the next major (eg:
from 1.x to 2.0)
4/  Make a release
5/  Update and make additional releases whenever you like

How does that sound to you?

 - disables VIRTUAL_DIR support (use SerachPath instead)
 - disables CHECK_OPEN_BASEDIR checks

This doesn't sound too hot for shared hosters.

--Wez.

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] [PATCH] File Upload - Binary and Garbage Safety

2004-05-24 Thread snolz
Hello PHP people!

My patch adds binary safety to the variables sent when
uploading files. I see this very often requested.

It also restores some functionality which you broke in
PHP 4.2. When fieldnames are not trimmed PHP does not work.

Hope I was help
Sammy Nolz

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

[PHP-DEV] [PATCH] [REPOST] File Upload - Binary and Garbage Safety

2004-05-24 Thread snolz
Sorry but your list does not like hushmail attachments

Sammy Nolz




--- rfc1867.c.unpatched 2002-01-01 02:02:11.0 +0100
+++ rfc1867.c   2002-01-01 02:04:55.0 +0100
@@ -230,6 +230,13 @@
}
 }
 
+static void safe_php_register_binary_variable(char *var, char *strval,
 int strlen, zval *track_vars_array, zend_bool override_protection TSRMLS_DC)
+{
+   if (override_protection || !is_protected_variable(var TSRMLS_CC)) {
+   php_register_variable_safe(var, strval, strlen, track_vars_array 
TSRMLS_CC);
+   }
+}
+
 
 static void register_http_post_files_variable(char *strvar, char *val,
 zval *http_post_files, zend_bool override_protection TSRMLS_DC)
 {
@@ -761,7 +768,7 @@
 
 SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler)
 {
-   char *boundary, *s=NULL, *boundary_end = NULL, *start_arr=NULL, 
*array_index=NULL;
+   char *boundary, *s=NULL, *boundary_end = NULL, *start_arr=NULL, *end_arr=NULL,
 *array_index=NULL;
char *temp_filename=NULL, *lbuf=NULL, *abuf=NULL;
int boundary_len=0, total_bytes=0, cancel_upload=0, is_arr_upload=0,
 array_len=0;
int max_file_size=0, skip_upload=0, anonindex=0, is_anonymous;
@@ -883,23 +890,24 @@
/* Normal form variable, safe to read all data into memory */
if (!filename  param) {
 
-   char *value = multipart_buffer_read_body(mbuff 
TSRMLS_CC);
+   int length = 0;
+   char *value = multipart_buffer_read_body(mbuff, 
length TSRMLS_CC);
unsigned int new_val_len; /* Dummy variable */
 
if (!value) {
value = estrdup();
}
 
-   if (sapi_module.input_filter(PARSE_POST, param, 
value, strlen(value),
 new_val_len TSRMLS_CC)) {
+   if (sapi_module.input_filter(PARSE_POST, param, 
value, length,
new_val_len TSRMLS_CC)) {
 #if HAVE_MBSTRING  !defined(COMPILE_DL_MBSTRING)
if (php_mb_encoding_translation(TSRMLS_C)) {
php_mb_gpc_stack_variable(param, 
value, val_list, len_list,

   
   num_vars, num_vars_max TSRMLS_CC);
} else {
-   safe_php_register_variable(param, 
value, array_ptr, 0 TSRMLS_CC);
+   
safe_php_register_binary_variable(param, value, new_val_len, array_ptr,
 0 TSRMLS_CC);
}
 #else
-   safe_php_register_variable(param, value, 
array_ptr, 0 TSRMLS_CC);
+   safe_php_register_binary_variable(param, 
value, new_val_len, array_ptr,
 0 TSRMLS_CC);
 #endif
}
if (!strcasecmp(param, MAX_FILE_SIZE)) {
@@ -1000,9 +1008,14 @@
 
/* is_arr_upload is true when name of file upload field
 * ends in [.*]
-* start_arr is set to point to 1st [
+* start_arr is set to point to 1st [ and
+* end_arr is set to point to last ]
 */
-   is_arr_upload = (start_arr = strchr(param,'['))  
(param[strlen(param)-
1] == ']');
+   is_arr_upload = (end_arr = strrchr(param, ']'))  (start_arr 
= strchr(param,
'['))  (end_arr  start_arr);
+   /* cut away garbage after ] */
+   if (is_arr_upload  end_arr) {
+   end_arr[1] = '\0';
+   }
/* handle unterminated [ */
if (!is_arr_upload  start_arr) {
*start_arr = '_';
@@ -1014,6 +1027,8 @@
efree(array_index);
}
array_index = estrndup(start_arr+1, array_len-2);   
+   start_arr = NULL;
+   end_arr = NULL;
}

/* Add $foo_name */




Concerned about your privacy? Follow this link to get
FREE encrypted email: https://www.hushmail.com/?l=2

Free, ultra-private instant messaging with Hush Messenger
https://www.hushmail.com/services.php?subloc=messengerl=434

Promote security and make money with the Hushmail Affiliate Program: 
https://www.hushmail.com/about.php?subloc=affiliatel=427

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] Re: Destructors

2004-05-24 Thread Christian Schneider
Jason Garber wrote:
Based on the above example, the $oSession-__destruct() method relies on 
the $oDB object still being usable.  How can this be structured to 
ensure that the DB object does not get released first?
Adding something like $oSession-db = $oDB; should work in my opinion. 
Didn't test it and I have no real experience with destructors.

- Chris
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] Re: Destructors

2004-05-24 Thread Adam Maccabee Trachtenberg
On Mon, 24 May 2004, Christian Schneider wrote:

 Jason Garber wrote:
  Based on the above example, the $oSession-__destruct() method relies on
  the $oDB object still being usable.  How can this be structured to
  ensure that the DB object does not get released first?

It can't.

 Adding something like $oSession-db = $oDB; should work in my opinion.
 Didn't test it and I have no real experience with destructors.

That's not guaranteed to work. PHP 5 does not guarantee that object
destructors will be called in any particular order or that the order
will remain constant from one invocation to another.

Before asking for changes to this behavior, please check the mailing
list archives for a long discussion on the topic. :)

-adam

-- 
[EMAIL PROTECTED]
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: Destructors

2004-05-24 Thread Christian Schneider
Adam Maccabee Trachtenberg wrote:
That's not guaranteed to work. PHP 5 does not guarantee that object
destructors will be called in any particular order or that the order
will remain constant from one invocation to another.
Ok, I was under the impression that PHP won't call any destructors of 
objects still in use but from your comment I guess it does two passes: 
First collect a list of objects to destruct (which will be everything at 
the end of the script) and then call all the destructors (in random order).

Ignore my first comment, it was posted without any insight in the 
internals of the GC mechanism :-)

- Chris
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] Re: Destructors

2004-05-24 Thread Lukas Smith
Christian Schneider wrote:
Adam Maccabee Trachtenberg wrote:
That's not guaranteed to work. PHP 5 does not guarantee that object
destructors will be called in any particular order or that the order
will remain constant from one invocation to another.

Ok, I was under the impression that PHP won't call any destructors of 
objects still in use but from your comment I guess it does two passes: 
First collect a list of objects to destruct (which will be everything at 
the end of the script) and then call all the destructors (in random order).
unless you manually unset the objects in the order in which you want 
them to be destructed.

regards,
Lukas Smith
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP-DEV] Re: Destructors

2004-05-24 Thread Adam Maccabee Trachtenberg
On Mon, 24 May 2004, Lukas Smith wrote:

 unless you manually unset the objects in the order in which you want
 them to be destructed.

Right. That'll also work. :)

-adam

-- 
[EMAIL PROTECTED]
author of o'reilly's php cookbook
avoid the holiday rush, buy your copy today!

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP-DEV] where to find all the classes loaded in PHP

2004-05-24 Thread Kamesh Jayachandran
Hi All,
I am working on porting APC to PHP 5.0.
I want to know where to get all the use defined class
entries(zend_class_entry) to copy to the APC cache.

Old APC code was copying this information from CG(class_table)
I tried to do the same but could not get much of a info from here.
For example
I have a class by name 'Simple' which do not have any parent class.

The apc code checks for parent of a given class while copying
The code looks like this,

'elem' is a pointer to 'Simple' zend_class_entry
if(elem-parent)
{
//code to copy elem-parent-name to a newly allocated memory.
}
In my class 'Simple' I expect this if to fail as I assume parent to be
null for a class that don't have any parent.

But parent is not null which makes the if to succeed and hence accessing
the name function of parent to fail with Segmentation fault.

Thanks in advance

With regards
Kamesh Jayachandran

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: Destructors

2004-05-24 Thread John Coggeshall
On Mon, 2004-05-24 at 10:40, Adam Maccabee Trachtenberg wrote:
 Right. That'll also work. :)

I suppose you could push object references on a stack and register a
shutdown function which pops / unset()s if you really wanted a order to
it.. (that's an untested theory though)

John

-- 
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-
John Coggeshall   http://www.coggeshall.org/
The PHP Developer's Handbookhttp://www.php-handbook.com/
-=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=--=~=-

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DEV] Re: Destructors

2004-05-24 Thread Lukas Smith
John Coggeshall wrote:
On Mon, 2004-05-24 at 10:40, Adam Maccabee Trachtenberg wrote:
Right. That'll also work. :)

I suppose you could push object references on a stack and register a
shutdown function which pops / unset()s if you really wanted a order to
it.. (that's an untested theory though)
Which is what PEAR does to emulate destructors. But its doesnt really 
give you much control over the order of the stack. Its just the order in 
which you have created your instances. Anyways this is more and more 
turning into php-general@ material :-)

regards,
Lukas Smith
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php


[PHP-DEV] fw: binarycluod-dev / namespaces

2004-05-24 Thread alex black
hi all,

I wanted to forward this message along, and also ask some questions:

-Are there any plans to support packages / modules properly? (ala python,
which looks very nice, or I suppose java, etc).

-Are there plans to restore support for namespaces? The current PEAR method
of naming classes is the only sensible one given the engine's capabilities,
but we (and I would imagine they too) find it to be extremely ugly and
inelegant - something forced on us by the missing features in PHP5.

I would like to see full hierarchical namespace support.

-Has anyone thought of including a unitTest framework in pecl, so unit tests
could be tightly integrated with the engine?

---

Of course all this complaining is because we see the engine has become quite
seriously capable when compared to PHP4 - it's a HUGE leap - but we need
juuust a little more to really compete with the biggies.

I think PHP, with version 5 - has the potential to be a major language -
but it needs just a bit more of a gentle push to get there. I think those
features would do it.

I love python's system of modules: incredibly easy to use and explain, it
works well, and it provides a clear method for structuring code. Something
similar in PHP is welcome, and I trust the PEAR people to help set
guidelines. Of course we would like to contribute to that process as well,
if it happens.

The message:

 yeah, welcome to the gradual let-down that has been the history of PHP5.
 But seriously ... one thing after another was pulled from the language
 since it was hard to get it working properly.  loss of namespaces, magic
 __toString() was made unmagical, recently optional typehinted parameters
 were removed ...
 
 namespaces would have been a *huge* benefit to PHP.  pobably almost as
 huge as exceptions.  IMO the pear prefix solution is pretty dumb; if
 prefixing makes sense (and it often does), then I think having a unique
 name (like BC_ for Binarycloud) is a lot more reasonable than
 PHP_Framework_Binarycloud_Init, which is what PEAR does (makes the
 category part of the class names).
 
 I sure hope that namespaces gets reconsidered for 5.1 (which is supposed
 to follow 5.0 fairly quickly, as there are many features now that are
 being postponed due to feature freeze).  things like lack of namespace
 support makes me look increasingly at Mono/ASP.NET for building big OO web
 applications.

ouch


_alex


-- 
alex black
founder, ceo
the turing studio, inc.

project leader
binarycloud

mail: [EMAIL PROTECTED]
url : http://www.turingstudio.com
tel : 510.666.0074
fax : 510.666.0093

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php