Re: [PHP-DEV] Threads in PHP5?

2003-03-06 Thread Timm Friebe
On Fri, 2003-03-07 at 02:02, Daniel Skrach wrote:
 Hello, php-dev mailing list members,
 
 Just one short question: Are threads a planned feature for ZE2 / PHP5?

AFAIK, no. 

You might want to have a look at
http://cvs.php.net/cvs.php/pear/PECL/threads though.

- Timm


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



[PHP-DEV] FYI: PHP/threads

2003-03-05 Thread Timm Friebe
I've been playing around with the (not new) idea of introducing threads
into PHP userland (maybe something to think about havin in PHP6?). What
came out of it is available at [1], offering an object oriented API (in
comparison to PECL/threads [2]).

Threads would quite likely come in handy in the following situations:
- GTK-PHP thin network client application polling a socket for events
  (e.g., IRC client)

- Multiple simultaneous connections to slow services (for instance,
  think of whois + check multiple domain names).

Both of these examples could be realized using fork() or
socket_select(), though the first is not portable and the latter
produces unnecessary overhead.

Maybe someone here would like to pick up on this idea or give some
directions to what would have to be done to make this actually work
dependably. I'm experiencing the same issues as with PECL/threads -
variable confusion (local function arguments with same names in two
threads affect each other), Engine unstability (Warning: ... in ... on
line -18182899), but could get a couple of samples[3] to work quite
well.

Maybe the userland API could be adopted by PECL/threads? Is anyone still
working at this or was development given up?

1] http://sitten-polizei.de/php/threads-0.1alpha.tar.gz
2] http://cvs.php.net/cvs.php/pear/PECL/threads
3] http://sitten-polizei.de/php/threads/tests/?file=mythread.php
   http://sitten-polizei.de/php/threads/tests/?file=timer.php
   http://sitten-polizei.de/php/threads/tests/?file=simple.php
   http://sitten-polizei.de/php/threads/tests/?file=calendar.php
   etc.

- Timm
Threads for PHP

$Id$

1. API:
---
The thread API for PHP was designed to assemble that of Java (see
API documentation for lang.Thread).

2. Usage:
-
To create a thread, subclass the Thread class (defined in threads.c)
and overwrite its run() method. Put any code to be executed into this
function.

3. Basic example:
-
?php
  class MyThread extends Thread {
public function run() {
  print(thread init\n);
  sleep(4);
  print(thread finished\n);
}
  }
  
  $m= new MyThread();
  $m-start();
  
  // Wait for thread
  print(main\n);
  sleep(5);
  print(main done\n);
?

For more examples, see the tests/ subdirectory.

3.1. Example scripts output:


mythread.php (the sourcecode above)
| thread init
| main
| thread finished
| main done

timer.php (schedule reminder to alert in five seconds from now)
| About to schedule task.
| Task scheduled at 18:33:59.
| 18:33:59
| 18:34:00
| 18:34:01
| 18:34:02
| 18:34:03
| Reminder: It's now 18:34:04!
| 18:34:04
| Done.

calendar.php (schedule three tasks to alter in 2, 5 and 8 seconds from now)
| About to schedule tasks.
| Tasks scheduled at 18:34:35.
| 18:34:35
| 18:34:36
| Reminder: It's now 18:34:37, Buy food
| 18:34:37
| 18:34:38
| 18:34:39
| Reminder: It's now 18:34:40, Cook it
| 18:34:40
| 18:34:41
| 18:34:42
| Reminder: It's now 18:34:43, Meal done
| 18:34:43
| 18:34:44
| Done.

consumer_producer.php (demonstrate wait/notify)
|  Producer put 0 into resource #0
|  Consumer got 0 from resource #0
|  Producer put 1 into resource #0
|  Consumer got 1 from resource #0
|  Producer put 2 into resource #0
|  Consumer got 2 from resource #0
|  Producer put 3 into resource #0
|  Consumer got 3 from resource #0
|  Producer put 4 into resource #0
|  Consumer got 4 from resource #0
|  Producer put 5 into resource #0
|  Consumer got 5 from resource #0
|  Producer put 6 into resource #0
|  Consumer got 6 from resource #0
|  Producer put 7 into resource #0
|  Consumer got 7 from resource #0
|  Producer put 8 into resource #0
|  Consumer got 8 from resource #0
|  Producer put 9 into resource #0
|  Consumer got 9 from resource #0
| ### Done

hostcheck.php (NOT WORKING CORRECTLY, threads do not get joined)
| --- Trying test.edu:443
| --- Trying php3.de:25
| --- Trying blup.blop:1010
| --- Trying localhost:80
| --- Trying localhost:6100
|   -ERR test.edu:443 [-1078991188]: getaddrinfo: null result pointer
|   +OK php3.de:25
|   -ERR blup.blop:1010 [-1079200356]: getaddrinfo: null result pointer
| === Destruct thread for blup.blop:1010
|   +OK localhost:80
| === Destruct thread for localhost:80
|   -ERR localhost:6100 [61]: Connection refused
| === Destruct thread for localhost:6100
| DONE
| === Destruct thread for test.edu:443
| === Destruct thread for php3.de:25

The ideas for the examples were taken from
http://java.sun.com/docs/books/tutorial/essential/threads/index.html

4. Problems:

- Mysterious things happen at the moment: E.g., global variables dissapear,
  fatal errors in run() lead to a failed longjmp() and therefore to Abort
  trap, join() doesn't return the correct value (mostly returning NULL:
  I guess this has to do with the thread's EG(retval_ptr_ptr) overwriting
  one another(?)).
  
- This does NOT work with ZTS, there are 

Re: [PHP-DEV] Why parent::construct not called?

2003-02-23 Thread Timm Friebe
On Sun, 2003-02-23 at 18:04, michel 'ziobudda' morelli wrote:
 Il dom, 2003-02-23 alle 17:32, Marcus Börger ha scritto:
  You can do the following:
  class base {
   function __construct() {
   echo base::__construct()\n;
   }
 [...]
 
 I know know.
 
 What I want to understand is why the base::__construct() is  called (in
 automatic) only when derived::__constuct() is missing. 

Because (from a user's point of view) the constructor is inherited just
like any other function.

 I think that or the base::__construct() is always in automatic called or
 it is always never called (in automatic).

Well, because there might be situations in which I'd like to call the
parent's constructor before my code in __construct, sometimes after it
and in some situations, not call it at all.

- Timm


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



Re: [PHP-DEV] sybase_ct batch query security issue

2003-02-19 Thread Timm Friebe
On Tue, 2003-02-18 at 20:24, moshe doron wrote:
 there is security case here e.g, allowing the cracker chain DELETE FROM X to
 SELECT * FROM X WHERE ID=$id where the $id is got via the url without 
 checking (most of the cases).
You're right - thanks for mentioning this.

- Timm


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




Re: [PHP-DEV] sybase_ct batch query

2003-02-14 Thread Timm Friebe
On Fri, 2003-02-14 at 14:37, Michael Ulbrich wrote:
 Hi there,
Hi,

 here's a small patch for sybase_query() in ext/sybase_ct.c which gives
 some extended functionality in that it allows to send batch queries from
 php to the Sybase backend.
I'll have a look at it as soon as possible.

Hello from Karlsruhe to Berlin:) - Timm


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




Re: [PHP-DEV] Weird PHP5 APXS libtools errors

2003-02-13 Thread Timm Friebe
On Thu, 2003-02-13 at 09:52, John Coggeshall wrote:
 From HEAD:
[...]
 libtool: s%^.*/%%: No such file or directory
 libtool: -e: command not found
 libtool: -e: command not found
 libtool: -e: command not found
 libtool: -e: command not found
 libtool: -e: command not found
 (more of these)

Try
$ SED=sed ./configure ...
or 
$ export SED=sed
$ ./configure ...

Somehow, the variable SED is not set.

- Timm


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




Re: [PHP-DEV] php4-STABLE-200302051830 and imap PB

2003-02-06 Thread Timm Friebe
On Wed, 2003-02-05 at 21:45, Jean-Pierre Arneodo wrote:
[...]
 I received:
 ext/imap/php_imap.lo: In function `zm_startup_imap':
 home/php4-STABLE-200302051830/ext/imap/php_imap.c:432: undefined reference to 
`ssl_onceonlyinit'

Upgrading cclient to cclient-2002,1 worked for me.

- Timm



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




Re: [PHP-DEV] OO in PHP5 (was zend_API.c on php-dev)

2003-02-05 Thread Timm Friebe
On Tue, 2003-02-04 at 13:05, Harald Radi wrote:
 ?
 
 harald

Well, you were talking about throwing exceptions from within C
sourcecode, weren't you? You would need a zend_class_entry to throw -
but what should this point to? You would probably go ahead and declare
an exception class (in your extension, in the Zend Engine?) - which I do
not think of as a good idea due to the mentioned reasons.

- Timm



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




Re: [PHP-DEV] OO in PHP5 (was zend_API.c on php-dev)

2003-02-04 Thread Timm Friebe
On Mon, 2003-02-03 at 21:20, Harald Radi wrote:
[...]
 when called as function - print warning
 when called as method - throw exception

What exception? There are no builtin exceptions and IMHO it would be
better to leave writing such up to the user.

E.g. I'd like to be able to have _all_ my classes extend my Object
class, including my own Exception class. Plus, I prefer the Java style
notation Exception::getMessage, Exception::toString,
Exception::printStackTrace, Exception::getStackTrace,
Object::getClass.

If any exception class were to be integrated into PHP5, it would:
a) not extend my Object class
b) probably have methods such as get_message (following the PHP 
   naming conventions)
