Req #7507 [Wfx]: Better ODBC error reporting/fetching
Edit report at http://bugs.php.net/bug.php?id=7507edit=1 ID: 7507 Updated by: tor...@php.net Reported by:tor...@php.net Summary:Better ODBC error reporting/fetching Status: Wont fix Type: Feature/Change Request Package:ODBC related Operating System: Any PHP Version:4.0 Latest CVS (28/10/2000) Block user comment: N Private report: N New Comment: Hehehe :) Previous Comments: [2010-12-01 15:48:30] j...@php.net Use PDO. :) [2000-10-28 05:23:26] tor...@php.net Sent from one of my workmates: We've had some problems using the PHP4 ODBC extension. The return values of some ODBC functions don't seem to be handled properly. SQLPrepare() returns sometimes the return code SQL_SUCCESS_WITH_INFO when using DB2 (SQLError() giving the warning state 01589 A statement contains redundant specifications.), but in php_odbc.c accept only SQL_SUCCESS as the return value of SQLPrepare(). Also when using DB2, SQLExecute() and SQLExecDirect() return SQL_NO_DATA_FOUND after a searched update or delete when no rows were found to update or delete. php_odbc.c only accepts return codes SQL_SUCCESS and SQL_SUCCESS_WITH_INFO. (I'm not sure if this is intentional, that is am I supposed to check with a where query beforehand whether the to be updated or deleted rows exist.) A patch to fix these two things is attached [below]. Is the return code handling the way it is because of keeping PHP4 ODBC module compatible with various different dbms's or is it just that no one has had the time to go through checking it for each CLI function call? Also: Is anyone about to add a way for the application to access the error/warning messages and sqlstates returned by the latest calls to SQLError(), like mysql_error() and mysql_errno() functions in the MySQL extension? Or is there some sort of design issue that prevents doing this? *** php_odbc.c.old Fri Oct 27 15:47:32 2000 --- php_odbc.c Fri Oct 27 15:47:35 2000 *** *** 771,777 } #endif ! if ((rc = SQLPrepare(result-stmt, query, SQL_NTS)) != SQL_SUCCESS) { odbc_sql_error(conn-henv, conn-hdbc, result-stmt, SQLPrepare); SQLFreeStmt(result-stmt, SQL_DROP); RETURN_FALSE; --- 771,778 } #endif ! SQLPrepare(result-stmt, query, SQL_NTS); ! if (rc != SQL_SUCCESS rc != SQL_SUCCESS_WITH_INFO) { odbc_sql_error(conn-henv, conn-hdbc, result-stmt, SQLPrepare); SQLFreeStmt(result-stmt, SQL_DROP); RETURN_FALSE; *** *** 930,936 } } } else { ! if (rc != SQL_SUCCESS) { odbc_sql_error(result-conn_ptr-henv, result-conn_ptr-hdbc, result-stmt, SQLExecute); RETVAL_FALSE; } --- 931,937 } } } else { ! if (rc != SQL_SUCCESS rc != SQL_NO_DATA_FOUND) { odbc_sql_error(result-conn_ptr-henv, result-conn_ptr-hdbc, result-stmt, SQLExecute); RETVAL_FALSE; } *** *** 945,951 efree(params); } ! if (rc == SQL_SUCCESS) { RETVAL_TRUE; } --- 946,952 efree(params); } ! if (rc == SQL_SUCCESS || rc == SQL_NO_DATA_FOUND) { RETVAL_TRUE; } *** *** 1099,1105 #endif rc = SQLExecDirect(result-stmt, query, SQL_NTS); ! if (rc != SQL_SUCCESS rc != SQL_SUCCESS_WITH_INFO) { /* XXX FIXME we should really check out SQLSTATE with SQLError * in case rc is SQL_SUCCESS_WITH_INFO here. */ --- 1100,1106 #endif rc = SQLExecDirect(result-stmt, query, SQL_NTS); ! if (rc != SQL_SUCCESS rc != SQL_SUCCESS_WITH_INFO rc != SQL_NO_DATA_FOUND) { /* XXX FIXME we should really check out SQLSTATE with SQLError * in case rc is SQL_SUCCESS_WITH_INFO here. */ -- Edit this bug report at http://bugs.php.net/bug.php?id=7507edit=1
#26405 [NEW]: Runtime DLL linking from extension module code (GetProcAddress)
From: torben at greystork dot com Operating system: Win32 PHP version: 4.3.4 PHP Bug Type: IIS related Bug description: Runtime DLL linking from extension module code (GetProcAddress) Description: This is mainly for your information, since it may shed some additional light on problems encountered by other developers, notably the creator of the w32api module. I recently developed a custom mail server administration extension for PHP in which I access functions in a third-party (i.e. non-MFC) DLL Using LoadLibrary/GetProcAddress. The thus linked DLL functions behave predictably with the CLI version of PHP and on Apache/SAPI compiles. However, with IIS, whether it be ISAPI, CGI or FastCGI, the DLL functions do not return the expected results and may arbitrarily result in PHP engine crashes. This is obviously an issue with IIS, although I have no ideas on what may cause this kind of problem. Attempting to get to the root of this would be a job for someone with intimate knowledge of IIS. Unfortunately, that excludes me. Reproduce code: --- This is not a PHP language issue. -- Edit bug report at http://bugs.php.net/?id=26405edit=1 -- Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=26405r=trysnapshot4 Try a CVS snapshot (php5): http://bugs.php.net/fix.php?id=26405r=trysnapshot5 Fixed in CVS: http://bugs.php.net/fix.php?id=26405r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=26405r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=26405r=needtrace Try newer version: http://bugs.php.net/fix.php?id=26405r=oldversion Not developer issue:http://bugs.php.net/fix.php?id=26405r=support Expected behavior: http://bugs.php.net/fix.php?id=26405r=notwrong Not enough info:http://bugs.php.net/fix.php?id=26405r=notenoughinfo Submitted twice:http://bugs.php.net/fix.php?id=26405r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=26405r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=26405r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=26405r=dst IIS Stability: http://bugs.php.net/fix.php?id=26405r=isapi Install GNU Sed:http://bugs.php.net/fix.php?id=26405r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=26405r=float
#24274 [Com]: New 'function' variable_exists(); patch included
ID: 24274 Comment by: torben at thebuttlesschaps dot com Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Feature/Change Request Operating System: All PHP Version: 4CVS-2003-06-20 (stable) New Comment: Hmm. A non-messed-up patch can be found here: http://www.thebuttlesschaps.com/variable_exists_patch.txt Torben Previous Comments: [2003-06-20 17:08:17] [EMAIL PROTECTED] Description: PHP doesn't have a way to check whether a variable exists; just a way to check whether it has a value (isset()). This isn't wrong, but it would be useful to add a way to check for actual existence of a variable (for instance, checking for array keys without having to go through array_key_exists()). Here's a patch against CVS which implements variable_exists(). The only difference to isset() is that a variable is considered to exist even if it contains NULL. Index: zend_compile.h === RCS file: /repository/Zend/zend_compile.h,v retrieving revision 1.145 diff -u -r1.145 zend_compile.h --- zend_compile.h 31 Dec 2002 15:55:02 - 1.145 +++ zend_compile.h 20 Jun 2003 11:35:20 - @@ -558,6 +558,7 @@ #define ZEND_ISSET (10) #define ZEND_ISEMPTY (11) +#define ZEND_VARIABLE_EXISTS(12) #define ZEND_CT(10) #define ZEND_RT (11) Index: zend_execute.c === RCS file: /repository/Zend/zend_execute.c,v retrieving revision 1.321 diff -u -r1.321 zend_execute.c --- zend_execute.c 31 Dec 2002 15:55:02 - 1.321 +++ zend_execute.c 20 Jun 2003 11:35:22 - @@ -2382,7 +2382,7 @@ isset = 1; } } - } else if (*var==EG(uninitialized_zval_ptr) || ((*var)-type == IS_NULL)) { + } else if (*var == EG(uninitialized_zval_ptr) || (((*var)-type == IS_NULL) EX(opline)-op2.u.constant.value.lval != ZEND_VARIABLE_EXISTS)) { value = *var; isset = 0; } else { @@ -2391,6 +2391,7 @@ } switch (EX(opline)-op2.u.constant.value.lval) { + case ZEND_VARIABLE_EXISTS: case ZEND_ISSET: EX(Ts)[EX(opline)-result.u.var].tmp_var.value.lval = isset; break; Index: zend_language_parser.y === RCS file: /repository/Zend/zend_language_parser.y,v retrieving revision 1.23 diff -u -r1.23 zend_language_parser.y --- zend_language_parser.y 4 Aug 2002 06:39:44 - 1.23 +++ zend_language_parser.y 20 Jun 2003 11:35:22 - @@ -112,6 +112,7 @@ %token T_UNSET %token T_ISSET %token T_EMPTY +%token T_VARIABLE_EXISTS %token T_CLASS %token T_EXTENDS %token T_OBJECT_OPERATOR @@ -710,6 +711,7 @@ internal_functions_in_yacc: T_ISSET '(' isset_variables ')' { $$ = $3; } + | T_VARIABLE_EXISTS '(' variable_exists_variables ')' { $$ = $3; } | T_EMPTY '(' cvar ')'{ zend_do_isset_or_isempty(ZEND_ISEMPTY, $$, $3 TSRMLS_CC); } | T_INCLUDE expr { zend_do_include_or_eval(ZEND_INCLUDE, $$, $2 TSRMLS_CC); } | T_INCLUDE_ONCE expr { zend_do_include_or_eval(ZEND_INCLUDE_ONCE, $$, $2 TSRMLS_CC); } @@ -717,6 +719,11 @@ | T_REQUIRE expr { zend_do_include_or_eval(ZEND_REQUIRE, $$, $2 TSRMLS_CC); } | T_REQUIRE_ONCE expr { zend_do_include_or_eval(ZEND_REQUIRE_ONCE, $$, $2 TSRMLS_CC); } ; + +variable_exists_variables: + cvar{ zend_do_isset_or_isempty(ZEND_VARIABLE_EXISTS, $$, $1 TSRMLS_CC); } + | variable_exists_variables ',' { zend_do_boolean_and_begin($1, $2 TSRMLS_CC); } cvar { znode tmp; zend_do_isset_or_isempty(ZEND_ISSET, tmp, $4 TSRMLS_CC); zend_do_boolean_and_end($$, $1, tmp, $2 TSRMLS_CC); } +; isset_variables: cvar{ zend_do_isset_or_isempty(ZEND_ISSET, $$, $1 TSRMLS_CC); } Index: zend_language_scanner.l === RCS file: /repository/Zend/zend_language_scanner.l,v retrieving revision 1.64 diff -u -r1.64 zend_language_scanner.l
Bug #16400 Updated: $_FILES array and mp3 files
ID: 16400 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: Unknown/Other Function Operating System: Linux RH7.1 PHP Version: 4.1.2 New Comment: Does it work with other file types of similar size to the MP3s which you are uploading? i.e. are you sure it's not a max_file_size problem? Torben Previous Comments: [2002-04-02 17:06:52] [EMAIL PROTECTED] I am using PHP4.2.0RC1. When referencing .mp3 file uploads, the $_FILES[name]['tmp_name'] is empty, and $_FILES[name][size] is 0. When referencing other file types, everything works fine. Thanks. -- Edit this bug report at http://bugs.php.net/?id=16400edit=1
Bug #16045 Updated: count($array) logical error
ID: 16045 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Feedback Bug Type: *General Issues Operating System: All PHP Version: 4.1.1 New Comment: FWIW, I used the following script and got the correct results: ?php error_reporting(E_ALL); $x = array(1); echo Count: . count($x) . \n; unset($x[0]); echo Count: . count($x) . \n; ? Results: Count: 1 Count: 0 This is on version 4.2.0-dev. and 4.1.2. What does this script produce for you? Torben Previous Comments: [2002-03-13 15:11:08] [EMAIL PROTECTED] Hello, Funny logical error: if we have a simple variable, say $x = 1 then count($x) == 1, which is natural (I don't think so) And if we have an array $x[0] = 1; count($x) == 1, but after UnSet($x[0]) we still have count($x) = 1! This leads to a very special kind of logical errors which are really hard to track. My suggestion: either: introduce explicit type system (with unions, structs and arrays ;) or: disable count on variables -- Edit this bug report at http://bugs.php.net/?id=16045edit=1
Bug #16046 Updated: isset empty parse error w/ objects
ID: 16046 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Bogus Bug Type: Scripting Engine problem Operating System: linux PHP Version: 4.1.2 New Comment: From the manual (http://www.php.net/manual/en/function.empty.php): Note that this is meaningless when used on anything which isn't a variable; i.e. empty (addslashes ($name)) has no meaning since it would be checking whether something which isn't a variable is a variable with a FALSE value. This not only explains the issue, it gives an example. You're not using empty() on a variable in your example; you're using it on an anonymous value (specifically, the return value of a function). Torben Previous Comments: [2002-03-13 16:56:00] [EMAIL PROTECTED] Well, I did RTFM, quite a bit in fact. The result of the function call *is* a plain variable, no? If not, your telling me that (from my example) $foo-getStr() is not equal to the plain string foo? It's just a string coming back from the call, and that should be accepted into empty() just as if I'd typed a string in there to begin with. Seems like the evaluation order is screwed up to me. In any case, if this function is working as intended, a better FM might be in order in this case. [2002-03-13 15:53:21] [EMAIL PROTECTED] RTFM: http://www.php.net/manual/en/function.empty.php empty() only works with plain variables. [2002-03-13 15:30:41] [EMAIL PROTECTED] /* See the script below. Passing a value returned from an object function call to isset() and empty() results in a parsing error. strlen() and other functions don't have this problem. The code example below tests empty(). You may substitute isset() as well and get the same parse error. This bug exists on both Apache 1.3.9/PHP 4.1.1 and Apache 1.3.23/PHP 4.1.2 */ //first, declare a simple class with 1 function class Foo { function getStr() { return foo; } } //now make an object of that class $foo = new Foo(); /* * now let's test empty() with just the string * this should evaluate false, and result in not empty * being printed */ $fooStr = $foo-getStr(); if ( empty($foostr) ) { echo empty!; } else { echo not empty!; } /* * now test it using the object function call. This is the * functional equivalent of the previous test, and should * result in the same result. However it results in: * Parse error: parse error, expecting `')'' * If you comment out this block, this script parses and * executes successfully. */ if ( empty($foo-getStr()) ) { echo empty!; } else { echo not empty!; } -- Edit this bug report at http://bugs.php.net/?id=16046edit=1
Bug #16029 Updated: Feature Request on mysql_fetch_array()
ID: 16029 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: MySQL related Operating System: Linux 2.4 (intel) PHP Version: 4.1.2 New Comment: The data is returned from the server like that. What you can do is: 'select tbl1.colA as tbl1_colA, tbl2.colA as tbl2_colA. . .' Torben Previous Comments: [2002-03-12 19:55:38] [EMAIL PROTECTED] When you SELECT two columns from different tables with the same column name in a JOIN, you cannot use column names is associative array keys. It would be really nice when you did something like this: --- $result = mysql_query(SELECT tbl1.colA, tbl2.colA FROM tbl1 LEFT JOIN tbl2 ON tbl1.colB = tbl2.colB); $row = mysql_fetch_array($result); --- if you could then do something like this: --- $mydata1 = $row[tbl1.colA]; $mydata1 = $row[tbl2.colA]; --- With the current behavior, you may only access the second array element with its numerical index. -- Edit this bug report at http://bugs.php.net/?id=16029edit=1
Bug #14998 Updated: Can't name a class 'Directory'
ID: 14998 Updated by: [EMAIL PROTECTED] -Summary: Can't name a class 'Directory' Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: Red Hat Linux 7.0 PHP Version: 4.0.5 New Comment: This bug has been fixed in CVS. Previous Comments: [2002-03-04 11:47:28] [EMAIL PROTECTED] This one just bit me for 20 minutes as well. A documentation change would be quite helpful (Also, I think this is something that would generally be happier in PEAR or similar, but that's a diffrent problem :). [2002-01-11 13:54:29] [EMAIL PROTECTED] See http://www.php.net/manual/en/function.get-declared-classes.php. It is predefined. Should be pointed out more clearly, - documentation problem. [2002-01-11 12:17:37] [EMAIL PROTECTED] For example, given the code: ? class Directory { // CONSTRUCTOR function Directory($req_id = FALSE) { // nothing } } ? PHP gives the error: Cannot redeclare class directory. Maybe the the dir() function/class interferes?? Configuration: './configure' '--prefix=/usr' '--with-apxs=/usr/sbin/apxs' '--with-exec-dir=/usr/bin' '--with-config-file-path=/etc/httpd' '--with-regex=system' '--enable-debugger' '--enable-magic-quotes' '--enable-sysvshm' '--with-dom' '--enable-force-cgi-redirect' '--enable-sigchild' '--with-wddx' '--enable-inline-optimization' '--with-gnu-ld' '--enable-bcmath' '--enable-crypt' '--with-xml' '--with-sablot' '--enable-dbg=shared' '--with-dbg-profiler' Thanks. -- Edit this bug report at http://bugs.php.net/?id=14998edit=1
Bug #14734 Updated: new superglobals ($_SERVER, etc.) not documented
ID: 14734 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] Status: Open Bug Type: Documentation problem Operating System: Win XP PHP Version: 4.1.0 New Comment: This has been fixed in CVS. FWIW, I think that if $PHP_SELF is to be documented outside of the $_SERVER list, it should be worded carefully to prevent users wondering why $PHP_SELF isn't available in the global scope. Torben Previous Comments: [2002-01-04 01:16:40] [EMAIL PROTECTED] but $PHP_SELF is also a special variable, so I think also listing it out of any collection is a good thing. [2001-12-28 11:35:45] [EMAIL PROTECTED] Tested again. Yes you are right. It would be good to have it listed only in _SERVER, as the other vars. [2001-12-28 10:29:47] [EMAIL PROTECTED] It's printed in _SERVER too (apache 1.3.22/php 4.1.0). [2001-12-28 10:17:17] [EMAIL PROTECTED] Just a note: in the PHP 4.1.0 phpinfo() output, all the predefined vars are printed as _SERVER and _ENV members, except PHP_SELF, it is printed alone, and not in any array. This must be corrected! [2001-12-28 10:05:28] [EMAIL PROTECTED] Valid point. I'm reopening this as a documentation problem. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/14734 -- Edit this bug report at http://bugs.php.net/?id=14734edit=1
Bug #15842 Updated: Fopen function
ID: 15842 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Bogus Bug Type: Apache related Operating System: windows XP PHP Version: 4.1.2 New Comment: The bug system is not the appropriate forum for asking support questions. For a list of a range of more appropriate places to ask for help using PHP, please visit http://www.php.net/support.php Previous Comments: [2002-03-02 23:48:47] [EMAIL PROTECTED] Hi... i want to build a php file that opens one of a number of pages randomly... this is what i've coem up with. the rand function works...but i don't think the fopen function does. i don't know if it has to do with apache or what? thanks: ? $page = rand(0, 6); if ($page = 0){ fopen (gary1.htm,r);} if ($page = 1){ fopen (gary2.htm,r);} if ($page = 2){ fopen (gary3.htm,r);} if ($page = 3){ fopen (gary4.htm,r);} if ($page = 4){ fopen (gary5.htm,r);} if ($page = 5){ fopen (gary6.htm,r);} ? -- Edit this bug report at http://bugs.php.net/?id=15842edit=1
Bug #15723 Updated: dir-read() class/function fails when directory contains subdirectory '0'
ID: 15723 Updated by: [EMAIL PROTECTED] -Summary: dir-read() class/function fails when directory contains subdirectory '0' Reported By: [EMAIL PROTECTED] Status: Open -Bug Type: Unknown/Other Function +Bug Type: Documentation problem Operating System: Linux 2.4 PHP Version: 4.1.1 New Comment: I'm changing this to a documentation problem, since it should be explained on the dir() manual page. It is explained here: http://www.php.net/readdir, however. The gist is that '0' evaluates to false in PHP. Torben Previous Comments: [2002-02-26 00:30:26] [EMAIL PROTECTED] $d = dir('.'); while ($entry = $d-read()) { echo $entry \n; } $d-close(); The above script works fine on mosth direcotries, but if the direcoty contains a subdirectory 0, it stops as soon as it gets to it and only outputs the . and .. entries. Caleb -- Edit this bug report at http://bugs.php.net/?id=15723edit=1
Bug #8087 Updated: fsockopen declaration
ID: 8087 Updated by: [EMAIL PROTECTED] Reported By: [EMAIL PROTECTED] -Status: Open +Status: Closed Bug Type: Documentation problem Operating System: All PHP Version: 4.0.2 New Comment: This bug has been fixed in CVS. Previous Comments: [2002-02-09 23:14:15] [EMAIL PROTECTED] the code does force the third and fourth arguments to be refs, the documentation is out of date. [2000-12-03 12:53:50] [EMAIL PROTECTED] When you use fsockopen with allow_call_time_pass_reference = Off in the php.ini, there's an error message that this feature won't be supported in future versions any more and that the declaration of fsockopen should be changed. The other way round, the manual says: Note that the errno and errstr arguments must be passed by reference. So, the declaration of fsockopen should be changed in future versions to: int fsockopen (string [udp://]hostname, int port [, int errno [, string errstr [, double timeout]]]) Regards Jean-Pierre Bergamin http://www.ractive.ch -- Edit this bug report at http://bugs.php.net/?id=8087edit=1