[PHP-DEV] Bug #13994: Can't execute function printer_open

2001-11-08 Thread dan

From: [EMAIL PROTECTED]
Operating system: windows 2000
PHP version:  4.0.6
PHP Bug Type: Unknown/Other Function
Bug description:  Can't execute function printer_open

using the following function
$handle = printer_open();

I get the error:
Fatal error: Call to undefined function: printer_open()



-- 
Edit bug report at: http://bugs.php.net/?id=13994edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] WDDX recordset deserialize

2001-11-08 Thread phillip

I have attatched a patch to do recordset, datetime, and field tags processing
during deserialization.

On Thu, 8 Nov 2001, Andrei Zmievski wrote:

 On Thu, 08 Nov 2001, [EMAIL PROTECTED] wrote:
  Hi all:
  
  I am thinking of a way to transform WDDX recordset element into PHP varialbles
  when deserializing the packet.
  
  It seems that all recordset will look like:
  
  var name=querynamerecordset rowcount=? fieldname=f1,f2,...fnfield
  name=f1.../field.../recordset/var
  
  The above can be transformed into:
  
  var name=querynamestringf1,f2,...fn/string/varvar
  name=f1array.../array/varvar name=f2array.../array/var...
  
  If we parse as this transformation, in PHP script:
  
  $values = wddx_deserialize($packet);
  $values[queryname] = f1,f2,...,fn;
  $values[f1] = values in array for f1 field;
  
  $values[fn] = values in array for fn field;
  
  
  Should this solve the recordset problem?
 
 Deserializing the recordset is not a problem, but creating one out of
 PHP values is since there is no exact mapping. It would be better to
 have it work both ways, but maybe deserialization only support at this
 point is fine.
 
 -Andrei

Phillip Pan
---


Index: wddx.c
===
RCS file: /home/phillip/CVS/php/ext/wddx/wddx.c,v
retrieving revision 1.1.1.1
diff -u -w -r1.1.1.1 wddx.c
--- wddx.c  2001/11/08 23:31:11 1.1.1.1
+++ wddx.c  2001/11/09 00:45:05
@@ -59,6 +59,9 @@
 #define EL_VAR var
 #define EL_VAR_NAMEname
 #define EL_VERSION version
+#define EL_RECORDSET   recordset
+#define EL_FIELD   field
+#define EL_DATETIMEdatetime
 
 #define php_wddx_deserialize(a,b) \
php_wddx_deserialize_ex((a)-value.str.val, (a)-value.str.len, (b))
@@ -95,6 +98,7 @@
 
 
 static void php_wddx_process_data(void *user_data, const char *s, int len);
+static void php_wddx_pop_element(void *user_data, const char *name);
 
 
 function_entry wddx_functions[] = {
@@ -561,7 +565,7 @@
/* nothing for now */
}
}
-   } else if (!strcmp(name, EL_STRING)) {
+   } else if (!strcmp(name, EL_STRING) || !strcmp(name, EL_DATETIME)) {
ent.type = ST_STRING;
SET_STACK_VARNAME;

@@ -650,12 +654,43 @@
stack-varname = decoded_value;
}
}
+   } else if (!strcmp(name, EL_RECORDSET)) {
+   int i;
+   ent.type = ST_STRING;
+   SET_STACK_VARNAME;
+
+   ALLOC_ZVAL(ent.data);
+   INIT_PZVAL(ent.data);
+   Z_TYPE_P(ent.data) = IS_STRING;
+   Z_STRVAL_P(ent.data) = empty_string;
+   Z_STRLEN_P(ent.data) = 0;
+   wddx_stack_push((wddx_stack *)stack, ent, sizeof(st_entry));
+   for ( i = 0; atts[i]; i++ ) {
+   if (!strcmp(atts[i], fieldNames)) {
+   break;
}
-   /*
-   else if (!strcmp(name, EL_RECORDSET)) {
-   ent.type = ST_RECORDSET;
}
-   */
+   php_wddx_process_data(user_data, atts[i++], strlen(atts[i++]));
+   php_wddx_pop_element(user_data, EL_STRING);
+   } else if (!strcmp(name, EL_FIELD)) {
+   int i;
+
+   for (i=0; atts[i]; i++) {
+   if (!strcmp(atts[i], EL_VAR_NAME)  atts[i+1]) {
+   char *decoded_value;
+   int decoded_len;
+   decoded_value = 
+xml_utf8_decode(atts[i+1],strlen(atts[i+1]),decoded_len,ISO-8859-1);
+   stack-varname = decoded_value;
+   }
+   }
+   ent.type = ST_ARRAY;
+   SET_STACK_VARNAME;
+
+   ALLOC_ZVAL(ent.data);
+   array_init(ent.data);
+   INIT_PZVAL(ent.data);
+   wddx_stack_push((wddx_stack *)stack, ent, sizeof(st_entry));
+   }
 }
 
 