c) not have getStackTrace return an array of StackTraceElements.

Other users might prefer differing notations in their framework, will
disagree on inheritance issues with Object (this is unneccessary
bloat) or want a slightly different stack trace (consisting of an
associative array, not those stupid StackTraceElement things).

This has actually been discussed on the engine2-List and IIRC,
builtin-anything-classes being forced on users was decided against. Side
note: Whithin the mentioned thread, even amongst those liking the idea
of builtin exceptions, no consensus on how to name these classes could
we reached (Exception? exception? __exception?).

Conclusion: Don't even try to write exception classes for PHP5 in C. You
will never please all of the users' needs - so simply leave it up to
them.

- Timm



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




Re: [PHP-DEV] PROPOSAL: 'unless' control structure

2003-01-12 Thread Timm Friebe
On Sun, 2003-01-12 at 20:47, Sara Golemon wrote:
[...]
 This has been discussed (recently in fact) and won't be done.  However,
 you *can* give your code the type of readability you're looking for with:
 
 ($condition) || {
   /* This will only run if $condition evals to false */
 }

Nope, that gives me a parse error:

thekid@friebes:~   echo '? function unless($c) { return $c; } $c=
FALSE; unless($c) || print(!condition\n); ?' | php -q
!condition
thekid@friebes:~   echo '? function unless($c) { return $c; } $c=
FALSE; unless($c) || { print(!condition\n); } ?' | php -q

Parse error: parse error in - on line 1

It'll work for exactly one statement (e.g. mysql_connect() or die()),
but not with blocks (mysql_connect() or { mail(...); die(); })).

-- 
Timm Friebe [EMAIL PROTECTED]


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




[PHP-DEV] [Fwd: [Zend Engine 2] Rethinking overloaded calls]

2002-11-17 Thread Timm Friebe
FYI:

-Forwarded Message-

 From: Timm Friebe [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [Zend Engine 2] Rethinking overloaded calls
 Date: 17 Nov 2002 17:40:44 +0100
 
 I'd like to pick up on Alan Knowles' suggestion to php-dev from a couple
 of days ago. There was some +1s and some argumentation against it,
 saying we already have a standard: __get and __set.
 
 The thing is: __get and __set are only called for non-existant members.
 What Alan suggested is declaring getters and setters that would be
 always called. Come to think about it, what's the point anyway in having
 __get and __set only be called for non-existant members, anyway? I can
 see a nice usage for __call (for non-existant methods) - SOAP. __get and
 __set being called for non-existant members would make people construct
 ugly things such as [1] simply to have the functionality of getters and
 setters for their variables.
 
 It was argued that if getters and setters were introduced, there'd have
 to be an extra hashtable lookup for each set and get operation, which,
 of course, has a performance impact. Well, with the example[1] provided,
 the performance would be even worse due to the fact that the user is
 doing it in PHP. Plus, people who write OOP code do this because they
 want to make their code more maintainable. They don't do it for reasons
 of speed - they'd be writing their web applications with PHP embedded
 into HTML, not using functions (nevermind classes). Or they'd just ditch
 PHP and write it all in C. But that's not the point. Using OOP is about
 team work, maintainability and code reuse, which makes it more efficient
 since developers' time can be saved - and there is nothing as expensive
 as that. I can decide between employing one additional developer for
 half a year or simply buying another server. People in deciding
 positions buy bigger, better and faster hardware first.
 
 Just for proof of concept, I took Zend Engine 1 and some code from
 ext/overload and implemented getters and setters in a similar way
 suggested by Alan (see example [2]). In ZE2, this would be even easier
 since one would only need to patch the zend_std_write_property and
 zend_std_read_property functions.
 
 I know, of course, that in Zend Engine 2, I could simply use private or
 protected members and write getters and setters for them to ensure that
 noone goes ahead and abuses the API by directly using member
 variables, but this is valid for PHP, but not in C, AFAIS. Having Zend
 Engine take care of property access via API functions that could be used
 by ext/*-programmers would be of real benefit: With the OOP power
 provided by ZE2, we might one day see extensions written in C providing
 classes. The base PEAR class could be seamlessly integrated (./configure
 --with-pear=/usr/local/), for example, not requiring the user to
 actually know where (in the filesystem) the PEAR extension framework is,
 actually making PEAR a lot faster and (from the user's point of view)
 more integrated.
 
 I was actually think of doing exactly this for my own framework (which
 comes closer to the Java architecture) - I could boost performance by
 rewriting the base class Object in C and registering it as an internal
 class. It's required by any class within the framework anyway and thus
 parsed and compiled on every request (same goes for some other classes
 such as Exception, XPClass, ...). Then again, to hell with
 performance:-) - although it would probably make sense here.
 
 So here's my suggestion: Drop __get and __set in favor of declared
 getters and setters unless there's a good reason (I can't think of) to
 keep them. Keep __call since there's a point in having it[3]. It's not
 abusing the PHP way - think of how protected members have to be
 declared in child classes. Declaration makes things clear to programmers
 instead of having those magic __*-functions, makes code cleaner (just
 see [1] and imagine some more ifs or switch/case-statements there) and
 does not enforce coding standards on users (some might prefer
 set_lastchange, some setLastchange, some lastchange and _lastchange, for
 instance). Plus, always call getters and setters if declared.
 
 To save memory and gain performance, there could be some sort of member
 name mangling (as seen in private and protected members) instead of
 another two hashtables in zend_class_entry for getters and setters
 (assuming pointer arithmetic is faster than hashtable lookups).
 
 
 1] Example for work-around:
 class Forum::Article {
   var $_lastchange;
   // more property declarations
 
   function __set($k, $v) {
 if ('lastchange' == $k) {
   $this-_lastchange= is_a($v, 'Date') ? $v : new Date($v);
 }
 // more ifs or maybe a switch / case?
   }
 
   function __get($k) {
 if ('lastchange' == $k) return $this-_lastchange;
 // more ifs or maybe a switch / case?
   }
 }
 
 2] Example for new

Re: [PHP-DEV] Re: Updated getanyrr.patch, now dns_getrecord.patch

2002-11-17 Thread Timm Friebe
On Sun, 2002-11-17 at 21:01, Melvyn Sopacua wrote:
[...]
 $ uname -rs  ld -lresolv
 BSD/OS 4.3
 ld: cannot find -lresolv

Not here, either:-)

thekid@friebes:~  uname -rs  ld -lresolv
FreeBSD 4.7-STABLE
/usr/libexec/elf/ld: cannot find -lresolv

thekid@friebes:~  locate resolv|grep '\.so'
/usr/compat/linux/lib/libresolv-2.1.2.so
/usr/compat/linux/lib/libresolv.so.2

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




Re: [PHP-DEV] Sybase_ct and tli lib

2002-11-15 Thread Timm Friebe
On Fri, 2002-11-15 at 19:15, Brian Foddy wrote:
 I have a little more info to add.  Our DBA opened a question to Sybase 
 Tech support
 and received the following reply:
[...Explanation from Sybase...]
 I agree with his assessment that somehow, our root user is getting a 
 different run path, but frankly I can't find it.

Have you tried to strace httpd (strace -f httpd, or any of the apache
childs running mod_php w/ sybase?) This should show you which libraries
are used.

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




Re: [PHP-DEV] Sybase_ct and tli lib

2002-11-14 Thread Timm Friebe
On Wed, 2002-11-13 at 18:03, Brian Foddy wrote:
 Timm,
 
 I've seen it used for 10 years on Solaris, and I spent about
 a year working on Irix and Informix, and there were some
 references to it there also.  
 
 strings libtli.so | grep ^Sybase
 Sybase TCP/IP TLI Library/12.0/P/SPARC/Solaris 2.5.1/1/OPT/Sat Sep 25 
 21:07:40 1999
 Sybase, Inc.  All rights reserved.
 Sybase, Inc. 6475 Christie Avenue, Emeryville, CA 94608, USA

OK, so it should probably be added for those systems. 

A line like this should be added to config.m4 (wrapped for readability),
could you provide the second parameter here:

PHP_CHECK_LIBRARY(
  tli, 
  ---???---,
  [PHP_ADD_LIBRARY(tli,,SYBASE_CT_SHARED_LIBADD)],
  [],
  [-L$SYBASE_CT_LIBDIR]
)

or is maybe the pure existance of this file enough:

thekidfriebes:~/devel/php/php4  cvs diff ext/sybase_ct/config.m4 
Index: ext/sybase_ct/config.m4
===
RCS file: /repository/php4/ext/sybase_ct/config.m4,v
retrieving revision 1.11
diff -u -r1.11 config.m4
--- ext/sybase_ct/config.m4 12 Mar 2002 16:36:30 -  1.11
+++ ext/sybase_ct/config.m4 14 Nov 2002 12:07:33 -
 -44,7 +44,11 
 ],[ 
   $SYBASE_CT_LIBS 
 ])
-  
+
+if test -f $SYBASE_CT_LIBDIR/libtli.so ; then
+  PHP_ADD_LIBRARY(tli,, SYBASE_CT_SHARED_LIBADD)
+  SYBASE_CT_LIBS=$SYBASE_CT_LIBS -ltli
+fi


-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




[PHP-DEV] ext/overload API

2002-11-14 Thread Timm Friebe
Hello,
Andrei, as I can see, you're the author of ext/overload. As suggested
earlier, I've added a second parameter to sybase_fetch_object() which
allows users to pass an object to be filled with the results from the
fetched row (e.g. $article= sybase_fetch_object($q, new Article()); or
$article= sybase_fetch_object($q, 'Article')).

Well, if Article is an overloaded class, they'd probably expect that
their __set*-handlers are called when the object's properties are set.
Of course, object_and_properties_init() does not do this. But indeed,
it'd be quite nice if they would.

Thus, one would need the C functions call_get_handler and
call_set_handler to be declared not static but PHPAPI (is this right?)
and an additional method to test if a zend_class_entry is overloaded.

* http://sitten-polizei.de/php/overload.patch
  would make it work. Maybe macros would be a better way?

* http://sitten-polizei.de/php/sybase_ct.patch
  shows a sample usage (btw, is there any documentation on TSRM?)
  maybe _set_object_prop should be moved to ext/overload as a 
  utiltiy function?

I came up with this since I use sybase resultsets within SOAP, clearly
needing to distinguish strings from datetime types, int, floats and so
on. My first idea was to introduce a function
sybase_bind_datatype(SYBASE_DATETIME, 'Date')
but why not make use of an already existing and powerful extension?

Maybe an example illustrates best what you'd be able to do:

Example
---
?php
  class Date {
var $_u;

function Date($m) {
  switch (gettype($m)) {
case 'string': $this-_u= strtotime($m); break;
case 'integer': $this-_u= $m; break;
  }
}

// [...]
  }

  class Article {
var $article_id, $caption, $text, $lastchange;

function __set($k, $v) {
  $this-$k= $v;
  return TRUE;
}

function __get($k) {
  return $this-$k;
}

function __set_lastchange($val) {
  $this-lastchange= new Date($val);
  return TRUE;
}

// [...]
  }

  overload('Article');

  // [...]
  $q= sybase_query(
'select article_id, caption, text, lastchange from article',
$dbh
  );
  while ($article= sybase_fetch_object($q, 'Article')) {
var_dump($article);
  }
  // [...]
?

Sample Output
-
object(article)(4) {
  [article_id]=
  int(6100)
  [caption]=
  string(7) Caption
  [text]=
  string(19) This is the text:-)
  [lastchange]=
  object(date)(1) {
[_u]=
int(1025458800)
  }
}

- Timm



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




Re: [PHP-DEV] ext/overload API

2002-11-14 Thread Timm Friebe
On Thu, 2002-11-14 at 14:09, Timm Friebe wrote:
 Hello,
[...]
 function __get($k) {
   return $this-$k;
 }
[...]

Woops, this is wrong, of course.

function __get($k, $v) {
  $v= $this-$k;
  return TRUE;
}

I also missed that if a member variable exists, __get or __set won't be
called. I think this'd be quite useful though...

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




Re: [PHP-DEV] prototypes for getters and setters.

2002-11-13 Thread Timm Friebe
On Wed, 2002-11-13 at 02:31, Alan Knowles wrote:
 Thanks to a little chat (and a  few beers) with Zak at the conference, I 
 got wondering if this syntax would be a sensible addition...
[...]
 syntax:
var [getter method] [setter method] $variable .;
+1

Plus, another syntax suggestion (coming in closer to Delphi):
  [type] $var read [getter] write [setter] [= default_value];
e.g.
  var $variable read getBanana write setBanana = 12;

Maybe even adding the default keyword:
  [type] $var read [getter] write [setter] default [= default_value];
e.g.
  var $variable read getBanana write setBanana default = 12;

and array offsets as suggested in another mail:
  [type] $var[[]] read [getter] write [setter] default [=
default_value];
e.g.
  var $variable[] read getBanana write setBanana default = array();

or alternatively
  [type] $var read[[]] [getter] write[[]] [setter] default [=
default_value];
e.g.
  var $variable read[] getBanana write[] setBanana default = array();


-
[type] is either var, public, private or protected
-

The default property is probably best explained in this example:

  class StringList {
public $strings[] read get write put default = array();

function get($index) {
  return $this-strings[$index];
}

function put($index, $value) {
  $this-strings[$index]= $value;
}
  }

  $s= new StringList();
  $s['hello']= 'world';

This would be equivalent to 

  $s-strings['hello']= 'world';

and call

  $s-put('hello', 'world');

although the default property is probably quite a bitch to handle
parser-wise.

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




[PHP-DEV] Re: [Zend Engine 2] Errors and exceptions?

2002-11-12 Thread Timm Friebe
On Tue, 2002-11-12 at 07:54, Derick Rethans wrote:
 On 12 Nov 2002, Timm Friebe wrote:
[...]
 And that's why I would be -1 on the first one. However, the whole error 
 reporting is a pretty mess, with some extensions implementing other 
 'philosiphies' then others. Getting this all nice and clean is another 
 point we should address in PHP 5 (just like Stig mentioned).
+1

FYI, stats for ext/*/*:

E_WARNING   2092
E_NOTICE186
E_ERROR 128
E_CORE_WARNING  2
E_CORE_ERROR1

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




Re: [PHP-DEV] Sybase_ct and tli lib

2002-11-12 Thread Timm Friebe
On Tue, 2002-11-12 at 23:20, Brian Foddy wrote:
 The following is not really worthy of reporting an official bug,
 but still worthy of at least comment and notice.
 
 On Solaris 2.8 using Sybase OCS-12, the default build
 scripts for PHP 4.2.3 will not link in the tli library.

Never heard of tli before, and these three systems don't even have one
(PHP working fine on each of them):

FreeBSD, Sybase 11.0.3.3:
thekidfriebes:/usr/local/sybase/lib  ls -al *.so
-r-xr-xr-x  1 sybase  1002  303559 Mar 22  2000 libcomn.so
-r-xr-xr-x  1 sybase  1002   50771 Mar 22  2000 libcs.so
-r-xr-xr-x  1 sybase  1002  352659 Mar 22  2000 libct.so
-r-xr-xr-x  1 sybase  10028297 Mar 22  2000 libinsck.so
-r-xr-xr-x  1 sybase  1002   31380 Mar 22  2000 libintl.so
-r-xr-xr-x  1 sybase  1002  691945 Mar 22  2000 libsybdb.so
-r-xr-xr-x  1 sybase  1002   78630 Mar 22  2000 libsybtcl.so

SuSE, Sybase 12.5:
cia:/opt/sybase-12.5/lib # ls -al *.so
-r-xr-xr-x   1 sybase   sybase 427075 Nov  7  2000 libcomn.so
-r-xr-xr-x   1 sybase   sybase  60633 Nov  7  2000 libcs.so
-r-xr-xr-x   1 sybase   sybase 488501 Nov  7  2000 libct.so
-r-xr-xr-x   1 sybase   sybase  10802 Nov  7  2000 libinsck.so
-r-xr-xr-x   1 sybase   sybase  32765 Nov  7  2000 libintl.so
-r-xr-xr-x   1 sybase   sybase 419115 Nov  7  2000 libsrv.so
-r-xr-xr-x   1 sybase   sybase 880462 Nov  7  2000 libsybdb.so
-r-xr-xr-x   1 sybase   sybase 178687 Nov  7  2000 libsybtcl.so

Debian, Sybase 11.9.2:
heuer1:/usr/opt/sybase-11.9.2/lib# ls -al *.so
-r-xr-xr-x1 root root 3703 Jun  1 21:55 examples.so
-r-xr-xr-x1 root root   398293 Jun  1 21:55 libcomn.so
-r-xr-xr-x1 root root55936 Jun  1 21:55 libcs.so
-r-xr-xr-x1 root root   441107 Jun  1 21:55 libct.so
-r-xr-xr-x1 root root10139 Jun  1 21:55 libinsck.so
-r-xr-xr-x1 root root31922 Jun  1 21:55 libintl.so
-r-xr-xr-x1 root root 6508 Jun  1 21:55 libssencode.so
-r-xr-xr-x1 root root   132363 Jun  1 21:55 libssfile.so
-r-xr-xr-x1 root root 8113 Jun  1 21:55 libsstasks6.so
-r-xr-xr-x1 root root  1361512 Jun  1 21:55 libsstools6.so
-r-xr-xr-x1 root root   782151 Jun  1 21:55 libsybdb.so
-r-xr-xr-x1 root root   156706 Jun  1 21:55 libsybtcl.so
-r-xr-xr-x1 root root 6260 Jun  1 21:55 sybsyesp.so
-r-xr-xr-x1 root root18237 Jun  1 21:55 xpsmsgs.so

 Those familiar with Sybase have probably stubbed their toes
 on this library several times before; I've certainly have.

I've never needed to include it, not on SuSE, not on Debian nor on
FreeBSD. Could you run a strings | grep ^Sybase on libtli.so and send
me the output?

thekidfriebes:~  strings /usr/local/sybase/lib/libct.so|grep ^Sybase
Sybase Client-Library/10.0.4/P-FREE/FreeBSD Intel/FreeBSD 3.3-RELEASE
i386/1/Sat Mar 18 11:44:11 CET 2000
Sybase, Inc. 6475 Christie Avenue, Emeryville, CA 94608 USA.

[...]
 I found that without this library linked in, the web server
 would start (with sudo/suid) but the following error would be reported in
 the apache error log:
 
 Open Client Message:
 Message number: LAYER = (5) ORIGIN = (3) SEVERITY = (5) NUMBER = (131)
 Message String: ct_init(): network packet layer: internal net library 
 error: Attempt to load protocol driver failed
 
 And of course no Sybase connections would work.

This looks suspiciously like one of the problems the people where having
here:
http://dbforums.com/t518102.html
http://dbforums.com/archives/t50881.html

I also found this document (dated Dec. 30, 1999):
http://www.sybase.com/detail?id=1000925

Is there any chance you're lately upgraded your sybase installation?
http://groups.google.com/groups?hl=enlr=ie=UTF-8threadm=agjh46%24gu0%241%40reader01.singnet.com.sgrnum=3prev=/groups%3Fq%3Derror:%2BAttempt%2Bto%2Bload%2Bprotocol%2Bdriver%2Bfailed%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3Dagjh46%2524gu0%25241%2540reader01.singnet.com.sg%26rnum%3D3
or
http://groups.google.com/groups?hl=enlr=ie=UTF-8threadm=aps4uf%24jfp%241%40dcgate.bls.govrnum=1prev=/groups%3Fq%3Dlibtli.so%26hl%3Den%26lr%3D%26ie%3DUTF-8%26selm%3Daps4uf%2524jfp%25241%2540dcgate.bls.gov%26rnum%3D1
might help then (links may be wrapped)

 When I linked in the tli library, everything thing ok.
 I've attached a simple diff of the sybase_ct/config.m4 that
 I used to get the tli library included.

It would give me linker errors:-)

 I will be the first to admit, I really don't know why
 this library (or its absense) causes this behavior,
 nor do I really fully understand what the lib is supposed to
 do.  If someone can explain it to me, please try.
 Otherwise, I just try to remember this error message
 is usually related to the presents/absense of the
 tli library.
 
 Anyway I thought I would post this info in hopes it
 might lead to a better solution in the future.

