[PHP-DEV] #50478 should be closed

2010-01-11 Thread marius adrian popa
bug should be closed
http://bugs.php.net/bug.php?id=50478

seems to be an firebirdclient freebsd port symlink issue
not a php problem

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



Re: [PHP-DEV] #50478 should be closed

2010-01-11 Thread Lester Caine

marius adrian popa wrote:

bug should be closed
http://bugs.php.net/bug.php?id=50478

seems to be an firebirdclient freebsd port symlink issue
not a php problem


Of cause it gets a little more complex since in this case it is the PHP make 
file that has the wrong information, but probably as a result of different 
install of firebird to use the embedded version? Could the problem have been 
fixed without editing the make file?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



[PHP-DEV] PHP 6 Bug Summary Report

2010-01-11 Thread internals
 PHP 6 Bug Database summary - http://bugs.php.net/

 Num Status Summary (108 total -- which includes 47 feature requests)
===[*General Issues]==
50189 Open   [PATCH] - unicode byte order difference between SPARC and x86
===[Apache related]===
47061 Open   User not logged under Apache
===[Apache2 related]==
44083 Open   virtual() not outputting results if zlib.output_compression = 
On
===[Arrays related]===
35277 Suspended  incorrect recursion detection
41758 Assigned   SORT_LOCALE_STRING broken for sort() in PHP6
43109 Open   array_intersect() emits unexpected no of notices when 2d array 
is passed as arg
48478 Open   Super-globals cannot be accessed with literal keys
===[COM related]==
45836 Open   cannot use com 
===[Compile Failure]==
42606 Open   unicode/constants.c relies on ICU draft api
44502 Suspended  Compiling ok with MySQL 5.0
49421 Open   Make failure with MySQL 6 and PHP 6.0-dev
50101 Open   [PATCH] - Avoid name clash between global and local variable
50237 Open   [PATCH] - Enable correct behaviour when building PHP6 with 
Sun's compilers 
===[Date/time related]
46948 Assigned   ext/date/lib/parse_tz.c:99: Memory leak: buffer
===[DOM XML related]==
49463 Open   setAttributeNS(http://www.w3.org/2000/xmlns/,xmlns,blah;) 
produces error
===[Filesystem function related]==
42110 Open   fgetcsv doesn't handle \n correctly in multiline csv record
44034 Open   FILE_IGNORE_NEW_LINES in FILE does not work as expected when 
lines end in \r\n
46688 Open   Return values differ from 5.3 and are also inconsistent
46689 Open   Downcoded notices suggest unfinished code in file system?
46990 Assigned   Passing UTF8 strings to filesystem functions produce wrong 
filenames
49479 Open   move_uploaded_file is dead
===[GD related]===
34992 Assigned   imageconvolution does not respect alpha
43899 Assigned   Problem in displaying right to left connected languages (like 
persian, arabic)
===[HTTP related]=
49273 Open   setcookie() segfaults the php process when adding a positive 
expires value
===[I18N and L10N related]
42471 Open   locale_set_default returns true on invalid locales
===[ICONV related]
48538 Open   iconv_strlen() does not reject invalid charset on PHP6
===[mcrypt related]===
46834 Assigned   Range of mcrypt functions fail on PHP 6.0
===[MySQL related]
44076 Assigned   mysql_result returns nothing with blob
===[ODBC related]=
39756 Open   [PATCH] Crashes in fetching resultsets with LONG ASCII columns 
from MaxDB
===[OpenSSL related]==
25614 Assigned   openssl_pkey_get_public() fails when given a private key
===[PDO related]==
35368 Suspended  PDO query does not work properly with serialize
49270 Open   configure fails if PHP source folder path contains spaces
50420 Open   pdo_sqlite.so: undefined symbol: sqlite3_libversion
===[Performance problem]==
50157 Open   [patch] Replace !strlen(...) with !*...
50238 Analyzed   [PATCH] - Using #defines to improve the performance of the 
TSRMG macro
50436 Open   [PATCH] - Improving multi-threaded performance by propagating 
TSRMLS_C
===[PostgreSQL related]===
48265 Open   Source and result of database have different encodings.
===[Program Execution]
39992 Open   proc_terminate() leaves children of child running
43784 Assigned   escapeshellarg removes % from given string
===[Reproducible crash]===
45107 Open   setting ext_dir to ./ (and other ini settings) causes apache 
crash
===[Scripting Engine problem]=
47154 Open   Object properties unset after setting.
49945 Open   Array in multipart/form-data
===[Session related]==
44860 Open  

[PHP-DEV] Bug #49955 can be closed

2010-01-11 Thread marius adrian popa
Bug  #49955 http://bugs.php.net/bug.php?id=49955 can be closed , i
have tested with php 5.3 latest snapshot
and firebird is on a remote host
in fact i have tested with two remote hosts one with firebird 2.1 and
one with firebird 2.5
I guess 1000 connections are enough to see if it's all ok
I got no error , it never reaches to die zone


cat 49955.php
?
$user='SYSDBA';
$password='masterkey';
$database=192.168.0.1:/var/lib/firebird/2.5/data/employee.fdb;
for ($i = 1; $i = 1000; $i++) {
echo $i;

$conFb = @ibase_pconnect($database, $user, $password)
 or die(Error when trying to connect!);
}
?


also tested from apache the scripts dies only when it reaches max
execution time , as expected for default php is 30 seconds
lynx http://localhost/49955.php

php versions tested: 5.3.3 snapshot (cli) (built: Jan 11 2010 13:19:54)

and 5.3.1 rc2 (cli) (built: Nov  2 2009 17:22:21) + apache module

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



[PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Jess Portnoy

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP extensions, 
among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied 
onto $PHP_PREFIX/include/php/ext, causing this following code to fail 
compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and 
php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,

--
May the source be with you,
Best regards,
Jess Portnoy

--- php-5.3.1/ext/mysqli/mysqli.c	2009-10-14 15:51:25.0 +0200
+++ php-5.3.1/ext/mysqli/mysqli.c.mod	2010-01-11 18:04:57.0 +0200
@@ -32,7 +32,9 @@
 #include ext/standard/php_string.h
 #include php_mysqli_structs.h
 #include zend_exceptions.h
+#ifdef MYSQLI_USE_MYSQLND
 #include ext/mysqlnd/mysqlnd_portability.h
+#endif
 
 ZEND_DECLARE_MODULE_GLOBALS(mysqli)
 static PHP_GINIT_FUNCTION(mysqli);
--- php-5.3.1/ext/mysqli/mysqli_api.c	2009-10-14 15:51:25.0 +0200
+++ php-5.3.1/ext/mysqli/mysqli_api.c.mod	2010-01-11 18:25:23.0 +0200
@@ -31,7 +31,9 @@
 #include php_globals.h
 #include ext/standard/info.h
 #include php_mysqli_structs.h
+#ifdef MYSQLI_USE_MYSQLND
 #include ext/mysqlnd/mysqlnd_portability.h
+#endif
 
 /* {{{ proto mixed mysqli_affected_rows(object link)
Get number of affected rows in previous MySQL operation */

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

Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Jess Portnoy

Just to clarify, this applies only to the 5_3 branch.

May the source be with you,
Best regards,
Jess Portnoy



Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP extensions, 
among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd 
copied onto $PHP_PREFIX/include/php/ext, causing this following code 
to fail compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and 
php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,



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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Andrey Hristov

 Hi Jess,
does it compile after that, because I guess it doesn't. We use some 
macros from that header file to be able to handle bit types correctly in 
mysqli, when libmysql is used.



#if MYSQL_VERSION_ID  50002
  if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) {
my_ulonglong llval;
char tmp[22];
switch (field_len[i]) {
  case 8:llval = (my_ulonglong)  bit_uint8korr(row[i]);break;
  case 7:llval = (my_ulonglong)  bit_uint7korr(row[i]);break;
  case 6:llval = (my_ulonglong)  bit_uint6korr(row[i]);break;
  case 5:llval = (my_ulonglong)  bit_uint5korr(row[i]);break;
  case 4:llval = (my_ulonglong)  bit_uint4korr(row[i]);break;
  case 3:llval = (my_ulonglong)  bit_uint3korr(row[i]);break;
  case 2:llval = (my_ulonglong)  bit_uint2korr(row[i]);break;
  case 1:llval = (my_ulonglong)  uint1korr(row[i]);break;
}

#endif

Best,
Andrey

Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP extensions, 
among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd copied 
onto $PHP_PREFIX/include/php/ext, causing this following code to fail 
compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and 
php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,




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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Jess Portnoy

Hi Andrey,

Yes, it compiled just fine with my patch.
Even loaded :)

May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

 Hi Jess,
does it compile after that, because I guess it doesn't. We use some 
macros from that header file to be able to handle bit types correctly 
in mysqli, when libmysql is used.



#if MYSQL_VERSION_ID  50002
  if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) {
my_ulonglong llval;
char tmp[22];
switch (field_len[i]) {
  case 8:llval = (my_ulonglong)  bit_uint8korr(row[i]);break;
  case 7:llval = (my_ulonglong)  bit_uint7korr(row[i]);break;
  case 6:llval = (my_ulonglong)  bit_uint6korr(row[i]);break;
  case 5:llval = (my_ulonglong)  bit_uint5korr(row[i]);break;
  case 4:llval = (my_ulonglong)  bit_uint4korr(row[i]);break;
  case 3:llval = (my_ulonglong)  bit_uint3korr(row[i]);break;
  case 2:llval = (my_ulonglong)  bit_uint2korr(row[i]);break;
  case 1:llval = (my_ulonglong)  uint1korr(row[i]);break;
}

#endif

Best,
Andrey

Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP extensions, 
among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd 
copied onto $PHP_PREFIX/include/php/ext, causing this following code 
to fail compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and 
php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,





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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Jess Portnoy

Reason is MYSQL_VERSION_ID is defined here:
ext/mysqlnd/mysqlnd_libmysql_compat.h:#define 
MYSQL_VERSION_ID   MYSQLND_VERSION_ID

And then, included here:
ext/mysqli/mysqli_mysqlnd.h:#include ext/mysqlnd/mysqlnd_libmysql_compat.h

Same is done with MySQL and PDO_MYSQL.

May the source be with you,
Best regards,
Jess Portnoy



Jess Portnoy wrote:

Hi Andrey,

Yes, it compiled just fine with my patch.
Even loaded :)

