[php/f15] revert is_a() to php <= 5.3.6 behavior (from upstream) with new option (allow_string) for new behav

Remi Collet remi at fedoraproject.org
Wed Sep 28 17:05:42 UTC 2011


commit c8c634a1145f20ffb6dcbcd158a4662cfaf766fb
Author: remi <fedora at famillecollet.com>
Date:   Wed Sep 28 19:05:22 2011 +0200

    revert is_a() to php <= 5.3.6 behavior (from upstream)  with new option (allow_string) for new behavior

 php-5.3.8-isa.patch |   45 +++++++++++++++++++++++++++++++++++++++++++++
 php.spec            |    9 ++++++++-
 2 files changed, 53 insertions(+), 1 deletions(-)
---
diff --git a/php-5.3.8-isa.patch b/php-5.3.8-isa.patch
new file mode 100644
index 0000000..93de48c
--- /dev/null
+++ b/php-5.3.8-isa.patch
@@ -0,0 +1,45 @@
+--- php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c	2011/09/23 09:29:27	317182
++++ php/php-src/branches/PHP_5_3/Zend/zend_builtin_functions.c	2011/09/23 09:52:09	317183
+@@ -816,13 +816,19 @@
+ 	int class_name_len;
+ 	zend_class_entry *instance_ce;
+ 	zend_class_entry **ce;
++	zend_bool allow_string = only_subclass;
+ 	zend_bool retval;
+ 
+-	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs", &obj, &class_name, &class_name_len) == FAILURE) {
++	if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zs|b", &obj, &class_name, &class_name_len, &allow_string) == FAILURE) {
+ 		return;
+ 	}
+-	
+-	if (Z_TYPE_P(obj) == IS_STRING) {
++	/*
++	   allow_string - is_a default is no, is_subclass_of is yes. 
++	   if it's allowed, then the autoloader will be called if the class does not exist.
++	   default behaviour is different, as 'is_a' usage is normally to test mixed return values 
++	*/
++
++	if (allow_string && Z_TYPE_P(obj) == IS_STRING) {
+ 		zend_class_entry **the_ce;
+ 		if (zend_lookup_class(Z_STRVAL_P(obj), Z_STRLEN_P(obj), &the_ce TSRMLS_CC) == FAILURE) {
+ 			RETURN_FALSE;
+@@ -848,7 +854,7 @@
+ }
+ 
+ 
+-/* {{{ proto bool is_subclass_of(object object, string class_name)
++/* {{{ proto bool is_subclass_of(mixed object_or_string, string class_name [, bool allow_string=true])
+    Returns true if the object has this class as one of its parents */
+ ZEND_FUNCTION(is_subclass_of)
+ {
+@@ -857,8 +863,8 @@
+ /* }}} */
+ 
+ 
+-/* {{{ proto bool is_a(object object, string class_name)
+-   Returns true if the object is of this class or has this class as one of its parents */
++/* {{{ proto bool is_a(mixed object_or_string, string class_name [, bool allow_string=false])
++   Returns true if the first argument is an object and is this class or has this class as one of its parents, */
+ ZEND_FUNCTION(is_a)
+ {
+ 	is_a_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
diff --git a/php.spec b/php.spec
index 5970bc1..e9f68d6 100644
--- a/php.spec
+++ b/php.spec
@@ -37,7 +37,7 @@
 Summary: PHP scripting language for creating dynamic web sites
 Name: php
 Version: 5.3.8
-Release: 1%{?dist}
+Release: 3%{?dist}
 License: PHP
 Group: Development/Languages
 URL: http://www.php.net/
@@ -73,6 +73,8 @@ Patch41: php-5.3.0-easter.patch
 Patch42: php-5.3.1-systzdata-v7.patch
 # See http://bugs.php.net/53436
 Patch43: php-5.3.4-phpize.patch
+# http://svn.php.net/viewvc?view=revision&revision=317183
+Patch44: php-5.3.8-isa.patch
 
 # Fixes for tests
 Patch61: php-5.0.4-tests-wddx.patch
@@ -543,6 +545,7 @@ support for using the enchant library to PHP.
 %patch41 -p1 -b .easter
 %patch42 -p1 -b .systzdata
 %patch43 -p0 -b .headers
+%patch44 -p4 -b .isa
 
 %patch61 -p1 -b .tests-wddx
 
@@ -1049,6 +1052,10 @@ fi
 %files enchant -f files.enchant
 
 %changelog
+* Wed Sep 28 2011 Remi Collet <remi at fedoraproject.org> 5.3.8-3
+- revert is_a() to php <= 5.3.6 behavior (from upstream)
+  with new option (allow_string) for new behavior
+
 * Tue Aug 23 2011 Remi Collet <remi at fedoraproject.org> 5.3.8-1
 - update to 5.3.8
   http://www.php.net/ChangeLog-5.php#5.3.8


More information about the scm-commits mailing list