I hope this helps. If it doesn't, maybe we'd need to add some checks to

[PHP-DEV] [Fwd: [CVS] karma for sybase docs]

2002-11-11 Thread Timm Friebe
Is [EMAIL PROTECTED] the wrong address to send this? There hasn't been any 
response on this so far (neither negative nor positive)...

-Forwarded Message-
 From: Timm Friebe [EMAIL PROTECTED]
 To: [EMAIL PROTECTED]
 Subject: [CVS] karma for sybase docs
 Date: 07 Nov 2002 12:39:42 +0100
 
 thekid@friebes:~/devel/php/phpdoc/en/reference/sybase  cvs com -m '-
 Added documentation for the new function sybase_fetch_assoc() (Timm)'
 functions/sybase-fetch-assoc.xml
  Access denied: insufficient karma
 (thekid|phpdoc/en/reference/sybase/functions)
  Contact [EMAIL PROTECTED] for access to
 phpdoc/en/reference/sybase/functions
 cvs server: Pre-commit check failed
 cvs [server aborted]: correct above errors first!
 
 I wrote up some documentation about my changes to ext/sybase_ct. 
 
 - Diff
 http://sitten-polizei.de/php/documentation.diff
 
 - New files
 http://sitten-polizei.de/php/sybase-fetch-assoc.xml
 http://sitten-polizei.de/php/sybase-set-message-handler.xml
 http://sitten-polizei.de/php/sybase-unbuffered-query.xml
 
 Could someone either apply these changes or give me the karma to do so?
 I could also provide documentation in German if needed.

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