May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

 Hi Jess,
does it compile after that, because I guess it doesn't. We use some 
macros from that header file to be able to handle bit types correctly 
in mysqli, when libmysql is used.



#if MYSQL_VERSION_ID  50002
  if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) {
my_ulonglong llval;
char tmp[22];
switch (field_len[i]) {
  case 8:llval = (my_ulonglong)  bit_uint8korr(row[i]);break;
  case 7:llval = (my_ulonglong)  bit_uint7korr(row[i]);break;
  case 6:llval = (my_ulonglong)  bit_uint6korr(row[i]);break;
  case 5:llval = (my_ulonglong)  bit_uint5korr(row[i]);break;
  case 4:llval = (my_ulonglong)  bit_uint4korr(row[i]);break;
  case 3:llval = (my_ulonglong)  bit_uint3korr(row[i]);break;
  case 2:llval = (my_ulonglong)  bit_uint2korr(row[i]);break;
  case 1:llval = (my_ulonglong)  uint1korr(row[i]);break;
}

#endif

Best,
Andrey

Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP 
extensions, among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd 
copied onto $PHP_PREFIX/include/php/ext, causing this following code 
to fail compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and 
php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,







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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Andrey Hristov

Jess Portnoy wrote:

Reason is MYSQL_VERSION_ID is defined here:
ext/mysqlnd/mysqlnd_libmysql_compat.h:#define 
MYSQL_VERSION_ID   MYSQLND_VERSION_ID

And then, included here:
ext/mysqli/mysqli_mysqlnd.h:#include 
ext/mysqlnd/mysqlnd_libmysql_compat.h


Same is done with MySQL and PDO_MYSQL.

May the source be with you,
Best regards,
Jess Portnoy


MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if you 
use pre-5.0 libmysql headers this should not compile. the bit_ 
macros are specific to mysqlnd, not exposed by libmysql.


Andrey




Jess Portnoy wrote:

Hi Andrey,

Yes, it compiled just fine with my patch.
Even loaded :)

