#50037 [NEW]: No is_function() to check whether variable is an anonymous function
From: mjs at beebo dot org Operating system: OS X PHP version: 5.3.0 PHP Bug Type: Feature/Change Request Bug description: No is_function() to check whether variable is an anonymous function Description: There doesn't seem to be any good way to check whether a variable is a closure/anonymous function. If $fn = function() { }; gettype($fn) is object, and there is no is_function() or equivalent. The only way seems to be gettype($fn) == object get_class($fn) == Closure but the anonymous function documentation says that the fact that anonymous functions have class Closure is an implementation detail and should not be relied upon. I suggest: 1. gettype() returns function or closure when passed a closure. 2. is_function() is created that returns true when passed a closure, otherwise false. -- Edit bug report at http://bugs.php.net/?id=50037edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=50037r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=50037r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=50037r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=50037r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=50037r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=50037r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=50037r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=50037r=needscript Try newer version: http://bugs.php.net/fix.php?id=50037r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=50037r=support Expected behavior: http://bugs.php.net/fix.php?id=50037r=notwrong Not enough info: http://bugs.php.net/fix.php?id=50037r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=50037r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=50037r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=50037r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=50037r=dst IIS Stability: http://bugs.php.net/fix.php?id=50037r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=50037r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=50037r=float No Zend Extensions: http://bugs.php.net/fix.php?id=50037r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=50037r=mysqlcfg
#49567 [Opn]: DOM/XSL: Suggestion: registerObjectMethods()
ID: 49567 User updated by: mjs at beebo dot org Reported By: mjs at beebo dot org Status: Open Bug Type: Feature/Change Request Operating System: OS X PHP Version: 5.3.0 New Comment: Thanks for your reply. Yes, you can register exactly one object. If you call registerPHPFunctions() twice, the functions/methods registered will be those of the second object. If there's a function of the same name, it won't get called-- essentially if you have php:function('foo') in your XSL, foo() is either considered as a function in global scope (if you registered an array of strings, or nothing at all), or a method name in the scope of the registered object (if you registered an object). This is not the most flexible approach but I think it's a simple and straightforward enhancement that requires no extra syntax on either the PHP or XSL side. Also, anything more advanced is beyond my extension-writing capabilities! I've made a few changes to the patch, and am working on a few more little things that don't affect the syntax. Is here the right place to post it when I'm done? Previous Comments: [2009-09-22 13:30:58] chr...@php.net Thanks for your work. I didn't test it out, but looking at the code 2 questions pop up: You can register exactly one object? and What happens, if there's a function with that name? eg. 'add' in your test? Not sure, if I'm happy how it is right now, but it certainly goes into the right direction. [2009-09-22 07:14:34] mjs at beebo dot org Had a look at how the xsl extension works, and had a shot at implementing this myself--the patch is below. Instead of adding a new function I enhanced registerPHPFunctions() so that it can take an object. It works like this: if an object is provided (say $foo), then xsl:value-of select=php:function('quux', 44)/ in the XSL results in a call to $foo-quux(44). i.e. in PHP: $foo = new Foo(); $processor-registerPHPFunctions($foo); In XSL: xsl:value-of select=php:function('quux', 44)/ Two of the tests in ext/xsl failed, but they fail without this patch also. The patch is: Index: ext/xsl/tests/xsltprocessor_registerPHPFunctions-method.phpt === --- ext/xsl/tests/xsltprocessor_registerPHPFunctions-method.phpt (revision 0) +++ ext/xsl/tests/xsltprocessor_registerPHPFunctions-method.phpt (revision 0) @@ -0,0 +1,38 @@ +--TEST-- +Checks XSLTProcessor::registerPHPFunctions($obj) where the functions +exposed in the XSL file are methods of $obj. +--SKIPIF-- +?php +if (!extension_loaded('xsl')) { +die(skip\n); +} +? +--FILE-- +?php + +class Foo { +public function greet($name) { +return Hello, $name; +} +public function add($i, $j) { +return $i + $j; +} +} + +$xml = new DOMDocument(); +$xml-loadXML(root/); +$xsl = new DOMDocument(); +$xsl-load(dirname(__FILE__) . /phpmethod.xsl); + +$proc = new XSLTProcessor(); +$proc-importStylesheet($xsl); + +$foo = new Foo(); + +$proc-registerPHPFunctions($foo); + +echo $proc-transformToXml($xml); +--EXPECTF-- +result greet=Hello, Clem add=7/ +--CREDITS-- +Michael Stillwell m...@beebo.org \ No newline at end of file Index: ext/xsl/tests/phpmethod.xsl === --- ext/xsl/tests/phpmethod.xsl (revision 0) +++ ext/xsl/tests/phpmethod.xsl (revision 0) @@ -0,0 +1,15 @@ +xsl:stylesheet + version=1.0 + xmlns:xsl=http://www.w3.org/1999/XSL/Transform; + xmlns:php=http://php.net/xsl; + exclude-result-prefixes=php + xsl:output omit-xml-declaration=yes/ +xsl:template match=/ + result + !-- pass a single string argument -- + xsl:attribute name=greetxsl:value-of select=php:function('greet', 'Clem')//xsl:attribute + !-- pass two integer arguments -- + xsl:attribute name=addxsl:value-of select=php:function('add', 3, 4)//xsl:attribute + /result +/xsl:template +/xsl:stylesheet \ No newline at end of file Index: ext/xsl/php_xsl.h === --- ext/xsl/php_xsl.h (revision 288545) +++ ext/xsl/php_xsl.h (working copy) @@ -55,6 +55,7 @@ HashTable *node_list; php_libxml_node_object *doc; char *profiling; + zval *object_ptr; } xsl_object; void php_xsl_set_object(zval *wrapper, void *obj TSRMLS_DC); Index: ext/xsl/xsltprocessor.c === --- ext/xsl/xsltprocessor.c (revision 288545) +++ ext/xsl/xsltprocessor.c (working copy) @@ -308,11 +308,11 @@ fci.function_name = handler; fci.symbol_table = NULL; - fci.object_ptr = NULL; fci.retval_ptr_ptr = retval; fci.no_separation = 0; + fci.object_ptr = intern-object_ptr ? intern
#49567 [Opn]: DOM/XSL: Suggestion: registerObjectMethods()
ID: 49567 User updated by: mjs at beebo dot org Reported By: mjs at beebo dot org Status: Open Bug Type: Feature/Change Request Operating System: OS X PHP Version: 5.3.0 New Comment: Had a look at how the xsl extension works, and had a shot at implementing this myself--the patch is below. Instead of adding a new function I enhanced registerPHPFunctions() so that it can take an object. It works like this: if an object is provided (say $foo), then xsl:value-of select=php:function('quux', 44)/ in the XSL results in a call to $foo-quux(44). i.e. in PHP: $foo = new Foo(); $processor-registerPHPFunctions($foo); In XSL: xsl:value-of select=php:function('quux', 44)/ Two of the tests in ext/xsl failed, but they fail without this patch also. The patch is: Index: ext/xsl/tests/xsltprocessor_registerPHPFunctions-method.phpt === --- ext/xsl/tests/xsltprocessor_registerPHPFunctions-method.phpt (revision 0) +++ ext/xsl/tests/xsltprocessor_registerPHPFunctions-method.phpt (revision 0) @@ -0,0 +1,38 @@ +--TEST-- +Checks XSLTProcessor::registerPHPFunctions($obj) where the functions +exposed in the XSL file are methods of $obj. +--SKIPIF-- +?php +if (!extension_loaded('xsl')) { +die(skip\n); +} +? +--FILE-- +?php + +class Foo { +public function greet($name) { +return Hello, $name; +} +public function add($i, $j) { +return $i + $j; +} +} + +$xml = new DOMDocument(); +$xml-loadXML(root/); +$xsl = new DOMDocument(); +$xsl-load(dirname(__FILE__) . /phpmethod.xsl); + +$proc = new XSLTProcessor(); +$proc-importStylesheet($xsl); + +$foo = new Foo(); + +$proc-registerPHPFunctions($foo); + +echo $proc-transformToXml($xml); +--EXPECTF-- +result greet=Hello, Clem add=7/ +--CREDITS-- +Michael Stillwell m...@beebo.org \ No newline at end of file Index: ext/xsl/tests/phpmethod.xsl === --- ext/xsl/tests/phpmethod.xsl (revision 0) +++ ext/xsl/tests/phpmethod.xsl (revision 0) @@ -0,0 +1,15 @@ +xsl:stylesheet + version=1.0 + xmlns:xsl=http://www.w3.org/1999/XSL/Transform; + xmlns:php=http://php.net/xsl; + exclude-result-prefixes=php + xsl:output omit-xml-declaration=yes/ +xsl:template match=/ + result + !-- pass a single string argument -- + xsl:attribute name=greetxsl:value-of select=php:function('greet', 'Clem')//xsl:attribute + !-- pass two integer arguments -- + xsl:attribute name=addxsl:value-of select=php:function('add', 3, 4)//xsl:attribute + /result +/xsl:template +/xsl:stylesheet \ No newline at end of file Index: ext/xsl/php_xsl.h === --- ext/xsl/php_xsl.h (revision 288545) +++ ext/xsl/php_xsl.h (working copy) @@ -55,6 +55,7 @@ HashTable *node_list; php_libxml_node_object *doc; char *profiling; + zval *object_ptr; } xsl_object; void php_xsl_set_object(zval *wrapper, void *obj TSRMLS_DC); Index: ext/xsl/xsltprocessor.c === --- ext/xsl/xsltprocessor.c (revision 288545) +++ ext/xsl/xsltprocessor.c (working copy) @@ -308,11 +308,11 @@ fci.function_name = handler; fci.symbol_table = NULL; - fci.object_ptr = NULL; fci.retval_ptr_ptr = retval; fci.no_separation = 0; + fci.object_ptr = intern-object_ptr ? intern-object_ptr : NULL; /*fci.function_handler_cache = function_ptr;*/ - if (!zend_make_callable(handler, callable TSRMLS_CC)) { + if ((intern-registerPhpFunctions != 3) !zend_make_callable(handler, callable TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, Unable to call handler %s(), callable); } else if ( intern-registerPhpFunctions == 2 zend_hash_exists(intern-registered_phpfunctions, callable, strlen(callable) + 1) == 0) { @@ -320,6 +320,9 @@ /* Push an empty string, so that we at least have an xslt result... */ valuePush(ctxt, xmlXPathNewString()); } else { + if (intern-object_ptr) { + fci.object_ptr = intern-object_ptr; + } result = zend_call_function(fci, NULL TSRMLS_CC); if (result == FAILURE) { if (Z_TYPE(handler) == IS_STRING) { @@ -794,6 +797,7 @@ zval *id; xsl_object *intern; zval *array_value, **entry, *new_string; + zval *obj_ptr; int name_len = 0; char *name; @@ -823,6 +827,12 @@ zend_hash_update(intern-registered_phpfunctions, name, name_len + 1, new_string, sizeof(zval*), NULL); intern-registerPhpFunctions = 2; + } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, o, obj_ptr
#49567 [NEW]: Suggestion: registerObjectMethods()
From: mjs at beebo dot org Operating system: OS X PHP version: 5.3.0 PHP Bug Type: XSLT related Bug description: Suggestion: registerObjectMethods() Description: A suggestion: it would be useful if there was a registerObjectMethods() that worked in a similar way to registerPHPFunctions() except that it took an object upon which methods could be called. i.e. something like class Greet { public function byName($name) { return Hello, $name; } } $xml = DOMDocument::loadXML(root/); $xsl = DOMDocument::loadXML(... xsl:value-of select=php:call('byName', 'Michael')/ ...); $proc = new XSLTProcessor(); $proc-registerObjectMethods(new Greet()); $proc-importStyleSheet($xsl); echo $proc-transformToXML($xml); -- Edit bug report at http://bugs.php.net/?id=49567edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49567r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49567r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49567r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49567r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49567r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49567r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49567r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49567r=needscript Try newer version: http://bugs.php.net/fix.php?id=49567r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49567r=support Expected behavior: http://bugs.php.net/fix.php?id=49567r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49567r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49567r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49567r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49567r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49567r=dst IIS Stability: http://bugs.php.net/fix.php?id=49567r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49567r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49567r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49567r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49567r=mysqlcfg
#49542 [NEW]: __callStatic() only invoked if instance method does not exist
From: mjs at beebo dot org Operating system: Ubuntu PHP version: 5.3.0 PHP Bug Type: Class/Object related Bug description: __callStatic() only invoked if instance method does not exist Description: A static call to Foo::bar() does not invoke __callStatic() if an instance method bar() exists. One reason you might want this is to convert static calls to Foo::bar() to the equivalent operation on a singleton: public static function __callStatic($name, $args) { $obj = self::getInstance(); return call_user_func_array(array($obj, $name), $args); } In the sample code below, __callStatic() is not invoked even though the caller has deliberately initiated a static call. Reproduce code: --- ?php class Foo { public static function __callStatic($name, $args) { echo In __callStatic()\n; } public function bar() { echo In bar()\n; } } echo Foo::bar(); Expected result: In _callStatic() Actual result: -- PHP Strict Standards: Non-static method Foo::bar() should not be called statically in /mnt/hgfs/workspace/scratch/wart1.php on line 15 Strict Standards: Non-static method Foo::bar() should not be called statically in /mnt/hgfs/workspace/scratch/wart1.php on line 15 In bar() -- Edit bug report at http://bugs.php.net/?id=49542edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49542r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49542r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49542r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49542r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49542r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49542r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49542r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49542r=needscript Try newer version: http://bugs.php.net/fix.php?id=49542r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49542r=support Expected behavior: http://bugs.php.net/fix.php?id=49542r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49542r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49542r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49542r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49542r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49542r=dst IIS Stability: http://bugs.php.net/fix.php?id=49542r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49542r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49542r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49542r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49542r=mysqlcfg
#49543 [NEW]: closures cannot import/inherit $this
From: mjs at beebo dot org Operating system: Ubuntu PHP version: 5.3.0 PHP Bug Type: Scripting Engine problem Bug description: closures cannot import/inherit $this Description: Attempting to import/inherit $this produces the compile-time error Cannot use $this as lexical variable. Note that the workaround of assigning $this to the temporary variable $tmp, and inheriting $tmp instead does work, so there appears to be no limitation in the engine: class Foo { public function bar() { $tmp = $this; return function() use ($tmp) { echo in closure\n; } } } See also http://wiki.php.net/rfc/closures/removal-of-this. (It appears that $this was once automatically imported into the closure's scope, but that this turned out to be a bad idea. This bug report concerns what happens when $this is explicitly imported, however.) Reproduce code: --- ?php class Foo { public function bar() { return function() use ($this) { echo in closure\n; } } } Expected result: in closure Actual result: -- PHP Fatal error: Cannot use $this as lexical variable in /mnt/hgfs/workspace/scratch/wart2.php on line 7 -- Edit bug report at http://bugs.php.net/?id=49543edit=1 -- Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=49543r=trysnapshot52 Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=49543r=trysnapshot53 Try a snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=49543r=trysnapshot60 Fixed in SVN: http://bugs.php.net/fix.php?id=49543r=fixed Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=49543r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=49543r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=49543r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=49543r=needscript Try newer version: http://bugs.php.net/fix.php?id=49543r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=49543r=support Expected behavior: http://bugs.php.net/fix.php?id=49543r=notwrong Not enough info: http://bugs.php.net/fix.php?id=49543r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=49543r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=49543r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=49543r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=49543r=dst IIS Stability: http://bugs.php.net/fix.php?id=49543r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=49543r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=49543r=float No Zend Extensions: http://bugs.php.net/fix.php?id=49543r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=49543r=mysqlcfg
#48589 [NEW]: /\Q$z\E/ matches every string
From: mjs at beebo dot org Operating system: OS X PHP version: 5.2.9 PHP Bug Type: PCRE related Bug description: /\Q$z\E/ matches every string Description: The regular expression /\Q$z\E/ matches (as far as I can tell) every string. It certainly matches some strings it shouldn't match: preg_match(/\Q$z\E/, ) - MATCH (WRONG!) preg_match(/\Q$z\E/, ) - MATCH (WRONG!) preg_match(/\Q $z\E/, ) - NO MATCH (CORRECT) preg_match(/\Q $z\E/, $z) - MATCH (CORRECT) preg_match(/\Q\$z\E/, \$z) - MATCH (CORRECT) preg_match(/\Q\$z\E/, $z) - NO MATCH (CORRECT) The problem seems to occur if the regular expression begins with the string \Q$ followed by at least one character. -- Edit bug report at http://bugs.php.net/?id=48589edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=48589r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=48589r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=48589r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=48589r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48589r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=48589r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=48589r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=48589r=needscript Try newer version: http://bugs.php.net/fix.php?id=48589r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=48589r=support Expected behavior: http://bugs.php.net/fix.php?id=48589r=notwrong Not enough info: http://bugs.php.net/fix.php?id=48589r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=48589r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=48589r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48589r=php4 Daylight Savings:http://bugs.php.net/fix.php?id=48589r=dst IIS Stability: http://bugs.php.net/fix.php?id=48589r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=48589r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=48589r=float No Zend Extensions: http://bugs.php.net/fix.php?id=48589r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=48589r=mysqlcfg
#48589 [Opn]: /\Q$z\E/ matches every string
ID: 48589 User updated by: mjs at beebo dot org Reported By: mjs at beebo dot org Status: Open Bug Type: PCRE related Operating System: OS X PHP Version: 5.2.9 New Comment: Regexp documentation: http://php.net/manual/en/regexp.reference.php Previous Comments: [2009-06-17 20:23:44] mjs at beebo dot org Description: The regular expression /\Q$z\E/ matches (as far as I can tell) every string. It certainly matches some strings it shouldn't match: preg_match(/\Q$z\E/, ) - MATCH (WRONG!) preg_match(/\Q$z\E/, ) - MATCH (WRONG!) preg_match(/\Q $z\E/, ) - NO MATCH (CORRECT) preg_match(/\Q $z\E/, $z) - MATCH (CORRECT) preg_match(/\Q\$z\E/, \$z) - MATCH (CORRECT) preg_match(/\Q\$z\E/, $z) - NO MATCH (CORRECT) The problem seems to occur if the regular expression begins with the string \Q$ followed by at least one character. -- Edit this bug report at http://bugs.php.net/?id=48589edit=1
#48589 [Bgs]: /\Q$z\E/ matches every string
ID: 48589 User updated by: mjs at beebo dot org Reported By: mjs at beebo dot org Status: Bogus Bug Type: PCRE related Operating System: OS X PHP Version: 5.2.9 New Comment: Ah yes of course, apologies. Previous Comments: [2009-06-17 22:58:31] fel...@php.net No bug there, the '$z' enclosed by double quotes is interpreted as a variable first. http://docs.php.net/manual/en/language.types.string.php [2009-06-17 20:45:19] mjs at beebo dot org Regexp documentation: http://php.net/manual/en/regexp.reference.php [2009-06-17 20:23:44] mjs at beebo dot org Description: The regular expression /\Q$z\E/ matches (as far as I can tell) every string. It certainly matches some strings it shouldn't match: preg_match(/\Q$z\E/, ) - MATCH (WRONG!) preg_match(/\Q$z\E/, ) - MATCH (WRONG!) preg_match(/\Q $z\E/, ) - NO MATCH (CORRECT) preg_match(/\Q $z\E/, $z) - MATCH (CORRECT) preg_match(/\Q\$z\E/, \$z) - MATCH (CORRECT) preg_match(/\Q\$z\E/, $z) - NO MATCH (CORRECT) The problem seems to occur if the regular expression begins with the string \Q$ followed by at least one character. -- Edit this bug report at http://bugs.php.net/?id=48589edit=1
#43189 [Com]: Fails to link iconv
ID: 43189 Comment by: mjs at beebo dot org Reported By: meh at mailinator dot com Status: No Feedback Bug Type: ICONV related Operating System: Mac OS X 10.5 PHP Version: 5.3CVS-2007-11-04 (snap) New Comment: This appears to be fixed in 10.5.2: the 10.5.2 /usr/include/iconv.h is different to the 10.5.1 version, and it compiles successfully as well. Previous Comments: [2008-02-03 09:25:38] mjs at beebo dot org Replacing /usr/include/iconv.h with the one from MacPorts and worked for me. (I did need to re-configure and re-compile the whole thing though-- just re-running configure didn't work.) For what it's worth, the --with-iconv=shared,/opt/local idea *didn't* work for me--php configured and built okay, but the iconv module didn't actually become available. (php -m doesn't show it.) [2008-01-20 19:59:20] mariano at petersonpages dot com This configure option worked for me: --with-iconv=shared,/opt/local (Mac OS 10.5.1, PHP 5.2.5, iconv installed in /opt/local using macports) [2007-12-18 08:45:48] leon at messiah dot co dot nz Scott's method may work, but I'm loath to replace system provided header files. Seems a bit hacky to me... Wouldn't a more elegant solution be to configure your build to use the fink versions of the headers and library? Something like: --with-iconv-dir=/sw I'm using MacPorts so have been trying to do the same thing but using /opt/local, so far without success. However, I'm probably doing something wrong with the configure script (we're not the best of friends). [2007-12-14 15:45:05] aaa at mailinator dot com @jani: there are one per OS X sdk, one in /usr and one in /sw. Linking suggested by scott solves the problem on me. [2007-11-22 22:06:03] msf at bitplan dot com I have the same problem, even with a self compiled libiconv it does not work. 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/43189 -- Edit this bug report at http://bugs.php.net/?id=43189edit=1
#43189 [Com]: Fails to link iconv
ID: 43189 Comment by: mjs at beebo dot org Reported By: meh at mailinator dot com Status: No Feedback Bug Type: ICONV related Operating System: Mac OS X 10.5 PHP Version: 5.3CVS-2007-11-04 (snap) New Comment: Replacing /usr/include/iconv.h with the one from MacPorts and worked for me. (I did need to re-configure and re-compile the whole thing though-- just re-running configure didn't work.) For what it's worth, the --with-iconv=shared,/opt/local idea *didn't* work for me--php configured and built okay, but the iconv module didn't actually become available. (php -m doesn't show it.) Previous Comments: [2008-01-20 19:59:20] mariano at petersonpages dot com This configure option worked for me: --with-iconv=shared,/opt/local (Mac OS 10.5.1, PHP 5.2.5, iconv installed in /opt/local using macports) [2007-12-18 08:45:48] leon at messiah dot co dot nz Scott's method may work, but I'm loath to replace system provided header files. Seems a bit hacky to me... Wouldn't a more elegant solution be to configure your build to use the fink versions of the headers and library? Something like: --with-iconv-dir=/sw I'm using MacPorts so have been trying to do the same thing but using /opt/local, so far without success. However, I'm probably doing something wrong with the configure script (we're not the best of friends). [2007-12-14 15:45:05] aaa at mailinator dot com @jani: there are one per OS X sdk, one in /usr and one in /sw. Linking suggested by scott solves the problem on me. [2007-11-22 22:06:03] msf at bitplan dot com I have the same problem, even with a self compiled libiconv it does not work. [2007-11-19 01:00:01] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to Open. 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/43189 -- Edit this bug report at http://bugs.php.net/?id=43189edit=1
#43752 [Com]: PDO bindParam Mangles bound objects
ID: 43752 Comment by: mjs at beebo dot org Reported By: motoma at gmail dot com Status: Open Bug Type: PDO related Operating System: Windows PHP Version: 5.2CVS-2008-01-04 (snap) New Comment: Does the mangling happen without the ATTR_PERSISTENT? It looks like this may be related to: http://bugs.php.net/bug.php?id=43831 which concerns $this getting mangled Previous Comments: [2008-01-04 18:32:58] motoma at gmail dot com Description: I built a class with a __toString() member function. When I pass an instance of this class to bindParam(), the object is overwritten with the result of __toString(). The result from the code sample suggests that bindParam is overwriting the value of the object with the object's __toString() value. Reproduce code: --- ?php class test { private $a = 1; public function __toString() { return strval($this-a); } } $db = new PDO('mysql:host=localhost;dbname=test', 'root', '', array(PDO::ATTR_PERSISTENT = true)); $obj = new test(); $prepared = $db-prepare('SELECT * FROM table1 WHERE 1 = :test'); var_dump($obj); $prepared-bindParam('test', $obj); var_dump($obj); ? Expected result: object(test)#2 (1) { [a:private]= int(1) } object(test)#2 (1) { [a:private]= int(1) } Actual result: -- object(test)#2 (1) { [a:private]= int(1) } string(1) 1 -- Edit this bug report at http://bugs.php.net/?id=43752edit=1
#43831 [NEW]: $this gets mangled when extending PDO with persistent connection
From: mjs at beebo dot org Operating system: OS X/Linux PHP version: 5.2.5 PHP Bug Type: PDO related Bug description: $this gets mangled when extending PDO with persistent connection Description: The class of $this changes after the instantiation of a class which extends PDO, and which specifies PDO::ATTR_PERSISTENT attribute. Reproduce code: --- class Foo extends PDO { function __construct($dsn) { parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT = true)); } } class Baz extends PDO { function __construct($dsn) { parent::__construct($dsn, null, null, array(PDO::ATTR_PERSISTENT = true)); } } class Bar extends Baz { function quux() { echo get_class($this), \n; $foo = new Foo(sqlite::memory:); echo get_class($this), \n; } } $bar = new Bar(sqlite::memory:); $bar-quux(); Expected result: Bar Bar i.e. get_class($this) returns the same value each time Actual result: -- Bar Foo i.e. $this gets mangled -- Edit bug report at http://bugs.php.net/?id=43831edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=43831r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=43831r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=43831r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=43831r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=43831r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=43831r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=43831r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=43831r=needscript Try newer version:http://bugs.php.net/fix.php?id=43831r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=43831r=support Expected behavior:http://bugs.php.net/fix.php?id=43831r=notwrong Not enough info: http://bugs.php.net/fix.php?id=43831r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=43831r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=43831r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=43831r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=43831r=dst IIS Stability:http://bugs.php.net/fix.php?id=43831r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=43831r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=43831r=float No Zend Extensions: http://bugs.php.net/fix.php?id=43831r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=43831r=mysqlcfg
#34636 [Com]: cannot find -lgcrypt
ID: 34636 Comment by: mjs at beebo dot org Reported By: webmaster at sunshinearcade dot com Status: No Feedback Bug Type: Compile Failure Operating System: Fedora Core 3 PHP Version: 5.0.5 New Comment: PHP 5.2.5 also fails to install on SunOS with the same error. It will install if you configure --without-xsl (or install libgcrypt and libgpg-error). Previous Comments: [2007-11-26 15:42:20] rg dot viza at gmail dot com If you disable the CLI when configuring the source code this error does not occur. Is there a hardcoding concerning libgcrypt in the cli configuration? Thought I'd add this observation since it doesn't look like anyone tried this troubleshooting measure. [2007-11-16 07:02:20] gigipthta at yahoo dot com Got this error while compiling php5.0 on fedora core 4 Please help -lz -lm -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -lresolv -ldl -lz -lcurl -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -lresolv -ldl -lz -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lresolv -lidn -lssl -lcrypto -lssl -lcrypto -lgssapi_krb5 -lkrb5 -lcom_err -lk5crypto -lresolv -ldl -lz -lz -lxml2 -lz -lm -lxml2 -lz -lm -lcrypt -lxml2 -lz -lm -lxslt -lxml2 -lz -lm -lcrypt -o sapi/cli/php /usr/bin/ld: cannot find -lgcrypt collect2: ld returned 1 exit status make: *** [sapi/cli/php] Error 1 [2007-02-13 11:56:35] ben at qolc dot net I hit this bug too, building 5.2.1 on RHEL 4. I think the configure script should test for that library if --with-xsl is specified; many distributions have separate packages for the runtime and compiletime parts of libraries. [2005-10-12 17:03:08] phpbugrep-20050921 at pgregg dot com This is due to an unresolved dependency in RHEL 4 and FC. resolve with: root/pts/3-/mnt/RedHat/RPMS-178#-rpm -i libgpg-error-devel-1.0-1.i386.rpm libgcrypt-devel-1.2.0-3.i386.rpm Or whatever versions came with your RedHat CDs PHP will then make cleanly. Paul Gregg [2005-10-04 01:00:03] php-bugs at lists dot php dot net No feedback was provided for this bug for over a week, so it is being suspended automatically. If you are able to provide the information that was originally requested, please do so and change the status of the bug back to Open. 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/34636 -- Edit this bug report at http://bugs.php.net/?id=34636edit=1
#42349 [NEW]: -r command line switch doesn't work as documented
From: mjs at beebo dot org Operating system: Windows PHP version: 5.2.3 PHP Bug Type: CGI related Bug description: -r command line switch doesn't work as documented Description: The example command-line invocation of PHP described on: http://uk.php.net/features.commandline doesn't work: C:\server\php-5.2.3php -r 'print_r(get_defined_constants());' PHP Parse error: syntax error, unexpected $end in Command line code on line 1 Reproduce code: --- php -r 'print_r(get_defined_constants());' Expected result: A dump of PHP constants. Actual result: -- PHP error message. -- Edit bug report at http://bugs.php.net/?id=42349edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=42349r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=42349r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=42349r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=42349r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=42349r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=42349r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=42349r=needscript Try newer version:http://bugs.php.net/fix.php?id=42349r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=42349r=support Expected behavior:http://bugs.php.net/fix.php?id=42349r=notwrong Not enough info: http://bugs.php.net/fix.php?id=42349r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=42349r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=42349r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=42349r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=42349r=dst IIS Stability:http://bugs.php.net/fix.php?id=42349r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=42349r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=42349r=float No Zend Extensions: http://bugs.php.net/fix.php?id=42349r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=42349r=mysqlcfg
#36870 [NEW]: odbc_execute can't insert a string that starts and ends with a single quote
From: mjs at beebo dot org Operating system: Windows PHP version: 5.1.2 PHP Bug Type: ODBC related Bug description: odbc_execute can't insert a string that starts and ends with a single quote Description: odbc_execute has a feature whereby if the string to be inserted starts and ends with a single quote, the string is interpreted as a filename whose contents are interpreted as the value of the placeholder. There does not appear to be a way to insert a string that begins and ends with a single quote--neither backslashing nor double-quoting works, and it appears from reading the source (php_odbc.c:1014) that nothing else will either. Reproduce code: --- $sth = odbc_prepare($dbh, INSERT INTO people(name) VALUES(?)); $res = odbc_execute($sth, array('\'The Count\'')); Expected result: The string \'The Count\' inserted into the database. Actual result: -- The string is interpreded as a filename, resulting in the erro Can't open file XXX in the error log. -- Edit bug report at http://bugs.php.net/?id=36870edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36870r=trysnapshot44 Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36870r=trysnapshot51 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36870r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=36870r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=36870r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=36870r=needtrace Need Reproduce Script:http://bugs.php.net/fix.php?id=36870r=needscript Try newer version:http://bugs.php.net/fix.php?id=36870r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=36870r=support Expected behavior:http://bugs.php.net/fix.php?id=36870r=notwrong Not enough info: http://bugs.php.net/fix.php?id=36870r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=36870r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=36870r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36870r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=36870r=dst IIS Stability:http://bugs.php.net/fix.php?id=36870r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=36870r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=36870r=float No Zend Extensions: http://bugs.php.net/fix.php?id=36870r=nozend MySQL Configuration Error:http://bugs.php.net/fix.php?id=36870r=mysqlcfg