Re: [PHP-DEV] Re: RfC: *_fetch_object()

2002-11-09 Thread Timm Friebe
On Fri, 2002-11-08 at 23:41, Yasuo Ohgaki wrote:
 I don't mind making pg_fetch_object() accept object (not class)
 optionally and initialize field values as object's properties.

What you're saying would be:

$a= pg_fetch_object($q, new Article());

It is certainly not common for PHP functions to accept new Something()
as a parameter. Although it is sexy, does it make sense to users? Why
would a fetch function accept an instance of an object? Just my .02
EUR:-)

 How about other db module maintainers?
 
 BTW, pg_fetch_object() accepted 3rd optional parameter
 for a long time. I've disabled it recently, since having
 $obj-1, $obj-2, and so on does not make much sense.

I've done away with them. If anyone for any reason still wants them,
(object)sybase_fetch_array($q) is the way to go.

- Timm



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




[PHP-DEV] RfC: *_fetch_object()

2002-11-08 Thread Timm Friebe
Hi,
what does everyone think about adding a second parameter to the
*_fetch_object() functions (sybase_fetch_object, mysql_fetch_object, ...
etc.) which allows users to define a class name which will then be used
instead of stdClass?

E.g.:
class Article {
var $article_id, $caption, $text;
}

$q= sybase_query('select * from article where article_id= 1');
if ($q) while ($a= sybase_fetch_object($q, 'Article')) {
var_dump($a);
}

This saves a couple of lines of code in PHP (formerly, you'd either put
all of article's attributes in the constructor, made the constructor
accept an associative array or assigned all of the attributes like this:

$a= new Article();
$a-article_id= $row['article_id'];
$a-caption= $row['caption'];
$a-text= $row['text'];

) all of which seems ugly and looks like unnecessary overhead. Since PHP
is missing a cast working on user-defined types (

while ($o= sybase_fetch_object($q)) {
$a= (Article)$o;
}

) there would be another suggestion to introduce a function cast:

while ($o= sybase_fetch_object($q)) {
$a= cast($o, 'Article');
}

Though maybe the name isn't ideal and could be implemented in userland,
too (
function cast($var, $type) {
// [...Handle non-objects and normal types...]
// [...Handle non-existant classes w/ name $type...]
$ret= new $type();
foreach (get_object_vars($var) as $k= $v) {
$ret-$k= $v;
}
return $ret;
}

) but with more performance issues than if it was built-in. Maybe it's
even simpler to allow (MyType)$var syntax, but this would have to be
introduced into Zend Engine.

Thoughts?

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




Re: [PHP-DEV] ext/sybase_ct commit?

2002-11-07 Thread Timm Friebe
On Thu, 2002-11-07 at 14:46, Andrei Zmievski wrote:
 On Sat, 02 Nov 2002, Timm Friebe wrote:
  Round 2 - fight:-)
  
  OK, I guess now I'm ready for committing my changes. I got PHP compiled
  and tested out the new functionality of my ext/sybase_ct changes against
  CVS from today.
  
  Just to make sure I'm getting it all right: This is what I'd put in the
  commit message
[...]
 Can you compress this down to a couple of entries?

Sorry, I committed it before you wrote your e-mail. I don't quite
understand why this should be shorter, though. This sort of was a
mega-patch... or is it generally better so write stuff like 

  Added new functions: sybase_unbuffered_query(), sybase_fetch_assoc(),
  sybase_set_message_handler(), see docs (Timm)

I personally think I'd rather like to see a somewhat verbose Changelog.
If this isn't what is wanted, I'll try and keep it shorter for future
commits.

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




[PHP-DEV] ltconfig - No such file or directory

2002-11-02 Thread Timm Friebe
Configuring Zend
checking build system type... i386-unknown-freebsd4.7
checking for ld used by GCC... /usr/libexec/elf/ld
checking if the linker (/usr/libexec/elf/ld) is GNU ld... yes
checking for BSD-compatible nm... /usr/bin/nm -B
updating cache ./config.cache
./ltconfig: Can't open ./ltconfig: No such file or directory
configure: error: libtool configure failed

What's going wrong?

$ automake --version
automake (GNU automake) 1.5
$ autoconf --version
Autoconf version 2.13
$ bison --version
bison (GNU Bison) 1.75
$ libtool --version
ltmain.sh (GNU libtool) 1.4.3 (1.922.2.110 2002/10/23 01:39:54)

I've also tried autoconf-2.53, which then does not produce the errors
that can be seen in buildconf.out, but still no difference: ltconfig is
not found.

What fails is:

/usr/local/bin/bash ./ltconfig --no-reexec --cache-file=/dev/null
--disable-shared --with-gcc --with-gnu-ld --no-verify ./ltmain.sh

executed from configure as of line 90'738:

# Actually configure libtool.  ac_aux_dir is where install-sh is found.
CC=$CC CFLAGS=$CFLAGS CPPFLAGS=$CPPFLAGS \
LD=$LD LDFLAGS=$LDFLAGS LIBS=$LIBS \
LN_S=$LN_S NM=$NM RANLIB=$RANLIB \
DLLTOOL=$DLLTOOL AS=$AS OBJDUMP=$OBJDUMP \
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig --no-reexec \
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $lt_target \
|| { { echo $as_me:$LINENO: error: libtool configure failed 5
echo $as_me: error: libtool configure failed 2;}
   { (exit 1); exit 1; }; }

Where (or when) is ltconfig created? Or why is it used? CVS log of
ltconfig (1.22) says: Remove ltconfig which is not used anymore by
libtool 1.4 - so why *is* it being used?

Maybe config.log helps, you can find it at
http://sitten-polizei.de/php/config.log (174 KB)

If I do a cvs update -r1.21 ltconfig, this error does not occur, but
then, later on:

checking whether dlsym() requires a leading underscore in symbol
names... ./configure: line 92000: syntax error near unexpected token
`_LT_AC_TRY_DLOPEN_SELF('
./configure: line 92000: `_LT_AC_TRY_DLOPEN_SELF('

which, as I guess, has something to do with the error mentioned in
buildconf-2.53.out. Where does this come from?

So, what I did to get all this running:
1) get ltconfig from CVS, r1.21
2) specify 'i386-portbld-freebsd4.7' at end of ./configure-line
   to get rid of warning you must specify host if --no-verify is set
3) comment out lines in configure that could'nt be expanded my m4
   (starting with _LT_AC_TRY_DLOPEN_SELF()
4) put SED='sed' into libtool (in php directory) since it was empty

This is some ugly hack, working for me, but this cannot be intended, can
it?

Sorry for being such a lamer: Timm

using default Zend directory
buildconf: checking installation...
buildconf: autoconf version 2.13 (ok)
buildconf: automake version 1.5 (ok)
buildconf: libtool version 1.4.3 (ok)
WARNING: automake and libtool are installed in different
 directories.  This may cause aclocal to fail.
 continuing anyway