May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

 Hi Jess,
does it compile after that, because I guess it doesn't. We use some 
macros from that header file to be able to handle bit types correctly 
in mysqli, when libmysql is used.



#if MYSQL_VERSION_ID  50002
  if (mysql_fetch_field_direct(result, i)-type == MYSQL_TYPE_BIT) {
my_ulonglong llval;
char tmp[22];
switch (field_len[i]) {
  case 8:llval = (my_ulonglong)  bit_uint8korr(row[i]);break;
  case 7:llval = (my_ulonglong)  bit_uint7korr(row[i]);break;
  case 6:llval = (my_ulonglong)  bit_uint6korr(row[i]);break;
  case 5:llval = (my_ulonglong)  bit_uint5korr(row[i]);break;
  case 4:llval = (my_ulonglong)  bit_uint4korr(row[i]);break;
  case 3:llval = (my_ulonglong)  bit_uint3korr(row[i]);break;
  case 2:llval = (my_ulonglong)  bit_uint2korr(row[i]);break;
  case 1:llval = (my_ulonglong)  uint1korr(row[i]);break;
}

#endif

Best,
Andrey

Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP 
extensions, among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd 
copied onto $PHP_PREFIX/include/php/ext, causing this following code 
to fail compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c and 
php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,








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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Jess Portnoy

Hi Andrey,

I understand. If the the bit_ macros are specific to mysqlnd then 
perhaps their usage should also be protected by an #ifdef 
MYSQLI_USE_MYSQLND?


May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

Jess Portnoy wrote:

Reason is MYSQL_VERSION_ID is defined here:
ext/mysqlnd/mysqlnd_libmysql_compat.h:#define 
MYSQL_VERSION_ID   MYSQLND_VERSION_ID

And then, included here:
ext/mysqli/mysqli_mysqlnd.h:#include 
ext/mysqlnd/mysqlnd_libmysql_compat.h


Same is done with MySQL and PDO_MYSQL.

May the source be with you,
Best regards,
Jess Portnoy


MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if you 
use pre-5.0 libmysql headers this should not compile. the bit_ 
macros are specific to mysqlnd, not exposed by libmysql.


Andrey




Jess Portnoy wrote:

Hi Andrey,

Yes, it compiled just fine with my patch.
Even loaded :)

May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

 Hi Jess,
does it compile after that, because I guess it doesn't. We use some 
macros from that header file to be able to handle bit types 
correctly in mysqli, when libmysql is used.



#if MYSQL_VERSION_ID  50002
  if (mysql_fetch_field_direct(result, i)-type == 
MYSQL_TYPE_BIT) {

my_ulonglong llval;
char tmp[22];
switch (field_len[i]) {
  case 8:llval = (my_ulonglong)  bit_uint8korr(row[i]);break;
  case 7:llval = (my_ulonglong)  bit_uint7korr(row[i]);break;
  case 6:llval = (my_ulonglong)  bit_uint6korr(row[i]);break;
  case 5:llval = (my_ulonglong)  bit_uint5korr(row[i]);break;
  case 4:llval = (my_ulonglong)  bit_uint4korr(row[i]);break;
  case 3:llval = (my_ulonglong)  bit_uint3korr(row[i]);break;
  case 2:llval = (my_ulonglong)  bit_uint2korr(row[i]);break;
  case 1:llval = (my_ulonglong)  uint1korr(row[i]);break;
}

#endif

Best,
Andrey

Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP 
extensions, among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd 
copied onto $PHP_PREFIX/include/php/ext, causing this following 
code to fail compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c 
and php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,









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



[PHP-DEV] Re: Bug #49955 can be closed

2010-01-11 Thread marius adrian popa
On Mon, Jan 11, 2010 at 3:44 PM, marius adrian popa map...@gmail.com wrote:
 Bug  #49955 http://bugs.php.net/bug.php?id=49955 can be closed , i
 have tested with php 5.3 latest snapshot
 and firebird is on a remote host
 in fact i have tested with two remote hosts one with firebird 2.1 and
 one with firebird 2.5
 I guess 1000 connections are enough to see if it's all ok
 I got no error , it never reaches to die zone


 cat 49955.php
 ?
 $user='SYSDBA';
 $password='masterkey';
 $database=192.168.0.1:/var/lib/firebird/2.5/data/employee.fdb;
 for ($i = 1; $i = 1000; $i++) {
    echo $i;

 $conFb = @ibase_pconnect($database, $user, $password)
         or die(Error when trying to connect!);
 }
 ?


 also tested from apache the scripts dies only when it reaches max
 execution time , as expected for default php is 30 seconds
 lynx http://localhost/49955.php

 php versions tested: 5.3.3 snapshot (cli) (built: Jan 11 2010 13:19:54)

 and 5.3.1 rc2 (cli) (built: Nov  2 2009 17:22:21) + apache module


I found it why it doesn't work on windows , seems that the php zip
contains an very old gds32.dll
that must be replaced with something that is stable from firebird
2.1.x kit or 2.5.x
I have added the comments to the bug how to make it work

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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Andrey Hristov

Jess Portnoy wrote:

Hi Andrey,

I understand. If the the bit_ macros are specific to mysqlnd then 
perhaps their usage should also be protected by an #ifdef 
MYSQLI_USE_MYSQLND?


by specific I mean that mysqlnd introduces them but they are valid for 
everyone who wants to be able to decode BIT columns sent from the 
server. Without these macros BIT fields are useless in the client, can't 
be decoded.
Johannes did some change in a recent commit, but I am not sure if all of 
mysqlnd's headers are installed at make install. This should be the case 
or no extension that relies on mysqlnd will be able to compile as a 
module (with phpize).



May the source be with you,
Best regards,
Jess Portnoy



Best,
Andrey




Andrey Hristov wrote:

Jess Portnoy wrote:

Reason is MYSQL_VERSION_ID is defined here:
ext/mysqlnd/mysqlnd_libmysql_compat.h:#define 
MYSQL_VERSION_ID   MYSQLND_VERSION_ID

And then, included here:
ext/mysqli/mysqli_mysqlnd.h:#include 
ext/mysqlnd/mysqlnd_libmysql_compat.h


Same is done with MySQL and PDO_MYSQL.

May the source be with you,
Best regards,
Jess Portnoy


MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if you 
use pre-5.0 libmysql headers this should not compile. the bit_ 
macros are specific to mysqlnd, not exposed by libmysql.


Andrey




Jess Portnoy wrote:

Hi Andrey,

Yes, it compiled just fine with my patch.
Even loaded :)