@@ -675,7 +710,8 @@
if (!strcmp(name, EL_STRING) || !strcmp(name, EL_NUMBER) ||
!strcmp(name, EL_BOOLEAN) || !strcmp(name, EL_NULL) ||
!strcmp(name, EL_ARRAY) || !strcmp(name, EL_STRUCT) ||
-   !strcmp(name, EL_BINARY)) {
+   !strcmp(name, EL_BINARY) || !strcmp(name, EL_FIELD) ||
+   !strcmp(name, EL_DATETIME)) {
wddx_stack_top(stack, (void**)ent1);
 
if (!strcmp(name, EL_BINARY)) {


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list 

[PHP-DEV] Bug #13995: continuation of bug #13866: strtok() misparses empty fields

2001-11-08 Thread rcpj

From: [EMAIL PROTECTED]
Operating system: OpenBSD 2.9-stable
PHP version:  4.0.6
PHP Bug Type: Strings related
Bug description:  continuation of bug #13866: strtok() misparses empty fields

If a string contains two delimiters side by side (i.e. an empty field),
strtok() treats the double delimiter as a single one and the results are
shifted into the wrong variable. The previous version of the bug kept the
second delimiter in the value returned by the function. This version does
not, but it returns the wrong substring.

PHP version is 4.2.0-dev

(how do I report the correct version on the report form? Shouldn't there be
at least a other?)

Example of the bug:
  
$String= field1|field2||field4;

$Item1=strtok($String,|);// $Item1: field1
$Item2=strtok(|);   // $Item2: field2
$Item3=strtok(|);// $Item3: field4
$Item4=strtok(|);// $Item4 is empty

compare the outputs of:

http://www.pierrejelenc.com/PHP/test-module.php(correct)
and
http://www.web-ho.com/PHP/test-module.php(incorrect)

-- 
Edit bug report at: http://bugs.php.net/?id=13995edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #13994 Updated: Can't execute function printer_open

2001-11-08 Thread cardinal

ID: 13994
Updated by: cardinal
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Bogus
Bug Type: Unknown/Other Function
Operating System: windows 2000
PHP Version: 4.0.6
New Comment:

You don't have the printer support enabled.  Not a bug.

Support questions about PHP are best answered on the appropriate mailing list.
http://php.net/support.php

Previous Comments:


[2001-11-08 20:04:05] [EMAIL PROTECTED]

using the following function
$handle = printer_open();

I get the error:
Fatal error: Call to undefined function: printer_open()








Edit this bug report at http://bugs.php.net/?id=13994edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] ?php= ? sytanx again

2001-11-08 Thread Yasuo Ohgaki

James Moore wrote:
   It isnt a question of technical reasons its a question
   of keeping the language clear, readable and concise.

I agree.

   Adding more magic functions here and there does not do
   that, lets leave it as it is and discourage people
   from using it, it makes code less obvious.

No objection to discourage use of ?, ?=,% and %= if there is
open tag with echo.

   PHP is pretty good at being self documenting, one of the aims of
   any Higher level language and this syntax is ambiguios and
   unclear as to what exactly it does.

?php= is less ambigiuos than ?= or %=. Lack of ?php= is
encouraging use of %= or ?=. IMHO.

Some people, including me, prefer to use open tag with echo
since it looks better on source *mostly* written in HTML.

We use template feature came with WISWYG HTML editor. Almost all
php values and ouputs are printed by open tag with echo. Getting
rid of template handling burden from PHP improves performance and
makes collaboration with HTML designer easier, since templates
and pages generated are almost complete HTML. It's possible
without open tag with echo, though.

I'm not sure how others feels, but it looks better and easier to
read for me if there is open tag with echo... With ?php echo or
?php print, it seems I need extra step in my brain to read.:)

Following HTML/PHP source is very simpile, but you might be
able to see the difference. For complex HTML/CSS with PHP, the
difference is obvious to me, at least.

html
head
title?php= CurrentTitle() ?/title
/head
body
table
tr
 td colspan=2?php= LoginStatus() ?/td
/tr
tr
td colspan=2?php= $Message ?/td
/tr
tr
 tdLogin Name/td
 td?php= $LoginName ?/td
/tr
tr
 tdFirst Name/td
 td?php= $FirstName ?/td
/tr
tr
 tdLast Name/td
 td?php= $LastName ?/td
/tr
tr
 tdLogin Options/td
 td?php= $LoginOptions ?/td
/tr
/table
/body
/html

With ?php echo, it seems I need extra step in my brain to read.
It may be related that I read/write Kanji. I guess it depends on
how you search patterns in text in your brain...

html
head
title?php echo CurrentTitle() ?/title
/head
body
table
tr
 td colspan=2?php echo LoginStatus() ?/td
/tr
tr
 td colspan=2?php echo $Message ?/td
/tr
tr
 tdLogin Name/td
 td?php echo $LoginName ?/td
/tr
tr
 tdFirst Name/td
 td?php echo $FirstName ?/td
/tr
tr
 tdLast Name/td
 td?php echo $LastName ?/td
/tr
tr
 tdLogin Options/td
 td?php echo $LoginOptions ?/td
/tr
/table
/body
/html

Since there is no ?php=, I use %= as follows currently.
It works fine, but it's not portable. % is not enabled by
default. Lack of ?php= is encouraging use of %= at least
for me.

html
head
title%= CurrentTitle() %/title
/head
body
table
tr
 td colspan=2%= LoginStatus() %/td
/tr
tr
 td colspan=2%= $Message %/td
/tr
tr
 tdLogin Name/td
 td%= $LoginName %/td
/tr
tr
 tdFirst Name/td
 td%= $FirstName %/td
/tr
tr
 tdLast Name/td
 td%= $LastName %/td
/tr
tr
 tdLogin Options/td
 td%= $LoginOptions %/td
/tr
/table
/body
/html

--
Yasuo Ohgaki




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #13996: Java crashing HTTP session

2001-11-08 Thread kyle

From: [EMAIL PROTECTED]
Operating system: RedHat 6.2
PHP version:  4.0.6
PHP Bug Type: Java related
Bug description:  Java crashing HTTP session

Whenever I execute any Java code inside of PHP (even simple things), the
HTTP session crashes and nothing is logged by Apache.


System Info:
RedHat 6.2
Apache 1.3.19
PHP 4.0.6
Sun JDK 1.3.1

PHP compile string:
'--with-apxs=/usr/local/psa/apache/bin/apxs'
'--prefix=/usr/local/psa/apache' '--with-mysql=/usr/local/psa/mysql'
'--with-system-regex' '--without-gd' '--without-pear' '--with-imap=/usr'
'--with-kerberos=/usr/kerberos' '--with-java=/usr/local/j2sdk-1_3_1'
'--without-imap-ssl' '--enable-sockets'
'--with-config-file-path=/usr/local/psa/apache/conf'

[Java] section of php.inijava.class.path
=/usr/local/psa/apache/lib/php/php_java.jar:/usr/local/jdk1.3/lib/tools.jar:/usr/local/jdk1.3/lib/dt.jar/usr/local/psa/apache/lib/php/php_java.jar:/usr/local/jdk1.3/lib/tools.jar:/usr/local/jdk1.3/lib/dt.jar
java.home =/usr/local/jdk1.3/jre/usr/local/jdk1.3/jre java.library
=/usr/local/jdk1.3/jre/lib/i386/libjava.so/usr/local/jdk1.3/jre/lib/i386/libjava.so
java.library.path
=/usr/local/psa/apache/lib/php/20001222:/usr/local/jdk1.3/jre/lib/i386:/usr/local/jdk1.3/jre/lib/i386/hotspot:/usr/local/jdk1.3/jre/lib/i386/native_threads


PHP code:

 
 ? 
  // get instance of Java class java.lang.System in PHP
  $system = new Java('java.lang.System');

  // demonstrate property access
  print 'Java version='.$system-getProperty('java.version').' br';
  print 'Java vendor=' .$system-getProperty('java.vendor').'  br';
  print 'OS='.$system-getProperty('os.name').' '.
  $system-getProperty('os.version').' on '.
  $system-getProperty('os.arch').' br';

  // java.util.Date example
  $formatter = new Java('java.text.SimpleDateFormat',
,  dd,  'at' h:mm:ss a );

  print $formatter-format(new Java('java.util.Date'));
?

Now, this runs fine from the command line:

/usr/local/psa/apache/bin/php
/usr/local/plesk/apache/vhosts/dominiopropio.net/httpdocs/test.php
X-Powered-By: PHP/4.0.6
Content-type: text/html
 
Java version=1.3.1_01 brJava vendor=Sun Microsystems Inc.  brOS=Linux
2.2.16-3 on i386 brThursday, November 08, 2001 at 11:38:51 PM Eastern
Standard Time

But when run through the browser it sits, and then stops loading with no
error either in the browser or apache logs.  Via telnet, the following
happens:

Escape character is '^]'.
GET /test.php
Connection closed by foreign host.

The HTTP connection is dropped instantly when the page is requested. 
Normal PHP runs fine.  If you need any other info please let me know.
-- 
Edit bug report at: http://bugs.php.net/?id=13996edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] ?php= ? sytanx again

2001-11-08 Thread Chuck Hagenbuch

Quoting Edin Kadribasic [EMAIL PROTECTED]:

 Combine that with incompatibility of PHP's short open tag with XML, and the 
 reason for having ?php= becomes clearer.

As Rasmus is probably tired of pointing out, this isn't much of an argument. 
This:

if ($i  4) {
...

is incompatible with XML (it'd have to be if ($i lt; 4) ...)

I find it unfortunate that there's a feature available with short tags on that 
isn't available with them off, because that means it's a feature that you can't 
use if you want to write code that'll work with anyone's php installation. But 
that's about it - I end up on the fence.

-chuck

--
Charles Hagenbuch, [EMAIL PROTECTED]
What was and what may be, lie, like children whose faces we cannot see, in the
arms of silence. All we ever have is here, now. - Ursula K. Le Guin

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Re: PGSQL async query functions and other utility functions

2001-11-08 Thread Yasuo Ohgaki
Yasuo Ohgaki wrote:

 I forgot to send the patch to the maintainer
 and the author, but I guess they
 noticed patch in php-dev.
 http://marc.theaimsgroup.com/?l=php-devm=100483599714646w=2


I would like to hear from Jouni and Zeev how you think about
async qeury and how it should be implemented.

I didn't want to touch existing code as much as possible. I'll fix
issues, such as clean up garbeges with async functions, later on
when design is fixed :) It does not change existing code.
Therefore, it's safe to apply to pgsql module to see how it can be
useful. (Benchmark result is exellent even without async connect
function) I would like to add features step by step so that I can
get feedback one by one, but if you prefer to commit it at once, I
can do that, too.

If nobody is working for async qeury now, I'll implement it
includingfail safe garbage handling, proper warnings, etc before
4.2.0RC hopefully.

What do you think?

--
Yasuo Ohgaki

 Anyway, the patch only includes functions that is easy to
 implement. I'll make any change if it is desired, name, coding
 style, etc. I'll make following changes. Please let me know, if
 you think other changes are needed.
  - add '_' to function names to confirm naming standard.
  - add a protorype function defined in pgsql.c
  - use zend_parse_parameters instead of zeng_get_parameters
 
 I'm planning to implement following functions to pgsql module in
 addition to the patch already sent.
 
 Comments/Objections are welcome.
 
 (I'll write functions that will be accepted or nobody start
 writing. :)
 
 == async query ==
 resource pg_aconnect(string conn_str)
 Connect to db. (nonblocking)
 
 int pg_poll(resouce conn)
 Poll async connection status. Return current status as constant.
 PG_POLLING_ACTIVE
 PG_POLLING_READING
 PG_POLLING_WRITING
 PG_POLLING_FAILED,
 PG_POLLING_OK,
 
 This function is not be avilable to Windows unless libpq is
 compiled with WIN32_NON_BLOCKING_CONNECTIONS.
 
 I'm not going to write interface for PQgetLineAsync.
 Anyone need PQgetLineAsync, also?
 
 == other libpq interface ==
 int pg_status([resource conn])
 Check connection status. Return value is connestion status constant.
 PG_CONNECTION_STARTED - connecting
 PG_CONNECTION_MADE - connected
 PG_CONNECTION_AWAITING_RESPONSE - connecting
 PG_CONNECTION_AUTH_OK - connecting
 PG_CONNECTION_SETENV - connecting
 
 int pg_reset([resource conn])
 Reconnect to db with the same value when connection is broken for
 some reason. Anyone need for async version?
 
 array pg_info([resource conn])
 Get connection info as array. Return contents of PQconninfoOption
 struct.
 
 == utility functions ==
 array pg_metadata(resource conn, string table [, int type])
 Get metadata from system catalog. Returns
 array('field_name' =
  array('id' = int,
'type' = int, (data type id)
'len' = int, (length, -1 for variable length)
'notnull' = bool,
'hasdefault' = bool));
 Does anyone need other metadata?
 
 array pg_convert(resource conn, string table, array fields [, int
 option])
 Convert values in assoc array fields = array(field_name =
 field_value) to appropriate format for SQL statement. Returns
 array converted.
 
 Add slashes to string. Add quotes around string. Set field_value
 to "NULL" for empty string, etc. If field_value is not set/empty
 and field default defined in system catalog, set default value.
 Raise warning if value is invalid for the field. For example,
 malformed date, string for integer is invalid.
 "option" is conversion option,
 PG_CONV_CHECK - check only
 PG_CONV_STRICT - raise warning for non faital error
 PG_CONV_QUOTE - add quote around values for vchar, text datetime.
 PG_CONV_SLASH - add slashes if it needed.
 PG_CONV_NULLCHK - check values are defined for NOT NULL fields.
 PG_CONV_NO_DEFAULT - ignore default value even if value is empty
 string.
 
 I also would like to implement pg_insert(), pg_update(),
 pg_delete(), pg_select() for simple query. These function will use
 pg_convert() and pg_metadata() internally.
 
 == other ==
 Provide ini entry to trun on/off async functions.
 I don't want to implement this, but I'm sure there will users use
 aysnc functions on persistent connection improper manner...
 
 libpq is thread safe from pgsql 7.0 as long as different
 connection is used.
 
 --
 Yasuo Ohgaki
 
 




_
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]


Re: [PHP-DEV] ?php= ? sytanx again

2001-11-08 Thread Edin Kadribasic

  Combine that with incompatibility of PHP's short open tag with XML, and
the
  reason for having ?php= becomes clearer.

 As Rasmus is probably tired of pointing out, this isn't much of an
argument.
 This:

 if ($i  4) {
 ...

 is incompatible with XML (it'd have to be if ($i lt; 4) ...)

That's not what I'm talking about. Last time I tried

?xml ...

with short open tag enabled, PHP gave me parse error.

Edin


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DEV] Re: Bug database

2001-11-08 Thread Edin Kadribasic

  Is it possible to get a mysql dump of the bug database? Preferably a
dump
  into a web-accessible directory run once a day or so.

 sure, it could be done. mind if i ask why?

Not at all. Mysql dump is poor man's database replication scheme :) I'd like
to run the database locally to get faster response times and to experiment
with some full-text search software. Are there any easier way to do this?

Edin


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] CVS Account Request: mehl

2001-11-08 Thread Michael P. Mehl

Want to enhance the PEAR collection, especially fix some bugs in PHPDoc.

-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




[PHP-DEV] Bug #13995 Updated: continuation of bug #13866: strtok() misparses empty fields

2001-11-08 Thread derick

ID: 13995
Updated by: derick
Reported By: [EMAIL PROTECTED]
Old Status: Open
Status: Closed
Bug Type: Strings related
Operating System: OpenBSD 2.9-stable
PHP Version: 4.0.6
New Comment:

This is the expected behavior. It conforms to alteast the C-libraries on Linux, Win32 
and Solaris.

Derick

Previous Comments:


[2001-11-08 20:29:57] [EMAIL PROTECTED]

If a string contains two delimiters side by side (i.e. an empty field), strtok() 
treats the double delimiter as a single one and the results are shifted into the wrong 
variable. The previous version of the bug kept the second delimiter in the value 
returned by the function. This version does not, but it returns the wrong substring.

PHP version is 4.2.0-dev

(how do I report the correct version on the report form? Shouldn't there be at least a 
other?)

Example of the bug:
  
$String= field1|field2||field4;

$Item1=strtok($String,|);// $Item1: field1
$Item2=strtok(|);   // $Item2: field2
$Item3=strtok(|);// $Item3: field4
$Item4=strtok(|);// $Item4 is empty

compare the outputs of:

http://www.pierrejelenc.com/PHP/test-module.php(correct)
and
http://www.web-ho.com/PHP/test-module.php(incorrect)






Edit this bug report at http://bugs.php.net/?id=13995edit=1


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]