rebuilding configure
autoconf: Undefined macros:
***BUG in Autoconf--please report*** AC_TRY_DLOPEN_SELF
configure.in:1124:AC_DEFINE([HAVE_BUILD_DEFS_H], 1, [ ])
configure.in:146:AC_MSG_RESULT(${1}.${2} (ok))
configure.in:232:AC_MSG_RESULT([$PHP_SAPI])
configure.in:284:  AC_DEFINE(HAVE_LIBDL, 1, [ ])
configure.in:409:  AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[Whether you have struct 
sockaddr_storage])
configure.in:418:[AC_DEFINE(HAVE_SOCKADDR_LEN,1,[Whether sockaddr struct has sa_len])],
configure.in:504:  AC_DEFINE(HAVE_GETADDRINFO,1,[Define if you have the getaddrinfo 
function])
configure.in:531:dnl AC_MSG_RESULT([$ac_cv_type_in_addr_t])
configure.in:533:  AC_DEFINE(in_addr_t, u_int, [ ])
configure.in:621:  AC_DEFINE(PHP_SAFE_MODE,1,[ ])
configure.in:623:  AC_DEFINE(PHP_SAFE_MODE,0,[ ])
configure.in:633:  AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,/usr/local/php/bin, [ ])
configure.in:634:  AC_MSG_RESULT([/usr/local/php/bin])
configure.in:636:  AC_DEFINE_UNQUOTED(PHP_SAFE_MODE_EXEC_DIR,$withval, [ ])
configure.in:637:  AC_MSG_RESULT([$withval])
configure.in:640:AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,/usr/local/php/bin, [ ])
configure.in:641:AC_MSG_RESULT([/usr/local/php/bin])
configure.in:644:  AC_DEFINE(PHP_SAFE_MODE_EXEC_DIR,/usr/local/php/bin, [ ])
configure.in:645:  AC_MSG_RESULT([/usr/local/php/bin])
configure.in:652:  AC_DEFINE(PHP_SIGCHILD, 1, [ ])
configure.in:654:  AC_DEFINE(PHP_SIGCHILD, 0, [ ])
configure.in:661:  AC_DEFINE(MAGIC_QUOTES, 1, [ ])
configure.in:663:  AC_DEFINE(MAGIC_QUOTES, 0, [ ])
configure.in:686:  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,1,[ ])
configure.in:688:  AC_DEFINE(DEFAULT_SHORT_OPEN_TAG,0,[ ])
configure.in:698:AC_DEFINE(HAVE_DMALLOC,1,[Whether you have dmalloc])
configure.in:709:  AC_DEFINE(HAVE_IPV6,1,[Whether to enable IPv6 support])
configure.in:728:  AC_DEFINE(HAVE_CRYPT,1,[ ]) 
configure.in:781:AC_MSG_RESULT([$PHP_VERSIONING])
configure.in:826:  AC_DEFINE(ZTS,1,[ ])
configure.in:947:AC_DEFINE_UNQUOTED(PHP_BUILD_DATE,$PHP_BUILD_DATE,[PHP build date])

[PHP-DEV] ext/sybase_ct commit?

2002-11-02 Thread Timm Friebe
Round 2 - fight:-)

OK, I guess now I'm ready for committing my changes. I got PHP compiled
and tested out the new functionality of my ext/sybase_ct changes against
CVS from today.

Just to make sure I'm getting it all right: This is what I'd put in the
commit message

- Implemented features/changes requested in Bug #16960 (Timm):
  . Added a new function sybase_unbuffered_query()
  . Added a new function sybase_fetch_assoc()
  . Added sybase_set_message_handler() which enables users to handle
server messages in a callback function
  . Added an ini entry for deadlock retries - retrying deadlocks 
can cause transaction state to break (sybct.deadlock_retry_count,
defaults to -1 forever).
  . Fixed sybase_fetch_object() not to return object with numeric
members
  . Fixed issues with identical fieldnames
  . Made sybase_fetch_*() functions return correct datatypes
  . Made phpinfo() section more verbose
  . Made sybase_query() error messages more verbose

I also wrote some documentation, the diffs against the current one are
available at:
http://sitten-polizei.de/php/documentation.diff

The added files are:
http://sitten-polizei.de/php/sybase-fetch-assoc.xml
http://sitten-polizei.de/php/sybase-set-message-handler.xml
http://sitten-polizei.de/php/sybase-unbuffered-query.xml

If needed, I could also provide documentation in German.

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




Re: [PHP-DEV] Re: Question about Classes

2002-10-30 Thread Timm Friebe
On Wed, 2002-10-30 at 23:34, [EMAIL PROTECTED] wrote:
 This works only with ZE2.
[...public and private functions...]

AFAIK not. There will be private, protected and public class members,
though.

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




[PHP-DEV] [CVS Questions] ext/sybase_ct

2002-10-29 Thread Timm Friebe
Hi,
from http://www.zend.com/zend/week/week109.php:
---
TLK: sybase_ct maintainer
Timm Friebe has volunteered to take over maintenance of the sybase_ct
extension.

He has made a number of patches to the code (which can be seen here) and
has been running then under a high-load production environment for over
a month.

At this stage these fixes may still be included in the next release
candidate for 4.3.0.
---
I'd love to see this happen, but - since I'm new to PHP development - I
would like to make sure what I'm doing (or going to do) is right.

README.CVS-RULES  1. Respect other people working on the project.

Last commit: 2002/03/12 - I guess there aren't too many people actively
working on ext/sybase_ct:)

README.CVS-RULES  2. Discuss any significant changes on the list 
   before committing. 

friebes:~/devel/php4/ext/sybase_ct  cvs diff php_sybase_ct.c |wc -l
1254
friebes:~/devel/php4/ext/sybase_ct  cvs diff php_sybase_ct.h |wc -l
  79
I guess this is significant.

[...]

README.CVS-RULES  5. If you don't know how to do something, ask first!

OK, that's simple. 
* Do I commit this against head or against php_4_3_0pre2? 
  (cvs com  cvs tag -F php_4_3_0pre2 or simply cvs com)? 

* buildconf says: You need bison version = 1.30 = 1.75 installed
  to build PHP from CVS - I'm running FreeBSD 4.7-STABLE, bison
  from ports is 1.35_1 *and* You need libtool version 1.4 or newer
  installed - libtool from ports is 1.3.4_4
  Are there other people here with FreeBSD and what do you do? 
  Compile your own libtool/bison?
  So far, I've stuck to snaps which worked fine for me...

* Who writes documentation? 
  http://bugs.php.net/bug.php?id=16960 contains working examples
  of the enhancement, more would come. Do I need special docs karma
  for this?

README.CVS-RULES  6. Test your changes before committing them. 
   We mean it. Really.

As promised, I compiled it into php-4.2.2 under FreeBSD and under Debian
on a production environment - it's served nearly 100 million HTTP
requests there by today and completed a couple of hundred thousand SQL
queries. *What* was tested is the old functionality, without relying on
new features, so that a switchback would be easily manageable in an
urgent situation. Though, since the majority of the new functionality is
handled via lines of source that are also called with the old api, it
should be OK. 

README.CVS-RULES  [...About CVS log...]
This is what I would write:

# Add myself to authors
- Take care of feature/changes requests by myself in (Bug #16960):
  * Implement unbuffered queries
  * Fix up sybase_fetch_object not to return objects with numeric
members
  * Fix issues with identical fieldnames
  * Set data types returned to their equivalents in PHP if possible
  * Add server message handler
  * Add a new ini setting for deadlock retries, defaulting to
forever. Deadlocks within transaction can cause transtate 
to output uncorrect values if they are retried.
  * Add a new function sybase_fetch_assoc
- Make sybase_query errors more verbose
- Make phpinfo() output more verbose
- Add mssql-aliases to all the new functionality

Is this too short? Or to long?

BUGS

There are four open bugs for ext/sybase_db. I don't use this extension
and its usage is discouraged anyway (see
http://www.isug.com/Sybase_FAQ/ASE/section7.html#7.2).

There is one open bug for ext/sybase_ct concerning compute results and
multiple results, pointing to:

* http://bugs.php.net/bug.php?id=11475
  This breaks functionality on further queries, producing weird 
  results. If you can't handle multiple resultsets, you *must* cancel
  them!

* http://bugs.php.net/bug.php?id=13735
  Bogus

* http://bugs.php.net/bug.php?id=12074
  Feature request for unbuffered_query:)

* http://bugs.php.net/bug.php?id=13475
  http://www.marden.org/php-sybase-ct/ gives me a 404
  I'll have a look at it nevertheless

TESTS
=
As I can only test my development on FreeBSD (4.3, 4.7) and FreeTDS
(0.60) w/ Sybase (11.0.3.3/Unix, 12.5/Linux, 12.5.0.1/Sun) and Debian w/
native Sybase-libraries Sybase (12.5/Linux, 12.5.0.1/Sun), I'd be happy
about any feedback on other systems and constellations.

Whew, I hope I'm not forgetting anything?

-- 
Timm
Any sufficiently advanced bug is indistinguishable from a feature


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




[PHP-DEV] CVS Account Request: thekid

2002-10-22 Thread Timm Friebe
Maintain ext/sybase_ct/ - see http://bugs.php.net/bug.php?id=16960 and mails on 
php-dev. The patches made have been running since Sept. 27th 2002 on three Debian 
boxes w/ PHP4.2.2, serving a total of 70 million HTTP requests and approx. 100'000 SQL 
queries without any problem. I guess you could call them stable.

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




Re: [PHP-DEV] default properties (in c)

2002-10-08 Thread Timm Friebe

On Tue, 2002-10-08 at 23:15, Tim Daly, Jr. wrote:
 
 Brad LaFountain [EMAIL PROTECTED] writes:
 
  What engine are you working with 1 or 2?
  -brad
 
 I imagine PHP3 == engine 1, and PHP4 == engine 2?
 
 I'm using PHP version 4.2.3.

Almost: PHP4 = ZE1, PHP5 = ZE2 :-)

-- 
Timm




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




Re: [PHP-DEV] segfault on adding empty heredoc to string

2002-09-01 Thread Timm Friebe

On Sun, 2002-09-01 at 19:50, Lukas Schroeder wrote:
 hi,
 
 i can crash my php here by using these lines:

Nope, works fine:
---
thekid@friebes:~  cat | php -q
?php 
$a = '';
$a .= EOF
EOF;
   
?
thekid@friebes:~  php -v 
4.2.1
thekid@friebes:~  uname -a
FreeBSD friebes.net 4.6-STABLE FreeBSD 4.6-STABLE #4: Mon Aug 26
23:06:34 CEST 2002 [EMAIL PROTECTED]:/usr/obj/usr/src/sys/GENERIC 
i386
---
friebe@php3:~  cat | php -q
?php 
$a = '';
$a .= EOF
EOF;   
?
friebe@php3:~  php -v 
4.2.1
friebe@php3:~  uname -a
Linux php3.de 2.4.18 #1 Sat Apr 20 16:15:17 CEST 2002 i686 unknown
(SuSE 7.2)
---
cgi@heuer1:~  cat | php4 -q
?php 
$a = '';
$a .= EOF
EOF;
?
cgi@heuer1:~  php4 -v
4.1.2
cgi@heuer1:~  uname -a
Linux heuer1 2.2.20 #1 SMP Mon Nov 5 14:36:30 CET 2001 i686 unknown
(Debian)
---

-- 
Timm


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




Re: [PHP-DEV] Re: [PHP-CVS] cvs: php4 /ext/standard info.c

2002-08-29 Thread Timm Friebe

On Thu, 2002-08-29 at 01:51, Yasuo Ohgaki wrote:
 Marcus Börger wrote:
  Not that mod_apache delivering txt format info pages would be
  unusable but a simple phpinfo(0|1) would be better.
  
 
 I would like to see phpinfo(true|false)

What about phpinfo(PHPINFO_OF_TEXT|PHPINFO_OF_HTML|...)

This way, new output formats could be easily added.

-- 
Timm



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




Re: [PHP-DEV] Sybase / patches

2002-08-27 Thread Timm Friebe

On Fri, 2002-08-23 at 00:24, Timm Friebe wrote:
 On Wed, 2002-08-21 at 10:22, Timm Friebe wrote:
 [...]
[...]
 3) I had a look at the memory thing (although unbuffered, all rows
that have been read will reside in memory until sybase_free_result()
is called). Changing this would make seeking backwards impossible:
 
$q= sybase_query('...');
sybase_data_seek($q, 3); // Seek forward to row #4
// [...]
sybase_data_seek($q, 0); // Seek back to first row
 
If this isn't needed with sybase_unbuffered_query() I'd (try to:-)) 
change the implementation to free the memory used after each call to
any of the sybase_fetch_* functions and document this behaviour
accordingly.

Here[1] is a quickhack for a version of sybase_unbuffered_query which
only uses memory for exactly one resultset.

Call it like this:
$q= sybase_unbuffered_query($sql, $dbh, FALSE);

The third parameter (bool store_result) is only available in
sybase_unbuffered_query() - it of course doesn't make sense for buffered
queries - is optional and default to TRUE (which is the current
behaviour).

The newest source can be found at
http://sitten-polizei.de/php/php_sybase_ct.c and
http://sitten-polizei.de/php/php_sybase_ct.h

(Download both, the header file has changed!)

-- 
Timm



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




[PHP-DEV] Sybase / patches

2002-08-21 Thread Timm Friebe

Hi,
in case you remember (if you don't, have a look at the thread [PHP-DEV]
Sybase - Error handlers beginning Aug. 7 2002):

I compiled my extension against PHP 4.2.2 / 4.2.1 / 4.1.2 recently,
doing some improvements and having to change some code due to API
incompatibilty (the original patch was against PHP 4.3.0 w/ ZE2).

I got it tested on Debian (woody) and FreeBSD 4.3-STABLE without
affections on existing source, segfaults or memory leaks, so I guess
this thing ought to be OK.

I even had time to write up some english documentation:
http://sitten-polizei.de/php/README.SYBASE.EN

Current sources:
http://sitten-polizei.de/php/php_sybase_ct.c
http://sitten-polizei.de/php/php_sybase_ct.h

After compiling, you should see:

Deadlock retry count: Unlimited
and
sybct.deadlock_retry_count,   -1

in the sybase_ct section of phpinfo().

Disclaimer:
---
The sybase_unbuffered_query() is experimental and misusage (using it
with inserts, closing the connection while reading or trying to fire up
another query directly after etc.) may result in unexpected results.
Maybe some more intense checks should be done. That's why it's
experimental.

Feedback welcome:-)

-- 
Timm



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




Re: [PHP-DEV] Sybase - Error handlers

2002-08-08 Thread Timm Friebe

On Thu, 2002-08-08 at 21:25, Brad LaFountain wrote:
 Do you currently use them (im just wondering how stable it is). I briefly
 looked at them. 

I've tested it a lot, it's not segfaulting or leaking AFAIS, I was
waiting for response before testing it - now that it's there, I'll have
it compiled into PHP (CGI and mod_php) running on a server which does a
couple of tenthousand queries a day (ordering website, cronjobs).

  I could use this type of functionality, unbuffered_query and error handler. Do
 you know why noone was interested in them?

Probably because either there is only a small percentage of people on
php-dev who use PHP together with Sybase, because my post simply got
burried between all the other messages coming in here every day or
because it was a feature request more than it was a bug.

  Well ill try to get around to testing them and see about getting them
 commited.

I'd like to see that happen:-)

Timm


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




Re: [PHP-DEV] Sybase - Error handlers

2002-08-08 Thread Timm Friebe

On Thu, 2002-08-08 at 21:50, Timm Friebe wrote:
 On Thu, 2002-08-08 at 21:25, Brad LaFountain wrote:
  Do you currently use them (im just wondering how stable it is). I briefly
  looked at them. 
 
 I've tested it a lot, it's not segfaulting or leaking AFAIS, I was
 waiting for response before testing it - now that it's there,