May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

 Hi Jess,
does it compile after that, because I guess it doesn't. We use some 
macros from that header file to be able to handle bit types 
correctly in mysqli, when libmysql is used.



#if MYSQL_VERSION_ID  50002
  if (mysql_fetch_field_direct(result, i)-type == 
MYSQL_TYPE_BIT) {

my_ulonglong llval;
char tmp[22];
switch (field_len[i]) {
  case 8:llval = (my_ulonglong)  bit_uint8korr(row[i]);break;
  case 7:llval = (my_ulonglong)  bit_uint7korr(row[i]);break;
  case 6:llval = (my_ulonglong)  bit_uint6korr(row[i]);break;
  case 5:llval = (my_ulonglong)  bit_uint5korr(row[i]);break;
  case 4:llval = (my_ulonglong)  bit_uint4korr(row[i]);break;
  case 3:llval = (my_ulonglong)  bit_uint3korr(row[i]);break;
  case 2:llval = (my_ulonglong)  bit_uint2korr(row[i]);break;
  case 1:llval = (my_ulonglong)  uint1korr(row[i]);break;
}

#endif

Best,
Andrey

Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP 
extensions, among which MySQLi.
Since I did not configure with mysqlnd, I do not have ext/mysqlnd 
copied onto $PHP_PREFIX/include/php/ext, causing this following 
code to fail compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c 
and php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,










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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Jess Portnoy
I see but assuming mysqlnd is copied, I can still see a problem, in the 
configure script:

echo #define $php_def_have_what 1  ext/mysqlnd/php_mysqlnd_config.h
When running my configure:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


ext/mysqlnd/php_mysqlnd_config.h is not created and 
ext/mysqlnd/mysqlnd_portability.h attempts to include that and hence, 
even if the mysqlnd dir is copied to $PHP_PREFIX/include/php/ext 
regardless of your configure argument, there will still be a problem 
with this auto generated header.


May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

Jess Portnoy wrote:

Hi Andrey,

I understand. If the the bit_ macros are specific to mysqlnd then 
perhaps their usage should also be protected by an #ifdef 
MYSQLI_USE_MYSQLND?


by specific I mean that mysqlnd introduces them but they are valid for 
everyone who wants to be able to decode BIT columns sent from the 
server. Without these macros BIT fields are useless in the client, 
can't be decoded.
Johannes did some change in a recent commit, but I am not sure if all 
of mysqlnd's headers are installed at make install. This should be the 
case or no extension that relies on mysqlnd will be able to compile as 
a module (with phpize).



May the source be with you,
Best regards,
Jess Portnoy



Best,
Andrey




Andrey Hristov wrote:

Jess Portnoy wrote:

Reason is MYSQL_VERSION_ID is defined here:
ext/mysqlnd/mysqlnd_libmysql_compat.h:#define 
MYSQL_VERSION_ID   MYSQLND_VERSION_ID

And then, included here:
ext/mysqli/mysqli_mysqlnd.h:#include 
ext/mysqlnd/mysqlnd_libmysql_compat.h


Same is done with MySQL and PDO_MYSQL.

May the source be with you,
Best regards,
Jess Portnoy


MYSQL_VERSION_ID is also defined by libmysql/MySQL server. Only if 
you use pre-5.0 libmysql headers this should not compile. the 
bit_ macros are specific to mysqlnd, not exposed by libmysql.


Andrey




Jess Portnoy wrote:

Hi Andrey,

Yes, it compiled just fine with my patch.
Even loaded :)

May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

 Hi Jess,
does it compile after that, because I guess it doesn't. We use 
some macros from that header file to be able to handle bit types 
correctly in mysqli, when libmysql is used.



#if MYSQL_VERSION_ID  50002
  if (mysql_fetch_field_direct(result, i)-type == 
MYSQL_TYPE_BIT) {

my_ulonglong llval;
char tmp[22];
switch (field_len[i]) {
  case 8:llval = (my_ulonglong)  
bit_uint8korr(row[i]);break;
  case 7:llval = (my_ulonglong)  
bit_uint7korr(row[i]);break;
  case 6:llval = (my_ulonglong)  
bit_uint6korr(row[i]);break;
  case 5:llval = (my_ulonglong)  
bit_uint5korr(row[i]);break;
  case 4:llval = (my_ulonglong)  
bit_uint4korr(row[i]);break;
  case 3:llval = (my_ulonglong)  
bit_uint3korr(row[i]);break;
  case 2:llval = (my_ulonglong)  
bit_uint2korr(row[i]);break;

  case 1:llval = (my_ulonglong)  uint1korr(row[i]);break;
}

#endif

Best,
Andrey

Jess Portnoy wrote:

Hello all,

My configure command is as follows:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


I then archive the result and use it to build various PHP 
extensions, among which MySQLi.
Since I did not configure with mysqlnd, I do not have 
ext/mysqlnd copied onto $PHP_PREFIX/include/php/ext, causing 
this following code to fail compilation:

#include ext/mysqlnd/mysqlnd_portability.h

Attached is a suggested patch for php-5.3.1/ext/mysqli/mysqli.c 
and php-5.3.1/ext/mysqli/mysqli_api.c, basically:

+#ifdef MYSQLI_USE_MYSQLND
#include ext/mysqlnd/mysqlnd_portability.h
+#endif

Thanks in advance,











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



Re: [PHP-DEV] Re: Bug #49955 can be closed

2010-01-11 Thread Lester Caine

marius adrian popa wrote:

On Mon, Jan 11, 2010 at 3:44 PM, marius adrian popa map...@gmail.com wrote:

Bug  #49955 http://bugs.php.net/bug.php?id=49955 can be closed , i
have tested with php 5.3 latest snapshot
and firebird is on a remote host
in fact i have tested with two remote hosts one with firebird 2.1 and
one with firebird 2.5
I guess 1000 connections are enough to see if it's all ok
I got no error , it never reaches to die zone


cat 49955.php
?
$user='SYSDBA';
$password='masterkey';
$database=192.168.0.1:/var/lib/firebird/2.5/data/employee.fdb;
for ($i = 1; $i = 1000; $i++) {
   echo $i;

$conFb = @ibase_pconnect($database, $user, $password)
or die(Error when trying to connect!);
}
?


also tested from apache the scripts dies only when it reaches max
execution time , as expected for default php is 30 seconds
lynx http://localhost/49955.php

php versions tested: 5.3.3 snapshot (cli) (built: Jan 11 2010 13:19:54)

and 5.3.1 rc2 (cli) (built: Nov  2 2009 17:22:21) + apache module



I found it why it doesn't work on windows , seems that the php zip
contains an very old gds32.dll
that must be replaced with something that is stable from firebird
2.1.x kit or 2.5.x
I have added the comments to the bug how to make it work


Actually marius - it contains an INTERBASE client as it is an interbase 
extension. This was another reason for perhaps now switching to php_firebird, 
and using the fbird_xxx aliases as was planned from PHP5.0 days. The WINDOWS 
builds are supposed only to be made against the correct libraries, with the 
correct M$ compiler version, so building php_interbase against a firebird 
library breaks the rules anyway?


--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Andrey Hristov

 Hi Jess,
Jess Portnoy wrote:
I see but assuming mysqlnd is copied, I can still see a problem, in the 
configure script:

echo #define $php_def_have_what 1  ext/mysqlnd/php_mysqlnd_config.h
When running my configure:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


ext/mysqlnd/php_mysqlnd_config.h is not created and 
ext/mysqlnd/mysqlnd_portability.h attempts to include that and hence, 
even if the mysqlnd dir is copied to $PHP_PREFIX/include/php/ext 
regardless of your configure argument, there will still be a problem 
with this auto generated header.


May the source be with you,
Best regards,
Jess Portnoy



Possible solution is to copy the macros from mysqlnd_portability.h to 
mysqli and use ifndef to define them, if mysqlnd_portability.h is not 
available. Hopefully the code will compile without the need to typedef 
types as the macros use C99 types (uintXX_t) which should be available 
mostly anywhere.


Best,
Andrey

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



Re: [PHP-DEV] [PATCH] Attempt to include ext/mysqlnd/mysqlnd_portability.h when building MySQLi against libmysql

2010-01-11 Thread Jess Portnoy

Hi Andrey,

Sounds good to me. Would you like me to test and submit a patch or will you?

May the source be with you,
Best regards,
Jess Portnoy



Andrey Hristov wrote:

 Hi Jess,
Jess Portnoy wrote:
I see but assuming mysqlnd is copied, I can still see a problem, in 
the configure script:

echo #define $php_def_have_what 1  ext/mysqlnd/php_mysqlnd_config.h
When running my configure:
./configure --disable-xml --disable-dom --disable-libxml 
--disable-simplexml --without-pear --disable-xmlreader 
--disable-xmlwriter --without-iconv


ext/mysqlnd/php_mysqlnd_config.h is not created and 
ext/mysqlnd/mysqlnd_portability.h attempts to include that and hence, 
even if the mysqlnd dir is copied to $PHP_PREFIX/include/php/ext 
regardless of your configure argument, there will still be a problem 
with this auto generated header.


May the source be with you,
Best regards,
Jess Portnoy



Possible solution is to copy the macros from mysqlnd_portability.h to 
mysqli and use ifndef to define them, if mysqlnd_portability.h is not 
available. Hopefully the code will compile without the need to typedef 
types as the macros use C99 types (uintXX_t) which should be available 
mostly anywhere.


Best,
Andrey


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



[PHP-DEV] __toString(), __toArray()

2010-01-11 Thread Clint Priest
I know there's been requests to add a __toArray() and most of the 
arguments against it is that there are too many magic functions already. 
 I just thought I'd propose an alternative that would satisfy all of them.


Why not a __cast($Type) magic function?

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



[PHP-DEV] Re: svn: /php/php-src/ branches/PHP_5_2/main/php_version.h branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_stat

2010-01-11 Thread Sebastian Bergmann
Am 11.01.2010 19:31, schrieb Andrey Hristov:
 Modified: php/php-src/branches/PHP_5_2/main/php_version.h
 ===
 --- php/php-src/branches/PHP_5_2/main/php_version.h   2010-01-11 18:27:31 UTC 
 (rev 293417)
 +++ php/php-src/branches/PHP_5_2/main/php_version.h   2010-01-11 18:31:02 UTC 
 (rev 293418)
 @@ -2,7 +2,7 @@
  /* edit configure.in to change version number */
  #define PHP_MAJOR_VERSION 5
  #define PHP_MINOR_VERSION 2
 -#define PHP_RELEASE_VERSION 13
 -#define PHP_EXTRA_VERSION -dev
 -#define PHP_VERSION 5.2.13-dev
 -#define PHP_VERSION_ID 50213
 +#define PHP_RELEASE_VERSION 12
 +#define PHP_EXTRA_VERSION RC4-dev
 +#define PHP_VERSION 5.2.12RC4-dev
 +#define PHP_VERSION_ID 50212

 I am pretty sure you did not intend to commit the above change.

-- 
Sebastian BergmannCo-Founder and Principal Consultant
http://sebastian-bergmann.de/   http://thePHP.cc/


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



Re: [PHP-DEV] Re: svn: /php/php-src/ branches/PHP_5_2/main/php_version.h branches/PHP_5_3/ext/mysqlnd/mysqlnd.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_statistics.c branches/PHP_5_3/ext/mysqlnd/mysqlnd_

2010-01-11 Thread Andrey Hristov

Sebastian Bergmann wrote:

Am 11.01.2010 19:31, schrieb Andrey Hristov:

Modified: php/php-src/branches/PHP_5_2/main/php_version.h
===
--- php/php-src/branches/PHP_5_2/main/php_version.h 2010-01-11 18:27:31 UTC 
(rev 293417)
+++ php/php-src/branches/PHP_5_2/main/php_version.h 2010-01-11 18:31:02 UTC 
(rev 293418)
@@ -2,7 +2,7 @@
 /* edit configure.in to change version number */
 #define PHP_MAJOR_VERSION 5
 #define PHP_MINOR_VERSION 2
-#define PHP_RELEASE_VERSION 13
-#define PHP_EXTRA_VERSION -dev
-#define PHP_VERSION 5.2.13-dev
-#define PHP_VERSION_ID 50213
+#define PHP_RELEASE_VERSION 12
+#define PHP_EXTRA_VERSION RC4-dev
+#define PHP_VERSION 5.2.12RC4-dev
+#define PHP_VERSION_ID 50212


 I am pretty sure you did not intend to commit the above change.



so I reverted it :)