[...]

Uh: I've tested it a lot but not under real conditions, meaning: On
recordsets with 100 records, on a database server with one user (me)
logged on to it and therefore no dead locks occuring and on my
workstation and not on a server handling more than one request at a
time.

Should be getting away from the screen for today:-)

Timm



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




[PHP-DEV] Re: [Zend Engine 2] parent and deep requires

2002-06-22 Thread Timm Friebe

On Tue, 2002-06-11 at 00:04, Timm Friebe wrote:
 ZE2 has a bug...

Well, replying to myself:-)
I took some time to have a look at where the bugs occur (see my original
email to [EMAIL PROTECTED], sent 11 Jun 2002 00:04:09 +0200) and
think I got rid of them.

 concerning the keyword parent and the way it behaves
 erroneously in a situation like this:
[...Source...]
 thekid@friebes:~/devel/php-4.3.0-dev-zend2-alpha1  ./php -q
 test.ze2.php 
 int(2039)
 string(9) 2.0.0-dev
 string(9) 4.3.0-dev
 br /
 bWarning/b:  Missing argument 1 for __construct()
  in
 b/usr/home/thekid/devel/php-4.3.0-dev-zend2-alpha1/test.ze2.php/b on
 line b12/bbr /
 NULL
 === Result: object(ioexception)(1) {
   [message]=
   NULL
 }

The problem was the usage of the keyword parent and extending classes
while not overwriting - say - the constructor (or any other function) -
which then gets called for each inheritance. The problem had been fixed
in Zend Engine 1 in Version 1.200 - but since now scopes have been
introduced and everything works quite different,
CG(active_ce_parent_class_name) of course will not do.

http://cvs.php.net/diff.php/Zend/zend_compile.c?r1=1.199r2=1.200ty=u

Attached is a patch to zend_execute.c which does the job.

[...Source...]
 Moving the contents of C.class.php into test-2.ze2.php will work:
[...whereas if require()'d, it won't...] 
 I believe this is exactly the same as described in
 http://bugs.php.net/bug.php?id=12313 - maybe the patches made to ZE1
 then never made it to the ZE2 branch?

Well, sort of:-) The problem was with runtime inheritance which is
performed when classes extend classes in require()'d files, realized in
do_inherit_parent_constructor(zend_class_entry *ce) - searching for the
constructor by the name of the class only and not for __construct.
The hashtable lookups can be replaced by simply checking on and using
the much neater constructor field in zend_class_entry, I guess.
Last but not least, the runtime inheritance of the destructor was
completely forgotten, the attached patch to zend_compile.c solves both
issues.

Hope it helps  keep up the good work:-)

-- 
Timm Friebe


--- php-4.3.0-dev-zend2-alpha1/Zend/zend_compile.c	Tue Apr 23 20:06:53 2002
+++ php-4.3.0-dev-zend2-alpha1pl2/Zend/zend_compile.c	Sat Jun 22 21:16:00 2002
@@ -1475,19 +1476,19 @@
 	}
 }
 
-
-static void do_inherit_parent_constructor(zend_class_entry *ce)
+ 
+static void do_inherit_parent_special_methods(zend_class_entry *ce)
 {
-	if (ce-parent
-		 !zend_hash_exists(ce-function_table, ce-name, ce-name_length+1)) {
-		zend_function *function;
-
-		if (zend_hash_find(ce-parent-function_table, ce-parent-name, ce-parent-name_length+1, (void **) function)==SUCCESS) {
-			/* inherit parent's constructor */
-			zend_hash_update(ce-function_table, ce-name, ce-name_length+1, function, sizeof(zend_function), NULL);
-			function_add_ref(function);
-		}
-	}
+
+if (ce-parent) {
+if (!ce-constructor) 
+ce-constructor = ce-parent-constructor;
+
+if (!ce-destructor) 
+ce-destructor = ce-parent-destructor;
+
+/* FIXME: What to do with clone? */
+}
 }
 
 void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce)
@@ -1508,7 +1509,7 @@
 		ce-handle_property_set = parent_ce-handle_property_set;
 	if (!ce-handle_function_call)
 		ce-handle_function_call = parent_ce-handle_function_call;
-	do_inherit_parent_constructor(ce);
+	do_inherit_parent_special_methods(ce);
 }
 
 static void create_class(HashTable *class_table, char *name, int name_length, zend_class_entry **ce)
@@ -2129,7 +2130,7 @@
 
 void zend_do_end_class_declaration(znode *class_token TSRMLS_DC)
 {
-	do_inherit_parent_constructor(CG(active_class_entry));
+	do_inherit_parent_special_methods(CG(active_class_entry));
 	CG(active_class_entry) = class_token-u.previously_active_class_entry;
 	if (CG(active_ce_parent_class_name).value.str.val) {
 		efree(CG(active_ce_parent_class_name).value.str.val);


--- php-4.3.0-dev-zend2-alpha1/Zend/zend_execute.c	Wed May  8 20:43:19 2002
+++ php-4.3.0-dev-zend2-alpha1pl2/Zend/zend_execute.c	Sat Jun 22 21:15:51 2002
@@ -1818,7 +1818,9 @@
 			if (!EG(scope)-parent) {
 zend_error(E_ERROR, Cannot fetch parent:: as current class scope has no parent);
 			}
-			EX(Ts)[EX(opline)-result.u.var].EA.class_entry = EG(scope)-parent;
+			EX(Ts)[EX(opline)-result.u.var].EA.class_entry = EX(function_state).function-common.scope-parent; 
+  
 			NEXT_OPCODE();
 		} 



test-1.ze2.php
Description: application/php


test-2.ze2.php
Description: application/php

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


[PHP-DEV] sybase_fetch_row() and data types

2002-06-10 Thread Timm Friebe

Hello,
after having talked to Derick Rethans at LinuxTag and him suggesting I
put up a mail on php-dev about it, I guess I will give it a try.

The following is my issue:
http://bugs.php.net/bug.php?id=16960

Derick told me all of PHPs database extensions simpy return strings for
everything except NULLs and that changing this behaviour will brake code
existing out there. As I do not believe it will, this is why I felt it
might be worth discussing it.

As people rely on the fact (do they?) that what comes out of
sybase_fetch_row() is an array of strings, they will probably do
something like this to check on NULLs:

if (!$data['field_to_test_on_null_values']) { do_something(); }
This will, of course, not be broken. !(null) = !(false) = true

Whatever you do with fields containing numbers (int, float) will not be
affected by my patch either: $num= $data['count']+ 1; will be equivalent
whether $data['count'] is int(5) or string(1) 5, except PHP will no
longer need to automagically make string(1) 5 to int(5) before
performing the addition, right?

What I do right now:
--

  $result= sybase_query($sql, $this-handle);
  if (FALSE === $result) return FALSE;

  $i= -1;
  while (++$i  sybase_num_fields($result)) {
$field= sybase_fetch_field($result, $i);
$this-fields[$field-name]= $field-type;
  }

[...and later on, when fetching the results...]

   $row= sybase_fetch_array($query);
   if (FALSE === $row) return FALSE;
  
   foreach($row as $key= $val) {
 if ($val === FALSE) { $row[$key]= NULL; continue; }

 switch ($this-fields[$key]) {
   case 'bit':
   case 'int': 
 settype($row[$key], 'integer'); 
 break;

   case 'real':
 // very ugly [numeric(10) = int, numeric(10, 2) = double]
 if (floor($val) == $val) {
   settype($row[$key], 'integer');
 } else {
   settype($row[$key], 'double'); 
 }
 break;
 }
   }
--

...which of course is overhead. I'd like to get rid of it but of course
not break any code. My question is, is there anybody out there using
Sybase who can think of impacts from my patch(es)?

Greetings from Karlsruhe,
Timm


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