Andrey

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



[PHP-DEV] ext/intl/tests/rb_build.php and svnclean

2010-01-11 Thread Johannes Schlüter
Hi,

the file ext/intl/tests/rb_build.php  will be removed by svnclean as it
matches the *.php pattern from ext/intl/tests/'s ignore. Is there a way
to change the svn ignore pattern to work-around this or can the file be
renamed/moved?

johannes



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



[PHP-DEV] Re: ext/intl/tests/rb_build.php and svnclean

2010-01-11 Thread Stanislav Malyshev

Hi!


the file ext/intl/tests/rb_build.php  will be removed by svnclean as it
matches the *.php pattern from ext/intl/tests/'s ignore. Is there a way
to change the svn ignore pattern to work-around this or can the file be
renamed/moved?


Heh, good catch, forgot about the clean that uses ignore... I'll rename 
it to resourcebundle.build.

--
Stanislav Malyshev, Zend Software Architect
s...@zend.com   http://www.zend.com/
(408)253-8829   MSN: s...@zend.com

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



Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread Etienne Kneuss
Hello,

On Mon, Jan 11, 2010 at 7:31 PM, Clint Priest cpri...@warpmail.net wrote:
 I know there's been requests to add a __toArray() and most of the arguments
 against it is that there are too many magic functions already.  I just
 thought I'd propose an alternative that would satisfy all of them.

 Why not a __cast($Type) magic function?

I'd advance two reasons against this idea:

1) It's more self-explanatory to explicitly call the appropriate
converting method, enough with implicit madness!

2) For some operations, you'd have to know the types in advance before
knowing what operations needs to be performed:

$obj1 + 2;

Now what __cast should be called? Int? Float?

Also, what about $obj1 + $obj2: Int? Float? Array?

Another example: str_replace($obj1, bar, foo); what to call?
__toString or __toArray? str_replace accepts both.

IMHO it would only make sense to invoke methods on explicit casts
only, otherwise it will just be a mess with PHP's current type
juggling. But, as we seen with __toString, limiting the field of
application was annoying (and it was later extended to nearly all
string usages).

So, what will it be? Inconsistent and Confusing or Limited and Annoying?


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





-- 
Etienne Kneuss
http://www.colder.ch

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



Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread Stanislav Malyshev

Hi!


Why not a __cast($Type) magic function?


The interesting thing is that in the engine the object handler is actually:

typedef int (*zend_object_cast_t)(zval *readobj, zval *retval, int type 
TSRMLS_DC);


i.e. the handler is already generic, but implementation API isn't - 
standard engine handler supports only IS_STRING (and IS_BOOL is a funny 
way - objects are always true). In other words, extensions already can 
do this, PHP programmer can't.



1) It's more self-explanatory to explicitly call the appropriate
converting method, enough with implicit madness!


This is probably the reason why the above was done - conversion to the 
string representation is a very frequent action (especially in the Web 
world where everything ends up being in the text page anyway ;) while 
conversion to numeric types is very special case and very ambiguous, as 
Etienne noted, and conversion to an array is also rather special case (a 
lot of cases where array-like syntax is called for are served by 
ArrayAccess).

--
Stanislav Malyshev, Zend Software Architect
s...@zend.com   http://www.zend.com/
(408)253-8829   MSN: s...@zend.com

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



Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread Clint Priest


Etienne Kneuss wrote:

Hello,

On Mon, Jan 11, 2010 at 7:31 PM, Clint Priest cpri...@warpmail.net wrote:

I know there's been requests to add a __toArray() and most of the arguments
against it is that there are too many magic functions already.  I just
thought I'd propose an alternative that would satisfy all of them.

Why not a __cast($Type) magic function?


I'd advance two reasons against this idea:

1) It's more self-explanatory to explicitly call the appropriate
converting method, enough with implicit madness!

2) For some operations, you'd have to know the types in advance before
knowing what operations needs to be performed:

$obj1 + 2;

Now what __cast should be called? Int? Float?


Wouldn't it make sense to be an integer since its being added to an integer?



Also, what about $obj1 + $obj2: Int? Float? Array?


This is where operator over-loading would be useful however perhaps only 
explicit casts would make sense here.




Another example: str_replace($obj1, bar, foo); what to call?
__toString or __toArray? str_replace accepts both.


This is an interesting situation, could be resolved by attempting a 
__cast('array') followed by a __cast('string') if the first call was 
rejected (false, exception or something).




IMHO it would only make sense to invoke methods on explicit casts
only, otherwise it will just be a mess with PHP's current type
juggling. But, as we seen with __toString, limiting the field of
application was annoying (and it was later extended to nearly all
string usages).


I would agree with this as well, only called during explicit casts.



So, what will it be? Inconsistent and Confusing or Limited and Annoying?



One other alternative, probably not as easy would be to pass multiple 
types to cast, much the way the Accepts: HTTP header does, providing a 
list of possible cast types, in the preferred order.


One could even implement an interface such as:

interface Castable {
   function GetCastableTypes();
}

or some such.


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








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



Re: [PHP-DEV] __toString(), __toArray()

2010-01-11 Thread mm w
cast is not needed in PHP

i 'd rather be more interesting in

class Obj {
 function __catch($data, $type) {
//$type [ static_method, method, get_property, set_property]
if (observed   $type == set_property  somevalueIsObserved) {
  $observer-notify(somevalue::valueWillChanged);
  $this-somevalue = $data['somevalue'];
  $observer-notify(somevalue::valueDidChanged);
} else {
  continue__call();
}
 }
}

On Mon, Jan 11, 2010 at 7:17 PM, Clint Priest cpri...@warpmail.net wrote:

 Etienne Kneuss wrote:

 Hello,

 On Mon, Jan 11, 2010 at 7:31 PM, Clint Priest cpri...@warpmail.net
 wrote:

 I know there's been requests to add a __toArray() and most of the
 arguments
 against it is that there are too many magic functions already.  I just
 thought I'd propose an alternative that would satisfy all of them.

 Why not a __cast($Type) magic function?

 I'd advance two reasons against this idea:

 1) It's more self-explanatory to explicitly call the appropriate
 converting method, enough with implicit madness!

 2) For some operations, you'd have to know the types in advance before
 knowing what operations needs to be performed:

 $obj1 + 2;

 Now what __cast should be called? Int? Float?

 Wouldn't it make sense to be an integer since its being added to an integer?


 Also, what about $obj1 + $obj2: Int? Float? Array?

 This is where operator over-loading would be useful however perhaps only
 explicit casts would make sense here.


 Another example: str_replace($obj1, bar, foo); what to call?
 __toString or __toArray? str_replace accepts both.

 This is an interesting situation, could be resolved by attempting a
 __cast('array') followed by a __cast('string') if the first call was
 rejected (false, exception or something).


 IMHO it would only make sense to invoke methods on explicit casts
 only, otherwise it will just be a mess with PHP's current type
 juggling. But, as we seen with __toString, limiting the field of
 application was annoying (and it was later extended to nearly all
 string usages).

 I would agree with this as well, only called during explicit casts.


 So, what will it be? Inconsistent and Confusing or Limited and Annoying?


 One other alternative, probably not as easy would be to pass multiple types
 to cast, much the way the Accepts: HTTP header does, providing a list of
 possible cast types, in the preferred order.

 One could even implement an interface such as:

 interface Castable {
   function GetCastableTypes();
 }

 or some such.

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






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



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



[PHP-DEV] Passing error codes through to PDOException

2010-01-11 Thread Joey Smith
Maybe I'm up in the night, but I've just opened 50728 because I discovered that 
all
the PDO drivers had a hardcoded 0 where I would expect to see the 
driver-specific
error - a user reported this in ##PHP on Freenode and I take a stab at writing 
the
patches that would let the individual drivers pass their error code on to the 
user.

They're attached to the bug as comments (the first against the tip of 5.3.2 
[svn #293440] and the second against HEAD [svn #293440]) - but I'm also 
attaching
them as udiffs to this email.

If there's a reason that the PDOExceptions don't contain their driver-specific
error codes, feel free to ignore this.
Index: ext/pdo_oci/oci_driver.c
===
--- ext/pdo_oci/oci_driver.c	(revision 293440)
+++ ext/pdo_oci/oci_driver.c	(working copy)
@@ -173,7 +173,7 @@
 
 	/* little mini hack so that we can use this code from the dbh ctor */
 	if (!dbh-methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, SQLSTATE[%s]: %s, *pdo_err, einfo-errmsg);
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo-errcode TSRMLS_CC, SQLSTATE[%s]: %s, *pdo_err, einfo-errmsg);
 	}
 
 	return einfo-errcode;
Index: ext/pdo_dblib/dblib_driver.c
===
--- ext/pdo_dblib/dblib_driver.c	(revision 293440)
+++ ext/pdo_dblib/dblib_driver.c	(working copy)
@@ -255,7 +255,7 @@
 	dbh-driver_data = H;
 
 	if (!ret) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC,
+		zend_throw_exception_ex(php_pdo_get_exception(), DBLIB_G(err).dberr TSRMLS_CC,
 			SQLSTATE[%s] %s (severity %d),
 			DBLIB_G(err).sqlstate,
 			DBLIB_G(err).dberrstr,
Index: ext/pdo_sqlite/sqlite_driver.c
===
--- ext/pdo_sqlite/sqlite_driver.c	(revision 293440)
+++ ext/pdo_sqlite/sqlite_driver.c	(working copy)
@@ -78,7 +78,7 @@
 	}
 
 	if (!dbh-methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, SQLSTATE[%s] [%d] %s,
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo-errcode TSRMLS_CC, SQLSTATE[%s] [%d] %s,
 *pdo_err, einfo-errcode, einfo-errmsg);
 	}
 	
Index: ext/pdo_mysql/mysql_driver.c
===
--- ext/pdo_mysql/mysql_driver.c	(revision 293440)
+++ ext/pdo_mysql/mysql_driver.c	(working copy)
@@ -127,7 +127,7 @@
 
 	if (!dbh-methods) {
 		PDO_DBG_INF(Throwing exception);
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, SQLSTATE[%s] [%d] %s,
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo-errcode TSRMLS_CC, SQLSTATE[%s] [%d] %s,
 *pdo_err, einfo-errcode, einfo-errmsg);
 	}
 
Index: ext/pdo_firebird/firebird_driver.c
===
--- ext/pdo_firebird/firebird_driver.c	(revision 293440)
+++ ext/pdo_firebird/firebird_driver.c	(working copy)
@@ -691,7 +691,7 @@
 		char errmsg[512];
 		ISC_STATUS *s = H-isc_status;
 		isc_interprete(errmsg, s);
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, SQLSTATE[%s] [%d] %s,
+		zend_throw_exception_ex(php_pdo_get_exception(), H-isc_status[1] TSRMLS_CC, SQLSTATE[%s] [%d] %s,
 HY000, H-isc_status[1], errmsg);
 	}
 
Index: ext/pdo_pgsql/pgsql_driver.c
===
--- ext/pdo_pgsql/pgsql_driver.c	(revision 293440)
+++ ext/pdo_pgsql/pgsql_driver.c	(working copy)
@@ -87,7 +87,7 @@
 	}
 
 	if (!dbh-methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, SQLSTATE[%s] [%d] %s,
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo-errcode TSRMLS_CC, SQLSTATE[%s] [%d] %s,
 *pdo_err, einfo-errcode, einfo-errmsg);
 	}
 	
Index: ext/pdo_odbc/odbc_driver.c
===
--- ext/pdo_odbc/odbc_driver.c	(revision 293440)
+++ ext/pdo_odbc/odbc_driver.c	(working copy)
@@ -104,7 +104,7 @@
 	strcpy(*pdo_err, einfo-last_state);
 /* printf(@@ SQLSTATE[%s] %s\n, *pdo_err, einfo-last_err_msg); */
 	if (!dbh-methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, SQLSTATE[%s] %s: %d %s,
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo-last_error TSRMLS_CC, SQLSTATE[%s] %s: %d %s,
 *pdo_err, what, einfo-last_error, einfo-last_err_msg);
 	}
 
Index: ext/pdo_oci/oci_driver.c
===
--- ext/pdo_oci/oci_driver.c	(revision 293440)
+++ ext/pdo_oci/oci_driver.c	(working copy)
@@ -173,7 +173,7 @@
 
 	/* little mini hack so that we can use this code from the dbh ctor */
 	if (!dbh-methods) {
-		zend_throw_exception_ex(php_pdo_get_exception(), 0 TSRMLS_CC, SQLSTATE[%s]: %s, *pdo_err, einfo-errmsg);
+		zend_throw_exception_ex(php_pdo_get_exception(), einfo-errcode TSRMLS_CC, SQLSTATE[%s]: %s, *pdo_err, einfo-errmsg);
 	}
 
 	return einfo-errcode;
Index: ext/pdo_dblib/dblib_driver.c

Re: [PHP-DEV] Passing error codes through to PDOException

2010-01-11 Thread Joey Smith
I also just attached the following to the bug - it's a test that checks this 
fix in
the sqlite driver - I can write tests for all the others if need be, but I 
figured
there are others who might already be more familiar with the individual PDO 
drivers
that would write them more quickly than I.
--TEST--
Bug #50728 (All PDOExceptions hardcode 'code' property to 0) (crash on 
PDO::FETCH_CLASS + __set())
--SKIPIF--
?php # vim:ft=php
if (!extension_loaded('pdo_sqlite')) print 'skip not loaded';
?
--FILE--
?php
 try {
 $a = new PDO(sqlite:/this/path/should/not/exist.db);
 } catch (PDOException $e) {
 var_dump($e-getCode());
 }

?
--EXPECTF-- 
int(14)

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

Re: [PHP-DEV] Passing error codes through to PDOException

2010-01-11 Thread Lester Caine

Joey Smith wrote:

Maybe I'm up in the night, but I've just opened 50728 because I discovered that 
all
the PDO drivers had a hardcoded 0 where I would expect to see the 
driver-specific
error - a user reported this in ##PHP on Freenode and I take a stab at writing 
the
patches that would let the individual drivers pass their error code on to the 
user.

They're attached to the bug as comments (the first against the tip of 5.3.2 
[svn #293440] and the second against HEAD [svn #293440]) - but I'm also attaching

them as udiffs to this email.

If there's a reason that the PDOExceptions don't contain their driver-specific
error codes, feel free to ignore this.


Joey - there is a separate list for PDO development p...@lists.php.net
And a todo list http://wiki.php.net/internals/pdo/brainstorming?s[]=pdo
But very little actual work being done, so any assistance there would be 
welcome!

--
Lester Caine - G8HFL
-
Contact - http://lsces.co.uk/wiki/?page=contact
L.S.Caine Electronic Services - http://lsces.co.uk
EnquirySolve - http://enquirysolve.com/
Model Engineers Digital Workshop - http://medw.co.uk//
Firebird - http://www.firebirdsql.org/index.php

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