Compare commits

..
842 changed files with 87429 additions and 54926 deletions

No files matched your search

+1 -1
View File
@@ -452,7 +452,7 @@ STATUS: Working
EXTENSION: pspell
PRIMARY MAINTAINER: Vlad Krupin <phpdevel@echospace.com>
MAINTENANCE: Unknown
STATUS: Working
STATUS: Unknown
SINCE: 4.0.2
-------------------------------------------------------------------------------
EXTENSION: readline
+11 -11
View File
@@ -262,8 +262,8 @@ Apache 1.3.x on Unix systems
10. cd ../apache_1.3.x
11. ./configure --prefix=/www --activate-module=src/modules/php5/libphp5.a
(The above line is correct! Yes, we know libphp5.a does not exist at this
11. ./configure --prefix=/www --activate-module=src/modules/php4/libphp4.a
(The above line is correct! Yes, we know libphp4.a does not exist at this
stage. It isn't supposed to. It will be created.)
12. make
@@ -309,24 +309,24 @@ stop and start:
./configure --with-apxs --with-pgsql
This will create a libphp5.so shared library that is loaded into
This will create a libphp4.so shared library that is loaded into
Apache using a LoadModule line in Apache's httpd.conf file. The
PostgreSQL support is embedded into this libphp5.so library.
PostgreSQL support is embedded into this libphp4.so library.
./configure --with-apxs --with-pgsql=shared
This will create a libphp5.so shared library for Apache, but it will
This will create a libphp4.so shared library for Apache, but it will
also create a pgsql.so shared library that is loaded into PHP either
by using the extension directive in php.ini file or by loading it
explicitly in a script using the dl() function.
./configure --with-apache=/path/to/apache_source --with-pgsql
This will create a libmodphp5.a library, a mod_php5.c and some
accompanying files and copy this into the src/modules/php5 directory
This will create a libmodphp4.a library, a mod_php4.c and some
accompanying files and copy this into the src/modules/php4 directory
in the Apache source tree. Then you compile Apache using
--activate-module=src/modules/php5/libphp5.a and the Apache build
system will create libphp5.a and link it statically into the httpd
--activate-module=src/modules/php4/libphp4.a and the Apache build
system will create libphp4.a and link it statically into the httpd
binary. The PostgreSQL support is included directly into this httpd
binary, so the final result here is a single httpd binary that
includes all of Apache and all of PHP.
@@ -380,8 +380,8 @@ Apache 2.0 on Unix systems
* PHP 4.3.0 or later available at http://www.php.net/downloads.php.
* the latest stable development version. Get the source code
http://snaps.php.net/php5-latest.tar.gz or download binaries for
Windows http://snaps.php.net/win32/php5-win32-latest.zip.
http://snaps.php.net/php4-latest.tar.gz or download binaries for
Windows http://snaps.php.net/win32/php4-win32-latest.zip.
* a prerelease version downloadable from http://qa.php.net/.
* you have always the option to obtain PHP through anonymous CVS.
+4 -4
View File
@@ -7,17 +7,17 @@ $(builddir)/zend_language_scanner.lo: $(builddir)/zend_language_parser.h
$(builddir)/zend_ini_scanner.lo: $(builddir)/zend_ini_parser.h
$(builddir)/zend_language_scanner.c: $(srcdir)/zend_language_scanner.l
@$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
$(LEX) -Pzend -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_language_scanner.l
$(builddir)/zend_language_parser.h: $(builddir)/zend_language_parser.c
$(builddir)/zend_language_parser.c: $(srcdir)/zend_language_parser.y
@$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
$(YACC) -p zend -v -d $(srcdir)/zend_language_parser.y -o $@
$(builddir)/zend_ini_parser.h: $(builddir)/zend_ini_parser.c
$(builddir)/zend_ini_parser.c: $(srcdir)/zend_ini_parser.y
@$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
$(YACC) -p ini_ -v -d $(srcdir)/zend_ini_parser.y -o $@
$(builddir)/zend_ini_scanner.c: $(srcdir)/zend_ini_scanner.l
@$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
$(LEX) -Pini_ -S$(srcdir)/flex.skl -o$@ -i $(srcdir)/zend_ini_scanner.l
$(builddir)/zend_indent.lo $(builddir)/zend_highlight.lo $(builddir)/zend_compile.lo: $(builddir)/zend_language_parser.h
+5 -27
View File
@@ -5,6 +5,9 @@ INSTALL_DATA = $(INSTALL) -m 644
DEFS = -DPHP_ATOM_INC -I$(top_builddir)/include -I$(top_builddir)/main -I$(top_srcdir)
COMMON_FLAGS = $(DEFS) $(INCLUDES) $(EXTRA_INCLUDES) $(CPPFLAGS) $(PHP_FRAMEWORKPATH)
CORE_HEADERS = Zend/ TSRM/ include/ main/ main/streams/ regex/ ext/standard/
INSTALL_HEADERS = $(CORE_HEADERS) $(INSTALL_EXT_HEADERS)
all: $(all_targets)
@echo
@echo "Build complete."
@@ -42,40 +45,15 @@ install-modules: build-modules
@rm -f modules/*.la >/dev/null 2>&1
@$(INSTALL) modules/* $(INSTALL_ROOT)$(EXTENSION_DIR)
install-headers:
-@if test "$(INSTALL_HEADERS)"; then \
for i in $(INSTALL_HEADERS); do \
i=`$(top_srcdir)/build/shtool path -d $$i`; \
paths="$$paths $(INSTALL_ROOT)$(phpincludedir)/$$i"; \
done; \
$(mkinstalldirs) $$paths && \
echo "Installing header files: $(INSTALL_ROOT)$(phpincludedir)/" && \
for i in $(INSTALL_HEADERS); do \
if test "$(PHP_PECL_EXTENSION)"; then \
src=`echo $$i | $(SED) -e "s#ext/$(PHP_PECL_EXTENSION)/##g"`; \
else \
src=$$i; \
fi; \
if test -f "$(top_srcdir)/$$src"; then \
$(INSTALL_DATA) $(top_srcdir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
elif test -f "$(top_builddir)/$$src"; then \
$(INSTALL_DATA) $(top_builddir)/$$src $(INSTALL_ROOT)$(phpincludedir)/$$i; \
else \
(cd $(top_srcdir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i; \
cd $(top_builddir)/$$src && $(INSTALL_DATA) *.h $(INSTALL_ROOT)$(phpincludedir)/$$i) 2>/dev/null || true; \
fi \
done; \
fi
install-su: install-pear
test: all
-@if test ! -z "$(PHP_EXECUTABLE)" && test -x "$(PHP_EXECUTABLE)"; then \
-@if test ! -z $(PHP_EXECUTABLE) && test -x $(PHP_EXECUTABLE); then \
TEST_PHP_EXECUTABLE=$(PHP_EXECUTABLE) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
$(PHP_EXECUTABLE) -d 'open_basedir=' -d 'safe_mode=0' -d 'output_buffering=0' -d 'memory_limit=-1' $(top_srcdir)/run-tests.php -d 'extension_dir=modules/' -d `( . $(PHP_MODULES) ; echo extension=$$dlname)` tests/; \
elif test ! -z "$(SAPI_CLI_PATH)" && test -x "$(SAPI_CLI_PATH)"; then \
elif test ! -z $(SAPI_CLI_PATH) && test -x $(SAPI_CLI_PATH); then \
TEST_PHP_EXECUTABLE=$(top_builddir)/$(SAPI_CLI_PATH) \
TEST_PHP_SRCDIR=$(top_srcdir) \
CC="$(CC)" \
+292 -549
View File
File diff suppressed because it is too large. Load diff
+8
View File
@@ -64,6 +64,14 @@ documentation
* Add developer documentation.
* Add detailed documentation for Java extension.
ext/bz2
-------
* Add an ini directive to specify the size of decompression buffer.
The default 4k is too small for large files and also requires much time
for decompression. 40k is suitable for such files, however it may be too
much under certain environments. There should be appropriate default
settings for the various SAPI modules (e.g. apache and cli).
ext/curl
--------
* Have a warning scheme for when people use unsupported features.
+1
View File
@@ -2,3 +2,4 @@ Zend Engine
-----------
- Look at making zend_constant value member be a zval* instead of zval. (Andi)
- Implement inheritance rules for type hints. (Marcus)
- Find a keyword for the if-set-or operator (apply the patch). (Marcus, all)
+1
View File
@@ -430,6 +430,7 @@ void *tsrm_new_interpreter_context(void)
current = tsrm_tls_get();
new_ctx = malloc(sizeof(*new_ctx));
allocate_new_resource(&new_ctx, thread_id);
/* switch back to the context that was in use prior to our creation
-552
View File
@@ -1,552 +0,0 @@
$Id$
UPGRADE NOTES - PHP 5.1
1. Changes in reference handling
a. Overview
b. Code that worked under PHP 4.3, but now fails
c. Code that was valid under PHP 4.3, but now throws an error
d. Code that failed under PHP 4.3, but now works
e. Code that 'should have worked' under PHP 5.0
f. Warnings that came and went
2. Reading []
3. instanceof, is_a(), is_subclass_of(), catch
4. Integer values in function parameters
5. Abstract private methods
6. Access modifiers in interfaces
7. Changes in inheritance rules
8. Class constants
9. Extensions
a. Extensions that are gone from the PHP core
b. Class constants in new PHP 5.1 extensions
10. Date/time support
11. Changes in database support
a. PDO overview
b. Changes in MySQL support
c. Changes in SQLite support
12. Further migration information
13. Checking for E_STRICT errors
===============================================================================
1. Changes in reference handling
================================
1a. Overview
============
>From the PHP script writer's point of view, the change most likely to impact
legacy code is in the way that references are handled in all PHP versions
post-dating the PHP 4.4.0 release.
Until and including PHP 4.3, it was possible to send, assign or return variables
by reference that should really be returned by value, such as a constant, a
temporary value (e.g. the result of an expression), or the result of a function
that had itself been returned by value, as here:
<?php
$foo = "123";
function return_value() {
global $foo;
return $foo;
}
$bar = &return_value();
?>
Although this code would usually work as expected under PHP 4.3, in the general
case the result is undefined. The Zend Engine could not act correctly on these
values as references. This bug could and did lead to various hard-to-reproduce
memory corruption problems, particularly where the code base was large.
In PHP 4.4.0, PHP 5.0.4 and all subsequent PHP releases, the Engine was fixed
to 'know' when the reference operation is being used on a value that should
not be referenced. The actual value is now used in such cases, and a warning
is emitted. The warning takes the form of an E_NOTICE in PHP 4.4.0 and up,
and E_STRICT in PHP 5.0.4 and up.
Code that could potentially produce memory corruption can no longer do so.
However, some legacy code might work differently as a result.
1b. Code that worked under PHP 4.3, but now fails
=================================================
<?php
function func(&$arraykey) {
return $arraykey; // function returns by value!
}
$array = array('a', 'b', 'c');
foreach (array_keys($array) as $key) {
$y = &func($array[$key]);
$z[] =& $y;
}
var_dump($z);
?>
Running the above script under any version of PHP that pre-dates the reference
fix would produce this output:
array(3) {
[0]=>
&string(1) "a"
[1]=>
&string(1) "b"
[2]=>
&string(1) "c"
}
Following the reference fix, the same code would result in:
array(3) {
[0]=>
&string(1) "c"
[1]=>
&string(1) "c"
[2]=>
&string(1) "c"
}
This is because, following the changes, func() assigns by value. The value
of $y is re-assigned, and reference-binding is preserved from $z. Prior
to the fix, the value was assigned by reference, leading $y to be
re-bound on each assignment. The attempt to bind to a temporary value
by reference was the cause of the memory corruption.
Such code can be made to work identically in both the pre-fix and the
post-fix PHP versions. The signature of func() can be altered to return
by reference, or the reference assignment can be removed from the result
of func().
<?php
function func() {
return 'function return';
}
$x = 'original value';
$y =& $x;
$y = &func();
echo $x;
?>
In PHP 4.3 $x would be 'original value', whereas after the changes it would
be 'function return' - remember that where the function does not return by
reference, the reference assignment is converted to a regular assignment.
Again, this can be brought to a common base, either by forcing func() to
return by reference or by eliminating the by-reference assignment.
1c. Code that was valid under PHP 4.3, but now throws an error
==============================================================
<?php
class Foo {
function getThis() {
return $this;
}
function destroyThis() {
$baz =& $this->getThis();
}
}
$bar = new Foo();
$bar->destroyThis();
var_dump($bar);
?>
In PHP 5.0.3, $bar evaluated to NULL instead of returning an object.
That happened because getThis() returns by value, but the value here
is assigned by reference. Although it now works in the expected way,
this is actually invalid code which will throw an E_NOTICE under
PHP 4.4 or an E_STRICT under PHP 5.0.4 and up.
1d. Code that failed under PHP 4.3, but now works
=================================================
<?php
function &f() {
$x = "foo";
var_dump($x);
print "$x\n";
return($a);
}
for ($i = 0; $i < 3; $i++) {
$h = &f();
}
?>
In PHP 4.3 the third call to var_dump produces NULL, due to the memory
corruption caused by returning an uninitialized value by reference.
This is valid code in PHP 5.0.4 and up, but threw errors in earlier
releases of PHP.
<?php
$arr = array('a1' => array('alfa' => 'ok'));
$arr =& $arr['a1'];
echo '-'.$arr['alfa']."-\n";
?>
Until PHP 5.0.5, it wasn't possible to assign an array element by
reference in this way. It now is.
1e. Code that 'should have worked' under PHP 5.0
================================================
There are a couple of instances of bugs reported under PHP 5.0 prior
to the reference fixes which now 'work'. However, in both cases errors
are thrown by PHP 5.1, because the code was invalid in the first place.
Returning values by reference using self:: now works in the general
case but throws an E_STRICT warning, and although your mileage may
vary when assigning by reference to an overloaded object, you will
still see an E_ERROR when you try it, even where the assignment
itself appears to work.
1f. Warnings that came and went
===============================
<?php
function & foo() {
$var = 'ok';
return $var;
}
function & bar() {
return foo();
}
$a =& bar();
echo "$a\n";
?>
Nested calls to functions returning by reference are valid code under both
PHP 4.3 and PHP 5.1, but threw an unwarranted E_NOTICE or E_STRICT under
the intervening PHP releases.
2. Reading []
=============
<?php
class XmlTest {
function test_ref(&$test) {
$test = "ok";
}
function test($test) { }
function run() {
$ar = array();
$this->test_ref($ar[]);
var_dump($ar);
$this->test($ar[]);
}
}
$o = new XmlTest();
$o->run();
?>
This should always have thrown a fatal E_ERROR, because [] cannot be used
for reading in PHP. It is invalid code in PHP 4.4.2 and PHP 5.0.5 upward.
3. instanceof, is_a(), is_subclass_of(), catch
==============================================
In PHP 5.0, is_a() was deprecated and replaced by the "instanceof" operator.
There were some issues with the initial implementation of "instanceof", which
relied on __autoload() to search for missing classes. If the class was not
present, "instanceof" would throw a fatal E_ERROR due to the failure of
__autoload() to discover that class. The same behaviour occurred in the
"catch" operator and the is_subclass_of() function, for the same reason.
None of these functions or operators call __autoload() in PHP 5.1, and
the class_exists() workarounds used in code written for PHP 5.0, while
not problematic in any way, are no longer necessary.
4. Integer values in function parameters
========================================
With the advent of PHP 5.0, a new parameter parsing API was introduced
which is used by a large number of PHP functions. In all versions of
PHP between 5.0 and 5.1, the handling of integer values was very strict
and would reject non-well formed numeric values when a PHP function
expected an integer. These checks have now been relaxed to support
non-well formed numeric strings such as " 123" and "123 ", and will
no longer fail as they did under PHP 5.0. However, to promote code
safety and input validation, PHP functions will now emit an E_NOTICE
when such strings are passed as integers.
5. Abstract private methods
===========================
Abstract private methods were supported between PHP 5.0.0 and PHP 5.0.4,
but were then disallowed on the grounds that the behaviours of 'private'
and 'abstract' are mutually exclusive.
6. Access modifiers in interfaces
=================================
Under PHP 5.0, function declarations in interfaces were treated in exactly
the same way as function declarations in classes. This has not been the case
since October 2004, at which point only the 'public' access modifier was
allowed in interface function declarations. Since April 2005 - which pre-dates
the PHP 5.0b1 release - the 'static' modifier has also been allowed. However,
the 'protected' and 'private' modifiers will now throw an E_ERROR, as will
'abstract'. Note that this change should not affect your existing code, as
none of these modifiers makes sense in the context of interfaces anyway.
7. Changes in inheritance rules
===============================
Under PHP 5.0, it was possible to have a function declaration in a derived class
that did not match the declaration of the same function in the base class, e.g.
class Base {
function &return_by_ref() {
$r = 1;
return $r;
}
}
class Derived extends Base {
function return_by_ref() {
return 1;
}
}
This code will cause an E_STRICT error to be emitted under PHP 5.1.
8. Class constants
==================
Under PHP 5.0, the following code was valid:
<?php
class test {
const foobar = 'foo';
const foobar = 'bar';
}
?>
Under PHP 5.1, redefinition of a class constant will throw a fatal E_ERROR.
9. Extensions
=============
9a. Extensions that are gone from the PHP core
==============================================
One of the first things you're likely to notice when you download PHP 5.1 is that
several of the older extensions have disappeared. Those extensions that are still
actively maintained are available in the PHP Extension Community Library (PECL),
at http://pecl.php.net. Windows binaries are built regularly, and you can obtain
the binaries for PECL extensions built against PHP 5.1 from
http://pecl4win.php.net/list.php/5_1.
Extension Alternative/status
========= ========================
ext/cpdf pecl/pdflib
ext/dbx pecl/dbx
ext/dio pecl/dio
ext/fam not actively maintained
ext/ingres_ii pecl/ingres
ext/ircg not actively maintained
ext/mcve pecl/mcve
ext/mnogosearch not actively maintained
ext/oracle ext/oci8 or ext/pdo_oci
ext/ovrimos not actively maintained
ext/pfpro not actively maintained
- alternatives at http://pecl.php.net/packages.php?catpid=18&catname=Payment
ext/w32api pecl/ffi
ext/yp not actively maintained
sapi/activescript http://pecl4win.php.net/ext.php/php5activescript.dll (PECL package)
or pecl/activescript (CVS)
Modules in PECL that are not actively maintained (i.e. have not been supported
for some time, have no active maintainer working on them currently, and do not
have any PECL package releases), are still available in CVS at
http://cvs.php.net/pecl/. However, unreleased PHP modules are by their nature
unsupported, and your mileage may vary when attempting to install or use them.
9b. Class constants in new PHP 5.1 extensions
=============================================
The Zend Engine 2.1 API allows extension developers to declare class constants
in object oriented extensions. New extensions written for PHP 5.1, including SPL,
PDO, ext/XMLReader and ext/date, have their constants in the format
PDO::CLASS_CONSTANT
rather than in the C format
PDO_CLASS_CONSTANT
in order to minimise pollution of the global namespace in PHP.
Note that the new Date class exists at this point purely to allow the core date
extension to adhere to the above convention, although extended functionality
is planned for the the class in the future.
10. Date/time support
====================
Date/time support has been fully rewritten in PHP 5.1, and no longer
uses the system settings to 'know' the timezone in operation. It will
instead utilize, in the following order:
* The timezone set using the date_default_timezone_set() function (if any)
* The TZ environment variable (if non empty)
* The date.timezone ini option (if set)
* "magical" guess (if the operating system supports it)
* If none of the above options succeeds, UTC
To ensure accuracy (and avoid an E_STRICT warning), you will need to define
your timezone in your php.ini using the following format:
date.timezone = Europe/London
The supported timezones are listed, in this format, in the PHP manual at
http://www.php.net/manual/en/timezones.php.
11. Changes in database support
==============================
11a. PDO overview
================
PHP Data Objects (PDO) were introduced as a PECL extension under PHP 5.0,
and became part of the core PHP distribution in PHP 5.1. The PDO extension
provides a consistent interface for database access, and is used alongside
database-specific PDO drivers. Each driver may also have database-specific
functions of its own, but basic data access functionality such as issuing
queries and fetching data is covered by PDO functions, using the driver
named in PDO::__construct().
Note that the PDO extension, and its drivers, are intended to be built as
shared extensions. This will enable straightforward driver upgrades from
PECL, without forcing you to rebuild all of PHP.
At the point of the PHP 5.1 release, PDO is more than ready for widespread
testing and could be adopted in most situations. However, it is important
to understand that PDO and its drivers are comparatively young and may be
missing certain database-specific features; evaluate PDO carefully before
you use it in new projects.
Legacy code will generally rely on the pre-existing database extensions,
which are still maintained.
There is more in-depth information about the PDO extension in the manual
at http://www.php.net/manual/ref.pdo.php.
11b. Changes in MySQL support
============================
In PHP 4, MySQL 3 support was built-in. With the release of PHP 5.0 there
were two MySQL extensions, named 'mysql' and 'mysqli', which were designed
to support MySQL < 4.1 and MySQL 4.1 and up, respectively. With the
introduction of PDO, which provides a very fast interface to all the
database APIs supported by PHP, the PDO_MYSQL driver can support any
of the current versions (MySQL 3, 4 or 5) in PHP code written for PDO,
depending on the MySQL library version used during compilation. The
older MySQL extensions remain in place for reasons of back compatibility,
but are not enabled by default.
11c. Changes in SQLite support
=============================
In PHP 5.0, SQLite 2 support was provided by the built-in sqlite
extension, which was also available as a PECL extension in PHP 4.3
and PHP 4.4. With the introduction of PDO, the sqlite extension doubles
up to act as a 'sqlite2' driver for PDO; it is due to this that the
sqlite extension in PHP 5.1 has a dependency upon the PDO extension.
PHP 5.1 ships with a number of alternative interfaces to sqlite:
The sqlite extension provides the "classic" sqlite procedural/OO API
that you may have used in prior versions of PHP. It also provides the
PDO 'sqlite2' driver, which allows you to access legacy SQLite 2
databases using the PDO API.
PDO_SQLITE provides the 'sqlite' version 3 driver. SQLite version 3
is vastly superior to SQLite version 2, but the file formats of the
two versions are not compatible.
If your SQLite-based project is already written and working against
earlier PHP versions, then you can continue to use ext/sqlite without
problems, but will need to explicitly enable both PDO and sqlite. New
projects should use PDO and the 'sqlite' (version 3) driver, as this is
faster than SQLite 2, has improved locking concurrency, and supports
both prepared statements and binary columns natively.
12. Further migration information
================================
For general information about migrating from PHP 4 to PHP 5, please refer to
the relevant section in the PHP manual at http://www.php.net/manual/migration5.php.
13. Checking for E_STRICT errors
================================
If you only have a single script to check, you can pick up E_STRICT
errors using PHP's commandline lint facility:
php -d error_reporting=4095 -l script_to_check.php
For larger projects, the shell script below will achieve the same task:
#!/bin/sh
directory=$1
shift
# These extensions are checked
extensions="php inc"
check_file ()
{
echo -ne "Doing PHP syntax check on $1 ..."
# Options:
ERRORS=`/www/php/bin/php -d display_errors=1 -d html_errors=0 -d error_prepend_string=" " -d error_append_string=" " -d error_reporting=4095 -l $1 | grep -v "No syntax errors detected"`
if test -z "$ERRORS"; then
echo -ne "OK."
else
echo -e "Errors found!\n$ERRORS"
fi
echo
}
# loop over remaining file args
for FILE in "$@" ; do
for ext in $extensions; do
if echo $FILE | grep "\.$ext$" > /dev/null; then
if test -f $FILE; then
check_file "$FILE"
fi
fi
done
done
+11 -14
View File
@@ -4,31 +4,28 @@ dnl This file contains local autoconf functions.
AC_DEFUN([LIBZEND_BISON_CHECK],[
# we only support certain bison versions
bison_version_list="1.28 1.35 1.75 1.875 2.0 2.1"
bison_version_list="1.28 1.35 1.75 1.875 2.0"
# for standalone build of Zend Engine
test -z "$SED" && SED=sed
bison_version=none
if test "$YACC"; then
AC_CACHE_CHECK([for bison version], php_cv_bison_version, [
bison_version_vars=`bison --version 2> /dev/null | grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /' | tr -d a-z`
set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | $SED -e 's/\./ /'|tr -d a-z`
bison_version="${1}.${2}"
php_cv_bison_version=invalid
if test -n "$bison_version_vars"; then
set $bison_version_vars
bison_version="${1}.${2}"
for bison_check_version in $bison_version_list; do
if test "$bison_version" = "$bison_check_version"; then
php_cv_bison_version="$bison_check_version (ok)"
break
fi
done
fi
for bison_check_version in $bison_version_list; do
if test "$bison_version" = "$bison_check_version"; then
php_cv_bison_version="$bison_check_version (ok)"
fi
done
])
else
bison_version=none
fi
case $php_cv_bison_version in
""|invalid[)]
bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
bison_msg="bison versions supported for regeneration of the Zend/PHP parsers: $bison_version_list (found: $bison_version)."
AC_MSG_WARN([$bison_msg])
YACC="exit 0;"
;;
+1 -1
View File
@@ -12,4 +12,4 @@ foo(123);
--EXPECTF--
3
Fatal error: Argument 1 passed to foo() must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
Fatal error: Argument 1 must be an array, called in %sarray_type_hint_001.php on line 7 and defined in %sarray_type_hint_001.php on line 2
+1 -1
View File
@@ -39,5 +39,5 @@ echo "Done\n";
2
3
Done
test::destructor
test::__destruct
test::destructor
+3
View File
@@ -34,3 +34,6 @@ $c->viewMom();
--EXPECT--
protected method
protected property
--EXPECT--
protected method
protected property
+1 -1
View File
@@ -8,7 +8,7 @@ class Test {
function __copy()
{
$string = PHP_VERSION;
$version = $string[0];
$version = $string{0};
if($string < 5)
{
return $this;
+1 -1
View File
@@ -3,7 +3,7 @@ Bug #26281 (switch() crash when condition is a string offset)
--FILE--
<?php
$x = 'abc';
switch ($x[0]) {
switch ($x{0}) {
case 'a':
echo "no crash\n";
break;
+2 -2
View File
@@ -4,14 +4,14 @@ Bug #26801 (switch ($a{0}) crash)
<?php
$a = '11';
$b = $a[0];
$b = $a{0};
switch ($b) {
case '-':
break;
}
$a = '22';
switch ($a[0]) {
switch ($a{0}) {
case '-':
break;
}
+3 -3
View File
@@ -9,11 +9,11 @@ var_dump(isset($a->b));
$a = '0';
var_dump(isset($a->b));
$a = '';
var_dump(isset($a['b']));
var_dump(isset($a{'b'}));
$a = 'a';
var_dump(isset($a['b']));
var_dump(isset($a{'b'}));
$a = '0';
var_dump(isset($a['b']));
var_dump(isset($a{'b'}));
$simpleString = "Bogus String Text";
echo isset($simpleString->wrong)?"bug\n":"ok\n";
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #31177 (menory corruption because of incorrect refcounting)
--FILE--
<?php
class foo {
function foo($n=0) {
if($n) throw new Exception("new");
}
}
$x = new foo();
try {
$y=$x->foo(1);
} catch (Exception $e) {
var_dump($x);
}
--EXPECT--
object(foo)#1 (0) {
}
-29
View File
@@ -1,29 +0,0 @@
--TEST--
Bug #31341 (escape on curly inconsistent)
--FILE--
<?php
$a = array(
"$ \{ ",
" \{ $",
" \{$ ",
" $\{ ",
" \$\{ ",
" \{\$ ",
"\$ \{ ",
" \{ \$",
"% \{ ");
foreach ($a as $v) {
echo("'$v'\n");
}
?>
--EXPECT--
'$ \{ '
' \{ $'
' {$ '
' $\{ '
' $\{ '
' \{$ '
'$ \{ '
' \{ $'
'% \{ '
+1 -9
View File
@@ -1,7 +1,5 @@
--TEST--
Bug #33257 array_splice() inconsistent when passed function instead of variable
--INI--
error_reporting=4095
--FILE--
<?php
class X {
@@ -16,10 +14,4 @@ array_splice(X::getArr(), 1, 1);
print_r(X::getArr());
?>
--EXPECTF--
Strict Standards: Only variables should be passed by reference in %sbug33257.php on line 10
Array
(
[0] => a
[1] => b
[2] => c
)
Fatal error: Only variables can be passed by reference in %sbug33257.php on line 10
-66
View File
@@ -1,66 +0,0 @@
--TEST--
Bug #33512 (unset() overloaded properties doesn't work)
--FILE--
<?php
class TheObj {
public $RealVar1, $RealVar2, $RealVar3, $RealVar4;
public $Var = array();
function __set($var, $val) {
$this->Var[$var] = $val;
}
function __get($var) {
if(isset($this->Var[$var])) return $this->Var[$var];
else return -1;
}
function __unset($var) {
unset($this->Var[$var]);
}
}
$SomeObj = new TheObj;
// this will fine
$SomeObj->RealVar1 = 'somevalue';
$SomeObj->{'RealVar2'} = 'othervalue';
$SomeObj->{'RealVar'.(3)} = 'othervaluetoo';
$SomeObj->{'RealVar'.'4'} = 'anothervalue';
// this will fine too
$SomeObj->Virtual1 = 'somevalue';
$SomeObj->{'Virtual2'} = 'othervalue';
// it's can't be used since this will encounter error
$SomeObj->{'Virtual'.(3)} = 'othervaluetoo';
$SomeObj->{'Virtual'.'4'} = 'anothervalue';
// but this will fine, ofcourse
$SomeObj->Var['Virtual'.(3)] = 'othervaluetoo';
$SomeObj->Var['Virtual'.'4'] = 'anothervalue';
var_dump($SomeObj->RealVar1);
print $SomeObj->{'RealVar'.(3)}."\n";
unset($SomeObj->RealVar1);
unset($SomeObj->{'RealVar'.(3)});
//the lines below will catch by '__get' magic method since these variables are unavailable anymore
var_dump($SomeObj->RealVar1);
print $SomeObj->{'RealVar'.(3)}."\n";
// now we will try to unset these variables
unset($SomeObj->Virtual1);
unset($SomeObj->{'Virtual'.(3)});
//but, these variables are still available??? eventhough they're "unset"-ed
print $SomeObj->Virtual1."\n";
print $SomeObj->{'Virtual'.(3)}."\n";
?>
--EXPECT--
string(9) "somevalue"
othervaluetoo
int(-1)
-1
-1
-1
-45
View File
@@ -1,45 +0,0 @@
--TEST--
Bug #33732 (Wrong behavior of constants in class and interface extending)
--FILE--
<?php
interface iA {
const cA = "const of iA\n";
}
class A implements iA {
}
class B extends A implements iA {
}
echo iA::cA;
echo A::cA;
echo B::cA;
interface iA2 {
const cA = "const of iA2\n";
}
interface iB2 extends iA2 {
}
class A2 implements iA2 {
}
class B2 extends A2 implements iB2 {
}
echo iA2::cA;
echo A2::cA;
echo iB2::cA;
echo B2::cA;
?>
--EXPECT--
const of iA
const of iA
const of iA
const of iA2
const of iA2
const of iA2
const of iA2
-40
View File
@@ -1,40 +0,0 @@
--TEST--
bug #33771 (error_reporting falls to 0 when @ was used inside try/catch block)
--FILE--
<?php
error_reporting(E_ALL | E_STRICT);
var_dump(error_reporting());
function make_exception()
{
throw new Exception();
}
function make_exception_and_change_err_reporting()
{
error_reporting(E_ALL);
throw new Exception();
}
try {
@make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
try {
@make_exception_and_change_err_reporting();
} catch (Exception $e) {}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(4095)
int(4095)
int(2047)
Done
+1 -1
View File
@@ -26,4 +26,4 @@ FooTest(new Foo());
--EXPECTF--
Warning: Missing argument 1 for NormalTest(), called in %sbug33996.php on line 17 and defined in %sbug33996.php on line 12
Hi!
Fatal error: Argument 1 passed to FooTest() must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
Fatal error: Argument 1 must be an object of class Foo, called in %sbug33996.php on line 18 and defined in %sbug33996.php on line 7
-24
View File
@@ -1,24 +0,0 @@
--TEST--
Bug #34062 (Crash in catch block when many arguments are used)
--FILE--
<?php
function f1() { throw new Exception; }
function f2() { echo "here\n"; }
try {
// Currently it's the minimum required number of zeros
// If you remove one, it won't crash
max(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, f1());
} catch (Exception $e) {
echo "(((\n";
f2(0, 0, 0); // Won't crash if less than 3 zeros here
echo ")))\n";
}
?>
--EXPECT--
(((
here
)))
-10
View File
@@ -1,10 +0,0 @@
--TEST--
Bug #34137 (assigning array element by reference causes binary mess)
--FILE--
<?php
$arr1 = array('a1' => array('alfa' => 'ok'));
$arr1 =& $arr1['a1'];
echo '-'.$arr1['alfa']."-\n";
?>
--EXPECT--
-ok-
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #34199 (if($obj)/if(!$obj) inconsistency because of cast handler)
--SKIPIF--
<?php if (!extension_loaded("simplexml")) print "skip"; ?>
--FILE--
<?php
$xml = "<root></root>";
$xml = simplexml_load_string($xml);
$kids = $xml->children();
var_dump((bool)$kids);
if($kids) echo "bug\n"; else echo "ok\n";
if(!$kids) echo "ok\n"; else echo "bug\n";
?>
--EXPECT--
bool(false)
ok
ok
-36
View File
@@ -1,36 +0,0 @@
--TEST--
Bug #34260 (Segfault with callbacks (array_map) + overloading)
--FILE--
<?php
class Faulty
{
function __call($Method,$Args)
{
switch($Method)
{
case 'seg':
echo "I hate me\n";
break;
}
}
function NormalMethod($Args)
{
echo "I heart me\n";
}
}
$Faulty = new Faulty();
$Array = array('Some junk','Some other junk');
// This causes a seg fault.
$Failure = array_map(array($Faulty,'seg'),$Array);
// This does not.
$Failure = array_map(array($Faulty,'NormalMethod'),$Array);
?>
--EXPECT--
I hate me
I hate me
I heart me
I heart me
-34
View File
@@ -1,34 +0,0 @@
--TEST--
Bug #34310 (foreach($arr as $c->d => $x) crashes)
--FILE--
<?php
class C
{
public $d;
}
$c = new C();
$arr = array (1 => 'a', 2 => 'b', 3 => 'c');
// Works fine:
foreach($arr as $x => $c->d)
{
echo "{$x} => {$c->d}\n";
}
// Crashes:
foreach($arr as $c->d => $x)
{
echo "{$c->d} => {$x}\n";
}
?>
--EXPECT--
1 => a
2 => b
3 => c
1 => a
2 => b
3 => c
-15
View File
@@ -1,15 +0,0 @@
--TEST--
Bug #34358 (Fatal error: Cannot re-assign $this(again))
--FILE--
<?php
class foo {
function bar() {
$ref = &$this;
}
}
$x = new foo();
$x->bar();
echo "ok\n";
?>
--EXPECT--
ok
-27
View File
@@ -1,27 +0,0 @@
--TEST--
Bug #34467 (foreach + __get + __set incosistency)
--FILE--
<?php
class abc {
private $arr;
function __set ($key, $value) {
$this->arr[$key] = $value;
}
function __get ($key) {
return $this->arr[$key];
}
}
$abc = new abc();
foreach (array (1,2,3) as $abc->k => $abc->v) {
var_dump($abc->k,$abc->v);
}
?>
--EXPECT--
int(0)
int(1)
int(1)
int(2)
int(2)
int(3)
-38
View File
@@ -1,38 +0,0 @@
--TEST--
Bug #34518 (Unset doesn't separate container in CV)
--FILE--
<?php
$arr = array(1,2,3);
$arr["foo"] = array(4,5,6);
$copy = $arr;
unset($copy["foo"][0]);
print_r($arr);
print_r($copy);
?>
--EXPECT--
Array
(
[0] => 1
[1] => 2
[2] => 3
[foo] => Array
(
[0] => 4
[1] => 5
[2] => 6
)
)
Array
(
[0] => 1
[1] => 2
[2] => 3
[foo] => Array
(
[1] => 5
[2] => 6
)
)
-18
View File
@@ -1,18 +0,0 @@
--TEST--
Bug #34617 (zend_deactivate: objects_store used after zend_objects_store_destroy is called)
--SKIPIF--
<?php if (!extension_loaded("xml")) print "skip"; ?>
--FILE--
<?php
class Thing {}
function boom()
{
$reader = xml_parser_create();
xml_set_object($reader, new Thing());
die("ok\n");
xml_parser_free($reader);
}
boom();
?>
--EXPECT--
ok
-25
View File
@@ -1,25 +0,0 @@
--TEST--
Bug #34678 (__call(), is_callable() and static methods)
--FILE--
<?php
class A {
public function __call($m, $a) {
echo "__call\n";
}
}
class B extends A {
public static function foo() {
echo "foo\n";
}
}
if (is_callable(array('B', 'foo'))) {
call_user_func(array('B', 'foo'));
}
if (is_callable(array('A', 'foo'))) {
call_user_func(array('A', 'foo'));
}
?>
--EXPECT--
foo
-28
View File
@@ -1,28 +0,0 @@
--TEST--
Bug #34712 zend.ze1_compatibility_mode = on segfault
--INI--
zend.ze1_compatibility_mode=1
error_reporting=4095
--FILE--
<?php
class foo {
function foo(&$obj_ref) {
$this->bar = &$obj_ref;
}
}
class bar {
function bar() {
$this->foo = new foo($this);
}
}
$test = new bar;
echo "ok\n";
?>
--EXPECTF--
Strict Standards: Implicit cloning object of class 'foo' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 11
Strict Standards: Implicit cloning object of class 'bar' because of 'zend.ze1_compatibility_mode' in %sbug34712.php on line 15
ok
-33
View File
@@ -1,33 +0,0 @@
--TEST--
Bug #34767 (Zend Engine 1 Compatibility not copying objects correctly)
--INI--
zend.ze1_compatibility_mode=1
error_reporting=4095
--FILE--
<?php
$a->y = &new stdClass();
print_r($a);
$b = $a;
$a->y->z = 1;
print_r($b);
?>
--EXPECTF--
Strict Standards: Assigning the return value of new by reference is deprecated in %sbug34767.php on line 2
stdClass Object
(
[y] => stdClass Object
(
)
)
Strict Standards: Implicit cloning object of class 'stdClass' because of 'zend.ze1_compatibility_mode' in %sbug34767.php on line 4
stdClass Object
(
[y] => stdClass Object
(
[z] => 1
)
)
-22
View File
@@ -1,22 +0,0 @@
--TEST--
Bug #34786 (2 @ results in change to error_reporting() to random value)
--FILE--
<?php
function foo($a,$b,$c) {
echo "foo: ".error_reporting()."\n";
}
function bar() {
echo "bar: ".error_reporting()."\n";
}
error_reporting(1);
echo "before: ".error_reporting()."\n";
@foo(1,@bar(),3);
echo "after: ".error_reporting()."\n";
?>
--EXPECT--
before: 1
bar: 0
foo: 0
after: 1
-27
View File
@@ -1,27 +0,0 @@
--TEST--
bug #34873 (Segmentation Fault on foreach in object)
--FILE--
<?php
class pwa {
public $var;
function __construct(){
$this->var = array();
}
function test (){
$cont = array();
$cont["mykey"] = "myvalue";
foreach ($cont as $this->var['key'] => $this->var['value'])
var_dump($this->var['value']);
}
}
$myPwa = new Pwa();
$myPwa->test();
echo "Done\n";
?>
--EXPECT--
string(7) "myvalue"
Done
-11
View File
@@ -1,11 +0,0 @@
--TEST--
Bug #34879 (str_replace, array_map corrupt negative array indexes on 64-bit platforms)
--FILE--
<?php
print_r(str_replace('a', 'b', array(-1 =>-1)));
?>
--EXPECT--
Array
(
[-1] => -1
)
-33
View File
@@ -1,33 +0,0 @@
--TEST--
Bug #34893 (PHP5.1 overloading, Cannot access private property)
--FILE--
<?php
class A {
private $p;
function __get($name){
return $this->$name;
}
function __set($name, $value) {
$this->$name = $value;
}
}
class B {
private $t;
function __get($name){
return $this->$name;
}
function __set($name, $value) {
$this->$name = $value;
}
}
$a = new A;
$b = new B;
$a->p = $b;
$b->t = "foo";
echo $a->p->t;
$a->p->t = "bar";
echo $a->p->t;
?>
--EXPECT--
foobar
-21
View File
@@ -1,21 +0,0 @@
--TEST--
Bug #35017 (Exception thrown in error handler may cause unexpected behavior)
--FILE--
<?php
set_error_handler('errorHandler');
try {
if ($a) {
echo "1\n";
} else {
echo "0\n";
}
echo "?\n";
} catch(Exception $e) {
echo "This Exception should be catched\n";
}
function errorHandler($errno, $errstr, $errfile, $errline, $vars) {
throw new Exception('Some Exception');
}
?>
--EXPECT--
This Exception should be catched
-41
View File
@@ -1,41 +0,0 @@
--TEST--
Bug #35239 (Objects can lose references)
--FILE--
<?php
$a = new stdClass;
$a->x0 = new stdClass;
$a->x0->y0 = 'a';
$a->x0->y1 =& $a->x0;
$a->x0->y2 =& $a->x0;
$a->x0->y0 = 'b';
var_dump($a);
$a->x0->y1 = "ok\n";
echo $a->x0;
?>
--EXPECT--
object(stdClass)#1 (1) {
["x0"]=>
&object(stdClass)#2 (3) {
["y0"]=>
string(1) "b"
["y1"]=>
&object(stdClass)#2 (3) {
["y0"]=>
string(1) "b"
["y1"]=>
*RECURSION*
["y2"]=>
*RECURSION*
}
["y2"]=>
&object(stdClass)#2 (3) {
["y0"]=>
string(1) "b"
["y1"]=>
*RECURSION*
["y2"]=>
*RECURSION*
}
}
}
ok
-23
View File
@@ -1,23 +0,0 @@
--TEST--
catch shouldn't call __autoload
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
try {
} catch (A $e) {
}
try {
throw new Exception();
} catch (B $e) {
} catch (Exception $e) {
echo "ok\n";
}
?>
--EXPECT--
ok
-26
View File
@@ -1,26 +0,0 @@
--TEST--
testing @ and error_reporting - 1
--FILE--
<?php
error_reporting(E_ALL);
function foo($arg) {
}
function bar() {
throw new Exception("test");
}
try {
@foo(@bar());
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECT--
int(2047)
Done
-27
View File
@@ -1,27 +0,0 @@
--TEST--
testing @ and error_reporting - 2
--FILE--
<?php
error_reporting(E_ALL);
function foo($arg) {
}
function bar() {
error_reporting(E_ALL|E_STRICT);
throw new Exception("test");
}
try {
@foo(@bar());
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECT--
int(4095)
Done
-35
View File
@@ -1,35 +0,0 @@
--TEST--
testing @ and error_reporting - 3
--FILE--
<?php
error_reporting(E_ALL);
function foo($arg) {
echo @$nonex_foo;
}
function bar() {
echo @$nonex_bar;
throw new Exception("test");
}
function foo1() {
echo $undef1;
error_reporting(E_ALL|E_STRICT);
echo $undef2;
}
try {
@foo(@bar(@foo1()));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef2 in %s on line %d
int(4095)
Done
-23
View File
@@ -1,23 +0,0 @@
--TEST--
testing @ and error_reporting - 4
--FILE--
<?php
error_reporting(E_ALL);
function foo() {
echo $undef;
error_reporting(E_ALL|E_STRICT);
}
foo(@$var);
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef in %s on line %d
int(4095)
Done
-34
View File
@@ -1,34 +0,0 @@
--TEST--
testing @ and error_reporting - 5
--FILE--
<?php
error_reporting(E_ALL);
class test {
function __get($name) {
return $undef_name;
}
function __set($name, $value) {
return $undef_value;
}
}
$test = new test;
$test->abc = 123;
echo $test->bcd;
@$test->qwe = 123;
echo @$test->wer;
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef_value in %s on line %d
Notice: Undefined variable: undef_name in %s on line %d
int(2047)
Done
-30
View File
@@ -1,30 +0,0 @@
--TEST--
testing @ and error_reporting - 6
--FILE--
<?php
error_reporting(E_ALL);
function foo1($arg) {
}
function foo2($arg) {
}
function foo3($arg) {
echo $undef3;
throw new Exception("test");
}
try {
@foo1(@foo2(@foo3()));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(2047)
Done
-30
View File
@@ -1,30 +0,0 @@
--TEST--
testing @ and error_reporting - 7
--FILE--
<?php
error_reporting(E_ALL);
function foo1($arg) {
}
function foo2($arg) {
}
function foo3($arg) {
echo $undef3;
throw new Exception("test");
}
try {
@error_reporting(@foo1(@foo2(@foo3())));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(2047)
Done
-32
View File
@@ -1,32 +0,0 @@
--TEST--
testing @ and error_reporting - 8
--FILE--
<?php
error_reporting(E_ALL);
function foo1($arg) {
}
function foo2($arg) {
}
function foo3($arg) {
error_reporting(E_ALL|E_STRICT);
echo $undef3;
throw new Exception("test");
}
try {
@foo1(@foo2(@foo3()));
} catch (Exception $e) {
}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: undef3 in %s on line %d
int(4095)
Done
-31
View File
@@ -1,31 +0,0 @@
--TEST--
testing @ and error_reporting - 9
--FILE--
<?php
error_reporting(E_ALL);
function bar() {
echo @$blah;
echo $undef2;
}
function foo() {
echo @$undef;
error_reporting(E_ALL|E_STRICT);
echo $blah;
return bar();
}
@foo();
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
Notice: Undefined variable: blah in %s on line %d
Notice: Undefined variable: undef2 in %s on line %d
int(4095)
Done
-35
View File
@@ -1,35 +0,0 @@
--TEST--
testing @ and error_reporting - 10
--FILE--
<?php
error_reporting(E_ALL);
function make_exception()
{
@$blah;
str_replace();
error_reporting(0);
throw new Exception();
}
try {
@make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
error_reporting(E_ALL&~E_NOTICE);
try {
@make_exception();
} catch (Exception $e) {}
var_dump(error_reporting());
echo "Done\n";
?>
--EXPECTF--
int(2047)
int(2039)
Done
-18
View File
@@ -1,18 +0,0 @@
--TEST--
instanceof shouldn't call __autoload
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
class A {
}
$a = new A;
var_dump($a instanceof B);
var_dump($a instanceof A);
?>
--EXPECT--
bool(false)
bool(true)
-51
View File
@@ -1,51 +0,0 @@
--TEST--
is_a() and is_subclass_of() shouldn't call __autoload
--INI--
error_reporting=4095
--FILE--
<?php
function __autoload($name) {
echo("AUTOLOAD '$name'\n");
eval("class $name {}");
}
class BASE {
}
interface INT {
}
class A extends BASE implements INT {
}
$a = new A;
var_dump(is_a($a, "B1"));
var_dump(is_a($a, "A"));
var_dump(is_a($a, "BASE"));
var_dump(is_a($a, "INT"));
var_dump(is_subclass_of($a, "B2"));
var_dump(is_subclass_of($a, "A"));
var_dump(is_subclass_of($a, "BASE"));
var_dump(is_subclass_of($a, "INT"));
var_dump(is_subclass_of("X1", "X2"));
?>
--EXPECTF--
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 17
bool(false)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 18
bool(true)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 19
bool(true)
Strict Standards: is_a(): Deprecated. Please use the instanceof operator in %sis_a.php on line 20
bool(true)
bool(false)
bool(false)
bool(true)
bool(false)
AUTOLOAD 'X1'
AUTOLOAD 'X2'
bool(false)
-11
View File
@@ -1,11 +0,0 @@
--TEST--
unset() CV 12 (unset() in indirect called function)
--FILE--
<?php
$x = 1;
function foo() {unset($GLOBALS["x"]);}
call_user_func("foo");
echo "ok\n";
?>
--EXPECT--
ok
+6 -18
View File
@@ -38,7 +38,6 @@
# define GLOBAL_FUNCTION_TABLE CG(function_table)
# define GLOBAL_CLASS_TABLE CG(class_table)
# define GLOBAL_AUTO_GLOBALS_TABLE CG(auto_globals)
# define GLOBAL_CONSTANTS_TABLE EG(zend_constants)
#endif
#if defined(ZEND_WIN32) && ZEND_DEBUG
@@ -78,9 +77,6 @@ static ZEND_INI_MH(OnUpdateErrorReporting)
ZEND_INI_BEGIN()
ZEND_INI_ENTRY("error_reporting", NULL, ZEND_INI_ALL, OnUpdateErrorReporting)
STD_ZEND_INI_BOOLEAN("zend.ze1_compatibility_mode", "0", ZEND_INI_ALL, OnUpdateBool, ze1_compatibility_mode, zend_executor_globals, executor_globals)
#ifdef ZEND_MULTIBYTE
STD_ZEND_INI_BOOLEAN("detect_unicode", "1", ZEND_INI_ALL, OnUpdateBool, detect_unicode, zend_compiler_globals, compiler_globals)
#endif
ZEND_INI_END()
@@ -92,7 +88,6 @@ HashTable *global_function_table;
HashTable *global_class_table;
HashTable *global_constants_table;
HashTable *global_auto_globals_table;
static HashTable *global_persistent_list = NULL;
#endif
ZEND_API zend_utility_values zend_uv;
@@ -132,7 +127,7 @@ static void print_hash(HashTable *ht, int indent, zend_bool is_object TSRMLS_DC)
if (is_object) {
char *prop_name, *class_name;
zend_unmangle_property_name_ex(string_key, str_len, &class_name, &prop_name);
zend_unmangle_property_name(string_key, &class_name, &prop_name);
ZEND_PUTS(prop_name);
if (class_name) {
if (class_name[0]=='*') {
@@ -491,13 +486,6 @@ static void executor_globals_ctor(zend_executor_globals *executor_globals TSRMLS
static void executor_globals_dtor(zend_executor_globals *executor_globals TSRMLS_DC)
{
zend_ini_shutdown(TSRMLS_C);
if (&executor_globals->persistent_list != global_persistent_list) {
zend_destroy_rsrc_list(&executor_globals->persistent_list TSRMLS_CC);
}
if (executor_globals->zend_constants != GLOBAL_CONSTANTS_TABLE) {
zend_hash_destroy(executor_globals->zend_constants);
free(executor_globals->zend_constants);
}
}
@@ -694,7 +682,6 @@ void zend_post_startup(TSRMLS_D)
compiler_globals_ctor(compiler_globals, tsrm_ls);
free(EG(zend_constants));
executor_globals_ctor(executor_globals, tsrm_ls);
global_persistent_list = &EG(persistent_list);
zend_new_thread_end_handler(tsrm_thread_id() TSRMLS_CC);
}
#endif
@@ -705,7 +692,9 @@ void zend_shutdown(TSRMLS_D)
#ifdef ZEND_WIN32
zend_shutdown_timeout_thread();
#endif
#ifndef ZTS
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
#endif
zend_hash_graceful_reverse_destroy(&module_registry);
zend_hash_destroy(GLOBAL_FUNCTION_TABLE);
@@ -717,17 +706,16 @@ void zend_shutdown(TSRMLS_D)
zend_shutdown_extensions(TSRMLS_C);
free(zend_version_info);
zend_shutdown_constants(TSRMLS_C);
free(GLOBAL_FUNCTION_TABLE);
free(GLOBAL_CLASS_TABLE);
#ifdef ZTS
zend_destroy_rsrc_list(&EG(persistent_list) TSRMLS_CC);
zend_hash_destroy(GLOBAL_CONSTANTS_TABLE);
free(GLOBAL_CONSTANTS_TABLE);
#ifdef ZTS
GLOBAL_FUNCTION_TABLE = NULL;
GLOBAL_CLASS_TABLE = NULL;
GLOBAL_AUTO_GLOBALS_TABLE = NULL;
GLOBAL_CONSTANTS_TABLE = NULL;
#endif
zend_destroy_rsrc_list_dtors();
}
+4 -10
View File
@@ -265,18 +265,13 @@ void zend_error_noreturn(int type, const char *format, ...) __attribute__ ((nore
typedef struct _zval_struct zval;
typedef struct _zend_class_entry zend_class_entry;
typedef struct _zend_guard {
zend_bool in_get;
zend_bool in_set;
zend_bool in_unset;
zend_bool in_isset;
zend_bool dummy; /* sizeof(zend_guard) must not be equal to sizeof(void*) */
} zend_guard;
typedef struct _zend_object {
zend_class_entry *ce;
HashTable *properties;
HashTable *guards; /* protects from __get/__set ... recursion */
unsigned int in_get:1;
unsigned int in_set:1;
unsigned int in_unset:1;
unsigned int in_isset:1;
} zend_object;
typedef unsigned int zend_object_handle;
@@ -336,7 +331,6 @@ struct _zend_class_entry {
HashTable function_table;
HashTable default_properties;
HashTable properties_info;
HashTable default_static_members;
HashTable *static_members;
HashTable constants_table;
struct _zend_function_entry *builtin_functions;
+105 -367
View File
@@ -296,7 +296,7 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
double d;
int type;
if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, -1)) == 0) {
if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), p, &d, 0)) == 0) {
return "long";
} else if (type == IS_DOUBLE) {
*p = (long) d;
@@ -330,7 +330,7 @@ static char *zend_parse_arg_impl(zval **arg, va_list *va, char **spec TSRMLS_DC)
long l;
int type;
if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, -1)) == 0) {
if ((type = is_numeric_string(Z_STRVAL_PP(arg), Z_STRLEN_PP(arg), &l, p, 0)) == 0) {
return "double";
} else if (type == IS_LONG) {
*p = (double) l;
@@ -723,13 +723,11 @@ static int zend_merge_property(zval **value, int num_args, va_list args, zend_ha
if (hash_key->nKeyLength) {
zval *obj = va_arg(args, zval *);
zend_object_handlers *obj_ht = va_arg(args, zend_object_handlers *);
zval *member;
zval member;
TSRMLS_FETCH();
MAKE_STD_ZVAL(member);
ZVAL_STRINGL(member, hash_key->arKey, hash_key->nKeyLength-1, 1);
obj_ht->write_property(obj, member, *value TSRMLS_CC);
zval_ptr_dtor(&member);
ZVAL_STRINGL(&member, hash_key->arKey, hash_key->nKeyLength-1, 0);
obj_ht->write_property(obj, &member, *value TSRMLS_CC);
}
return ZEND_HASH_APPLY_KEEP;
}
@@ -755,53 +753,13 @@ ZEND_API void zend_merge_properties(zval *obj, HashTable *properties, int destro
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC)
{
if (!class_type->constants_updated || !class_type->static_members) {
if (!class_type->constants_updated) {
zend_class_entry **scope = EG(in_execution)?&EG(scope):&CG(active_class_entry);
zend_class_entry *old_scope = *scope;
*scope = class_type;
zend_hash_apply_with_argument(&class_type->default_properties, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
if (!class_type->static_members) {
HashPosition pos;
zval **p;
if (class_type->parent) {
zend_update_class_constants(class_type->parent TSRMLS_CC);
}
ALLOC_HASHTABLE(class_type->static_members);
zend_hash_init(class_type->static_members, 0, NULL, ZVAL_PTR_DTOR, 0);
zend_hash_internal_pointer_reset_ex(&class_type->default_static_members, &pos);
while (zend_hash_get_current_data_ex(&class_type->default_static_members, (void**)&p, &pos) == SUCCESS) {
char *str_index;
uint str_length;
ulong num_index;
zval **q;
zend_hash_get_current_key_ex(&class_type->default_static_members, &str_index, &str_length, &num_index, 0, &pos);
if ((*p)->is_ref &&
class_type->parent &&
zend_hash_find(&class_type->parent->default_static_members, str_index, str_length, (void**)&q) == SUCCESS &&
*p == *q &&
zend_hash_find(class_type->parent->static_members, str_index, str_length, (void**)&q) == SUCCESS) {
(*q)->refcount++;
(*q)->is_ref = 1;
zend_hash_add(class_type->static_members, str_index, str_length, (void**)q, sizeof(zval*), NULL);
} else {
zval *q;
ALLOC_ZVAL(q);
*q = **p;
INIT_PZVAL(q);
zval_copy_ctor(q);
zend_hash_add(class_type->static_members, str_index, str_length, (void**)&q, sizeof(zval*), NULL);
}
zend_hash_move_forward_ex(&class_type->default_static_members, &pos);
}
}
zend_hash_apply_with_argument(class_type->static_members, (apply_func_arg_t) zval_update_constant, (void *) 1 TSRMLS_CC);
*scope = old_scope;
class_type->constants_updated = 1;
}
@@ -937,7 +895,7 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value)
}
ZEND_API int add_index_long(zval *arg, ulong index, long n)
ZEND_API int add_index_long(zval *arg, uint index, long n)
{
zval *tmp;
@@ -948,7 +906,7 @@ ZEND_API int add_index_long(zval *arg, ulong index, long n)
}
ZEND_API int add_index_null(zval *arg, ulong index)
ZEND_API int add_index_null(zval *arg, uint index)
{
zval *tmp;
@@ -958,7 +916,7 @@ ZEND_API int add_index_null(zval *arg, ulong index)
return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL);
}
ZEND_API int add_index_bool(zval *arg, ulong index, int b)
ZEND_API int add_index_bool(zval *arg, uint index, int b)
{
zval *tmp;
@@ -969,7 +927,7 @@ ZEND_API int add_index_bool(zval *arg, ulong index, int b)
}
ZEND_API int add_index_resource(zval *arg, ulong index, int r)
ZEND_API int add_index_resource(zval *arg, uint index, int r)
{
zval *tmp;
@@ -980,7 +938,7 @@ ZEND_API int add_index_resource(zval *arg, ulong index, int r)
}
ZEND_API int add_index_double(zval *arg, ulong index, double d)
ZEND_API int add_index_double(zval *arg, uint index, double d)
{
zval *tmp;
@@ -991,7 +949,7 @@ ZEND_API int add_index_double(zval *arg, ulong index, double d)
}
ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate)
ZEND_API int add_index_string(zval *arg, uint index, char *str, int duplicate)
{
zval *tmp;
@@ -1002,7 +960,7 @@ ZEND_API int add_index_string(zval *arg, ulong index, char *str, int duplicate)
}
ZEND_API int add_index_stringl(zval *arg, ulong index, char *str, uint length, int duplicate)
ZEND_API int add_index_stringl(zval *arg, uint index, char *str, uint length, int duplicate)
{
zval *tmp;
@@ -1013,7 +971,7 @@ ZEND_API int add_index_stringl(zval *arg, ulong index, char *str, uint length, i
}
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value)
ZEND_API int add_index_zval(zval *arg, uint index, zval *value)
{
return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &value, sizeof(zval *), NULL);
}
@@ -1124,7 +1082,7 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *
}
ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest)
ZEND_API int add_get_index_long(zval *arg, uint index, long l, void **dest)
{
zval *tmp;
@@ -1135,7 +1093,7 @@ ZEND_API int add_get_index_long(zval *arg, ulong index, long l, void **dest)
}
ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest)
ZEND_API int add_get_index_double(zval *arg, uint index, double d, void **dest)
{
zval *tmp;
@@ -1146,7 +1104,7 @@ ZEND_API int add_get_index_double(zval *arg, ulong index, double d, void **dest)
}
ZEND_API int add_get_index_string(zval *arg, ulong index, char *str, void **dest, int duplicate)
ZEND_API int add_get_index_string(zval *arg, uint index, char *str, void **dest, int duplicate)
{
zval *tmp;
@@ -1157,7 +1115,7 @@ ZEND_API int add_get_index_string(zval *arg, ulong index, char *str, void **dest
}
ZEND_API int add_get_index_stringl(zval *arg, ulong index, char *str, uint length, void **dest, int duplicate)
ZEND_API int add_get_index_stringl(zval *arg, uint index, char *str, uint length, void **dest, int duplicate)
{
zval *tmp;
@@ -1171,68 +1129,58 @@ ZEND_API int add_get_index_stringl(zval *arg, ulong index, char *str, uint lengt
ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC)
{
zval *tmp;
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(tmp);
ZVAL_LONG(tmp, n);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
ZEND_API int add_property_bool_ex(zval *arg, char *key, uint key_len, int b TSRMLS_DC)
{
zval *tmp;
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(tmp);
ZVAL_BOOL(tmp, b);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC)
{
zval *tmp;
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(tmp);
ZVAL_NULL(tmp);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n TSRMLS_DC)
{
zval *tmp;
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(tmp);
ZVAL_RESOURCE(tmp, n);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
@@ -1240,17 +1188,14 @@ ZEND_API int add_property_resource_ex(zval *arg, char *key, uint key_len, long n
ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d TSRMLS_DC)
{
zval *tmp;
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(tmp);
ZVAL_DOUBLE(tmp, d);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
@@ -1258,46 +1203,40 @@ ZEND_API int add_property_double_ex(zval *arg, char *key, uint key_len, double d
ZEND_API int add_property_string_ex(zval *arg, char *key, uint key_len, char *str, int duplicate TSRMLS_DC)
{
zval *tmp;
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(tmp);
ZVAL_STRING(tmp, str, duplicate);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
ZEND_API int add_property_stringl_ex(zval *arg, char *key, uint key_len, char *str, uint length, int duplicate TSRMLS_DC)
{
zval *tmp;
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(tmp);
ZVAL_STRINGL(tmp, str, length, duplicate);
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp TSRMLS_CC);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, tmp TSRMLS_CC);
zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */
zval_ptr_dtor(&z_key);
return SUCCESS;
}
ZEND_API int add_property_zval_ex(zval *arg, char *key, uint key_len, zval *value TSRMLS_DC)
{
zval *z_key;
zval z_key;
MAKE_STD_ZVAL(z_key);
ZVAL_STRINGL(z_key, key, key_len-1, 1);
ZVAL_STRINGL(&z_key, key, key_len-1, 0);
Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, value TSRMLS_CC);
zval_ptr_dtor(&z_key);
Z_OBJ_HANDLER_P(arg, write_property)(arg, &z_key, value TSRMLS_CC);
return SUCCESS;
}
@@ -1555,14 +1494,10 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
}
} else {
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
efree(lc_class_name);
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
return FAILURE;
}
if (!internal_function->handler) {
if (scope) {
efree(lc_class_name);
}
zend_error(error_type, "Method %s%s%s() cannot be a NULL function", scope ? scope->name : "", scope ? "::" : "", ptr->fname);
zend_unregister_functions(functions, count, target_function_table TSRMLS_CC);
return FAILURE;
@@ -1970,29 +1905,23 @@ ZEND_API int zend_disable_class(char *class_name, uint class_name_length TSRMLS_
return 1;
}
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC)
{
char *lcname, *lmname, *colon;
char *lcname;
zend_bool retval = 0;
int callable_name_len_local, clen, mlen;
zend_class_entry *ce_local, **pce;
int callable_name_len_local;
zend_function *fptr_local;
zval **zobj_ptr_local;
HashTable *ftable;
if (callable_name_len == NULL) {
callable_name_len = &callable_name_len_local;
}
if (ce_ptr == NULL) {
ce_ptr = &ce_local;
}
if (fptr_ptr == NULL) {
fptr_ptr = &fptr_local;
}
if (zobj_ptr_ptr == NULL) {
zobj_ptr_ptr = &zobj_ptr_local;
}
*ce_ptr = NULL;
*fptr_ptr = NULL;
*zobj_ptr_ptr = NULL;
@@ -2005,41 +1934,19 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
return 1;
}
if ((colon = strstr(Z_STRVAL_P(callable), "::")) != NULL) {
clen = colon - Z_STRVAL_P(callable);
mlen = Z_STRLEN_P(callable) - clen - 2;
lcname = estrndup(Z_STRVAL_P(callable), clen);
lcname[clen] = '\0';
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable) + clen + 2, mlen);
if (zend_lookup_class(lcname, clen, &pce TSRMLS_CC) == FAILURE) {
efree(lcname);
efree(lmname);
return 0;
}
efree(lcname);
*ce_ptr = *pce;
ftable = &(*ce_ptr)->function_table;
} else {
mlen = Z_STRLEN_P(callable);
lmname = zend_str_tolower_dup(Z_STRVAL_P(callable), mlen);
ftable = EG(function_table);
}
if (zend_hash_find(ftable, lmname, mlen+1, (void**)fptr_ptr) == SUCCESS) {
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
if (zend_hash_find(EG(function_table), lcname, Z_STRLEN_P(callable)+1, (void**)fptr_ptr) == SUCCESS) {
retval = 1;
}
if (*ce_ptr && *fptr_ptr && !((*fptr_ptr)->common.fn_flags & ZEND_ACC_STATIC)) {
retval = 0;
}
efree(lmname);
efree(lcname);
break;
case IS_ARRAY:
{
zend_class_entry *ce = NULL;
zval **method;
zval **obj;
zend_class_entry *ce = NULL, **pce;
if (zend_hash_num_elements(Z_ARRVAL_P(callable)) == 2 &&
zend_hash_index_find(Z_ARRVAL_P(callable), 0, (void **) &obj) == SUCCESS &&
@@ -2058,24 +1965,22 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
memcpy(ptr, "::", sizeof("::") - 1);
ptr += sizeof("::") - 1;
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
}
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
*ce_ptr = ce;
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
return 1;
}
if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
if (EG(active_op_array) && strcmp(lcname, "self") == 0) {
ce = EG(active_op_array)->scope;
} else if (strcmp(lcname, "parent") == 0 && EG(active_op_array) && EG(active_op_array)->scope) {
ce = EG(active_op_array)->scope->parent;
} else if (zend_lookup_class(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj), &pce TSRMLS_CC) == SUCCESS) {
ce = *pce;
} else if (EG(active_op_array)) {
lcname = zend_str_tolower_dup(Z_STRVAL_PP(obj), Z_STRLEN_PP(obj));
if (Z_STRLEN_PP(obj) == sizeof("self") - 1 && memcmp(lcname, "self", sizeof("self")) == 0) {
ce = EG(active_op_array)->scope;
} else if (Z_STRLEN_PP(obj) == sizeof("parent") - 1 && memcmp(lcname, "parent", sizeof("parent")) == 0 && EG(active_op_array)->scope) {
ce = EG(active_op_array)->scope->parent;
}
efree(lcname);
}
efree(lcname);
} else {
ce = Z_OBJCE_PP(obj); /* TBFixed: what if it's overloaded? */
@@ -2093,10 +1998,8 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
memcpy(ptr, Z_STRVAL_PP(method), Z_STRLEN_PP(method) + 1);
}
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY) {
*ce_ptr = ce;
if (check_flags & IS_CALLABLE_CHECK_SYNTAX_ONLY)
return 1;
}
}
if (ce) {
@@ -2116,12 +2019,17 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
}
}
}
*fptr_ptr = fbc;
if (retval) {
if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0 && (fbc->common.fn_flags & ZEND_ACC_STATIC) == 0) {
retval = 0;
} else {
*fptr_ptr = fbc;
}
}
}
/* check for __call too */
if (retval == 0 && *zobj_ptr_ptr && ce->__call != 0) {
if (retval == 0 && ce->__call != 0) {
retval = 1;
*fptr_ptr = ce->__call;
}
efree(lcname);
}
@@ -2129,10 +2037,6 @@ ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **
*callable_name = estrndup("Array", sizeof("Array")-1);
*callable_name_len = sizeof("Array") - 1;
}
if ((check_flags & IS_CALLABLE_CHECK_IS_STATIC) != 0 && !*zobj_ptr_ptr && (!*fptr_ptr || !((*fptr_ptr)->common.fn_flags & ZEND_ACC_STATIC))) {
retval = 0;
}
*ce_ptr = ce;
}
break;
@@ -2157,26 +2061,42 @@ ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **cal
{
TSRMLS_FETCH();
return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL, NULL TSRMLS_CC);
return zend_is_callable_ex(callable, check_flags, callable_name, NULL, NULL, NULL TSRMLS_CC);
}
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC)
{
zend_class_entry *ce;
zend_function *fptr;
zval **zobj_ptr;
char *lcname, *func, *class_name;
zend_bool retval = 0;
zend_class_entry **pce;
int class_name_len;
if (zend_is_callable_ex(callable, 0, callable_name, NULL, &ce, &fptr, &zobj_ptr TSRMLS_CC)) {
if (Z_TYPE_P(callable) == IS_STRING && ce) {
zval_dtor(callable);
array_init(callable);
add_next_index_string(callable, ce->name, 1);
add_next_index_string(callable, fptr->common.function_name, 1);
}
if (zend_is_callable_ex(callable, 0, callable_name, NULL, NULL, NULL TSRMLS_CC)) {
return 1;
}
return 0;
switch (Z_TYPE_P(callable)) {
case IS_STRING:
lcname = zend_str_tolower_dup(Z_STRVAL_P(callable), Z_STRLEN_P(callable));
if ((func = strstr(lcname, "::")) != NULL) {
*func = '\0';
class_name_len = func - lcname;
class_name = estrndup(Z_STRVAL_P(callable), class_name_len);
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC) == SUCCESS) {
zval_dtor(callable);
array_init(callable);
add_next_index_stringl(callable, lcname, class_name_len, 1);
func += 2;
add_next_index_stringl(callable, func, strlen(func), 1);
retval = 1;
}
efree(class_name);
}
efree(lcname);
break;
}
return retval;
}
@@ -2206,7 +2126,7 @@ ZEND_API int zend_declare_property_ex(zend_class_entry *ce, char *name, int name
access_type |= ZEND_ACC_PUBLIC;
}
if (access_type & ZEND_ACC_STATIC) {
target_symbol_table = &ce->default_static_members;
target_symbol_table = ce->static_members;
} else {
target_symbol_table = &ce->default_properties;
}
@@ -2354,76 +2274,9 @@ ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int
return zend_declare_property(ce, name, name_length, property, access_type TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC)
{
return zend_hash_update(&ce->constants_table, name, name_length+1, &value, sizeof(zval *), NULL);
}
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
} else {
ALLOC_ZVAL(constant);
}
ZVAL_LONG(constant, value);
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
} else {
ALLOC_ZVAL(constant);
}
ZVAL_BOOL(constant, value);
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
} else {
ALLOC_ZVAL(constant);
}
ZVAL_DOUBLE(constant, value);
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC)
{
zval *constant;
if (ce->type & ZEND_INTERNAL_CLASS) {
constant = malloc(sizeof(zval));
ZVAL_STRINGL(constant, zend_strndup(value, value_length), value_length, 0);
} else {
ALLOC_ZVAL(constant);
ZVAL_STRINGL(constant, value, value_length, 1);
}
INIT_PZVAL(constant);
return zend_declare_class_constant(ce, name, name_length, constant TSRMLS_CC);
}
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC)
{
return zend_declare_class_constant_stringl(ce, name, name_length, value, strlen(value) TSRMLS_CC);
}
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC)
{
zval *property;
zval property;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
@@ -2436,10 +2289,8 @@ ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, class_name);
}
MAKE_STD_ZVAL(property);
ZVAL_STRINGL(property, name, name_length, 1);
Z_OBJ_HT_P(object)->write_property(object, property, value TSRMLS_CC);
zval_ptr_dtor(&property);
ZVAL_STRINGL(&property, name, name_length, 0);
Z_OBJ_HT_P(object)->write_property(object, &property, value TSRMLS_CC);
EG(scope) = old_scope;
}
@@ -2510,109 +2361,9 @@ ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object
zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC)
{
zval **property;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
property = zend_std_get_static_property(scope, name, name_length, 0 TSRMLS_CC);
EG(scope) = old_scope;
if (!property) {
return FAILURE;
} else {
if (*property != value) {
if (PZVAL_IS_REF(*property)) {
zval_dtor(*property);
(*property)->type = value->type;
(*property)->value = value->value;
if (value->refcount > 0) {
zval_copy_ctor(*property);
}
} else {
zval *garbage = *property;
value->refcount++;
if (PZVAL_IS_REF(value)) {
SEPARATE_ZVAL(&value);
}
*property = value;
zval_ptr_dtor(&garbage);
}
}
return SUCCESS;
}
}
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_NULL(tmp);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_BOOL(tmp, value);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_LONG(tmp, value);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_DOUBLE(tmp, value);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_STRING(tmp, value, 1);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_len TSRMLS_DC)
{
zval *tmp;
ALLOC_ZVAL(tmp);
tmp->is_ref = 0;
tmp->refcount = 0;
ZVAL_STRINGL(tmp, value, value_len, 1);
return zend_update_static_property(scope, name, name_length, tmp TSRMLS_CC);
}
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC)
{
zval *property, *value;
zval property, *value;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
@@ -2624,26 +2375,13 @@ ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *n
zend_get_object_classname(object, &class_name, &class_name_len TSRMLS_CC);
zend_error(E_CORE_ERROR, "Property %s of class %s cannot be read", name, class_name);
}
MAKE_STD_ZVAL(property);
ZVAL_STRINGL(property, name, name_length, 1);
value = Z_OBJ_HT_P(object)->read_property(object, property, silent TSRMLS_CC);
zval_ptr_dtor(&property);
ZVAL_STRINGL(&property, name, name_length, 0);
value = Z_OBJ_HT_P(object)->read_property(object, &property, silent TSRMLS_CC);
EG(scope) = old_scope;
return value;
}
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC)
{
zval **property;
zend_class_entry *old_scope = EG(scope);
EG(scope) = scope;
property = zend_std_get_static_property(scope, name, name_length, silent TSRMLS_CC);
EG(scope) = old_scope;
return property?*property:NULL;
}
/*
* Local variables:
* tab-width: 4
+13 -30
View File
@@ -198,7 +198,7 @@ ZEND_API void zend_wrong_param_count(TSRMLS_D);
#define IS_CALLABLE_CHECK_NO_ACCESS (1<<1)
#define IS_CALLABLE_CHECK_IS_STATIC (1<<2)
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_class_entry **ce_ptr, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
ZEND_API zend_bool zend_is_callable_ex(zval *callable, uint check_flags, char **callable_name, int *callable_name_len, zend_function **fptr_ptr, zval ***zobj_ptr_ptr TSRMLS_DC);
ZEND_API zend_bool zend_is_callable(zval *callable, uint check_flags, char **callable_name);
ZEND_API zend_bool zend_make_callable(zval *callable, char **callable_name TSRMLS_DC);
ZEND_API char *zend_get_module_version(char *module_name);
@@ -212,13 +212,6 @@ ZEND_API int zend_declare_property_double(zend_class_entry *ce, char *name, int
ZEND_API int zend_declare_property_string(zend_class_entry *ce, char *name, int name_length, char *value, int access_type TSRMLS_DC);
ZEND_API int zend_declare_property_stringl(zend_class_entry *ce, char *name, int name_length, char *value, int value_len, int access_type TSRMLS_DC);
ZEND_API int zend_declare_class_constant(zend_class_entry *ce, char *name, size_t name_length, zval *value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_long(zend_class_entry *ce, char *name, size_t name_length, long value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_bool(zend_class_entry *ce, char *name, size_t name_length, zend_bool value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_double(zend_class_entry *ce, char *name, size_t name_length, double value TSRMLS_DC);
ZEND_API int zend_declare_class_constant_stringl(zend_class_entry *ce, char *name, size_t name_length, char *value, size_t value_length TSRMLS_DC);
ZEND_API int zend_declare_class_constant_string(zend_class_entry *ce, char *name, size_t name_length, char *value TSRMLS_DC);
ZEND_API void zend_update_class_constants(zend_class_entry *class_type TSRMLS_DC);
ZEND_API void zend_update_property(zend_class_entry *scope, zval *object, char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API void zend_update_property_null(zend_class_entry *scope, zval *object, char *name, int name_length TSRMLS_DC);
@@ -228,18 +221,8 @@ ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object,
ZEND_API void zend_update_property_string(zend_class_entry *scope, zval *object, char *name, int name_length, char *value TSRMLS_DC);
ZEND_API void zend_update_property_stringl(zend_class_entry *scope, zval *object, char *name, int name_length, char *value, int value_length TSRMLS_DC);
ZEND_API int zend_update_static_property(zend_class_entry *scope, char *name, int name_length, zval *value TSRMLS_DC);
ZEND_API int zend_update_static_property_null(zend_class_entry *scope, char *name, int name_length TSRMLS_DC);
ZEND_API int zend_update_static_property_bool(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
ZEND_API int zend_update_static_property_long(zend_class_entry *scope, char *name, int name_length, long value TSRMLS_DC);
ZEND_API int zend_update_static_property_double(zend_class_entry *scope, char *name, int name_length, double value TSRMLS_DC);
ZEND_API int zend_update_static_property_string(zend_class_entry *scope, char *name, int name_length, char *value TSRMLS_DC);
ZEND_API int zend_update_static_property_stringl(zend_class_entry *scope, char *name, int name_length, char *value, int value_length TSRMLS_DC);
ZEND_API zval *zend_read_property(zend_class_entry *scope, zval *object, char *name, int name_length, zend_bool silent TSRMLS_DC);
ZEND_API zval *zend_read_static_property(zend_class_entry *scope, char *name, int name_length, zend_bool silent TSRMLS_DC);
ZEND_API zend_class_entry *zend_get_class_entry(zval *zobject TSRMLS_DC);
ZEND_API int zend_get_object_classname(zval *object, char **class_name, zend_uint *class_name_len TSRMLS_DC);
@@ -294,14 +277,14 @@ ZEND_API int add_assoc_zval_ex(zval *arg, char *key, uint key_len, zval *value);
#define add_next_index_unset(__arg) add_next_index_null(__arg)
#define add_property_unset(__arg, __key) add_property_null(__arg, __key)
ZEND_API int add_index_long(zval *arg, ulong idx, long n);
ZEND_API int add_index_null(zval *arg, ulong idx);
ZEND_API int add_index_bool(zval *arg, ulong idx, int b);
ZEND_API int add_index_resource(zval *arg, ulong idx, int r);
ZEND_API int add_index_double(zval *arg, ulong idx, double d);
ZEND_API int add_index_string(zval *arg, ulong idx, char *str, int duplicate);
ZEND_API int add_index_stringl(zval *arg, ulong idx, char *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, ulong index, zval *value);
ZEND_API int add_index_long(zval *arg, uint idx, long n);
ZEND_API int add_index_null(zval *arg, uint idx);
ZEND_API int add_index_bool(zval *arg, uint idx, int b);
ZEND_API int add_index_resource(zval *arg, uint idx, int r);
ZEND_API int add_index_double(zval *arg, uint idx, double d);
ZEND_API int add_index_string(zval *arg, uint idx, char *str, int duplicate);
ZEND_API int add_index_stringl(zval *arg, uint idx, char *str, uint length, int duplicate);
ZEND_API int add_index_zval(zval *arg, uint index, zval *value);
ZEND_API int add_next_index_long(zval *arg, long n);
ZEND_API int add_next_index_null(zval *arg);
@@ -318,10 +301,10 @@ ZEND_API int add_get_assoc_stringl_ex(zval *arg, char *key, uint key_len, char *
#define add_get_assoc_string(__arg, __key, __str, __dest, __duplicate) add_get_assoc_string_ex(__arg, __key, strlen(__key)+1, __str, __dest, __duplicate)
#define add_get_assoc_stringl(__arg, __key, __str, __length, __dest, __duplicate) add_get_assoc_stringl_ex(__arg, __key, strlen(__key)+1, __str, __length, __dest, __duplicate)
ZEND_API int add_get_index_long(zval *arg, ulong idx, long l, void **dest);
ZEND_API int add_get_index_double(zval *arg, ulong idx, double d, void **dest);
ZEND_API int add_get_index_string(zval *arg, ulong idx, char *str, void **dest, int duplicate);
ZEND_API int add_get_index_stringl(zval *arg, ulong idx, char *str, uint length, void **dest, int duplicate);
ZEND_API int add_get_index_long(zval *arg, uint idx, long l, void **dest);
ZEND_API int add_get_index_double(zval *arg, uint idx, double d, void **dest);
ZEND_API int add_get_index_string(zval *arg, uint idx, char *str, void **dest, int duplicate);
ZEND_API int add_get_index_stringl(zval *arg, uint idx, char *str, uint length, void **dest, int duplicate);
ZEND_API int add_property_long_ex(zval *arg, char *key, uint key_len, long l TSRMLS_DC);
ZEND_API int add_property_null_ex(zval *arg, char *key, uint key_len TSRMLS_DC);
+1 -2
View File
@@ -75,8 +75,7 @@ static long mem_block_end_magic = MEM_BLOCK_END_MAGIC;
#define _CHECK_MEMORY_LIMIT(s, rs, file, lineno) { AG(allocated_memory) += rs;\
if (AG(memory_limit)<AG(allocated_memory)) {\
int php_mem_limit = AG(memory_limit); \
AG(allocated_memory) -= rs; \
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory)) { \
if (EG(in_execution) && AG(memory_limit)+1048576 > AG(allocated_memory) - rs) { \
AG(memory_limit) = AG(allocated_memory) + 1048576; \
if (file) { \
zend_error(E_ERROR,"Allowed memory size of %d bytes exhausted at %s:%d (tried to allocate %d bytes)", php_mem_limit, file, lineno, s); \
+5 -7
View File
@@ -229,7 +229,6 @@ ZEND_FUNCTION(func_get_arg)
arg = *(p-(arg_count-requested_offset));
*return_value = *arg;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
/* }}} */
@@ -625,7 +624,7 @@ static void is_a_impl(INTERNAL_FUNCTION_PARAMETERS, zend_bool only_subclass)
convert_to_string_ex(class_name);
if (zend_lookup_class_ex(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), (instance_ce != NULL), &ce TSRMLS_CC) == FAILURE) {
if (zend_lookup_class(Z_STRVAL_PP(class_name), Z_STRLEN_PP(class_name), &ce TSRMLS_CC) == FAILURE) {
retval = 0;
} else {
if (only_subclass) {
@@ -690,7 +689,7 @@ static void add_class_vars(zend_class_entry *ce, HashTable *properties, zval *re
zend_hash_get_current_key_ex(properties, &key, &key_len, &num_index, 0, &pos);
zend_hash_move_forward_ex(properties, &pos);
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
zend_unmangle_property_name(key, &class_name, &prop_name);
if (class_name) {
if (class_name[0] != '*' && strcmp(class_name, ce->name)) {
/* filter privates from base classes */
@@ -737,7 +736,6 @@ ZEND_FUNCTION(get_class_vars)
} else {
array_init(return_value);
add_class_vars(*pce, &(*pce)->default_properties, return_value TSRMLS_CC);
zend_update_class_constants(*pce TSRMLS_CC);
add_class_vars(*pce, (*pce)->static_members, return_value TSRMLS_CC);
}
}
@@ -782,7 +780,7 @@ ZEND_FUNCTION(get_object_vars)
(*value)->refcount++;
add_assoc_zval_ex(return_value, key, key_len, *value);
} else if (instanceof) {
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
zend_unmangle_property_name(key, &class_name, &prop_name);
if (!memcmp(class_name, "*", 2) || (Z_OBJCE_P(EG(This)) == Z_OBJCE_PP(obj) && !strcmp(Z_OBJCE_P(EG(This))->name, class_name))) {
/* Not separating references */
(*value)->refcount++;
@@ -931,7 +929,7 @@ ZEND_FUNCTION(property_exists)
if (property_info->flags & ZEND_ACC_PUBLIC) {
RETURN_TRUE;
}
zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name);
zend_unmangle_property_name(property_info->name, &class_name, &prop_name);
if (!strncmp(class_name, "*", 1)) {
if (instanceof_function(EG(scope), ce TSRMLS_CC)) {
RETURN_TRUE;
@@ -1848,7 +1846,7 @@ ZEND_API void zend_fetch_debug_backtrace(zval *return_value, int skip_last TSRML
ptr = EG(current_execute_data);
/* skip "new Exception()" */
if (ptr && (skip_last == 0) && ptr->opline && (ptr->opline->opcode == ZEND_NEW)) {
if ((skip_last == 0) && ptr->opline && (ptr->opline->opcode == ZEND_NEW)) {
ptr = ptr->prev_execute_data;
}
+44 -125
View File
@@ -465,9 +465,6 @@ void fetch_array_dim(znode *result, znode *parent, znode *dim TSRMLS_DC)
void fetch_string_offset(znode *result, znode *parent, znode *offset TSRMLS_DC)
{
#ifdef ilia_0
zend_error(E_STRICT, "Usage of {} to access string offsets is deprecated and will be removed in PHP 6");
#endif
fetch_array_dim(result, parent, offset TSRMLS_CC);
}
@@ -543,50 +540,30 @@ void zend_do_assign(znode *result, znode *variable, znode *value TSRMLS_DC)
int last_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
if (variable->op_type == IS_VAR) {
int n = 0;
if (last_op_number > 0) {
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
while (last_op_number - n > 0) {
zend_op *last_op;
last_op = &CG(active_op_array)->opcodes[last_op_number-(n+1)];
if (last_op->opcode == ZEND_FETCH_OBJ_W) {
last_op->opcode = ZEND_ASSIGN_OBJ;
if (last_op->result.op_type == IS_VAR &&
last_op->result.u.var == variable->u.var) {
if (last_op->opcode == ZEND_FETCH_OBJ_W) {
if (n > 0) {
*opline = *last_op;
MAKE_NOP(last_op);
last_op = opline;
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
}
last_op->opcode = ZEND_ASSIGN_OBJ;
zend_do_op_data(opline, value TSRMLS_CC);
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else if (last_op->opcode == ZEND_FETCH_DIM_W) {
if (n > 0) {
*opline = *last_op;
MAKE_NOP(last_op);
last_op = opline;
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
}
last_op->opcode = ZEND_ASSIGN_DIM;
zend_do_op_data(opline, value TSRMLS_CC);
opline->op2.u.var = get_temporary_variable(CG(active_op_array));
opline->op2.u.EA.type = 0;
opline->op2.op_type = IS_VAR;
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else if (opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
} else {
break;
}
zend_do_op_data(opline, value TSRMLS_CC);
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else if (last_op->opcode == ZEND_FETCH_DIM_W) {
last_op->opcode = ZEND_ASSIGN_DIM;
zend_do_op_data(opline, value TSRMLS_CC);
opline->op2.u.var = get_temporary_variable(CG(active_op_array));
opline->op2.u.EA.type = 0;
opline->op2.op_type = IS_VAR;
SET_UNUSED(opline->result);
*result = last_op->result;
return;
} else {
if (opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
}
n++;
}
}
@@ -614,8 +591,7 @@ void zend_do_assign_ref(znode *result, znode *lvar, znode *rvar TSRMLS_DC)
if (last_op_number > 0) {
zend_op *last_op = &CG(active_op_array)->opcodes[last_op_number-1];
if (lvar->op_type == IS_VAR &&
opline_is_fetch_this(last_op TSRMLS_CC)) {
if (opline_is_fetch_this(last_op TSRMLS_CC)) {
zend_error(E_COMPILE_ERROR, "Cannot re-assign $this");
}
}
@@ -1276,29 +1252,15 @@ void zend_do_receive_arg(zend_uchar op, znode *var, znode *offset, znode *initia
cur_arg_info->pass_by_reference = pass_by_reference;
if (class_type->op_type != IS_UNUSED) {
cur_arg_info->allow_null = 0;
if (class_type->u.constant.type == IS_STRING) {
cur_arg_info->class_name = class_type->u.constant.value.str.val;
cur_arg_info->class_name_len = class_type->u.constant.value.str.len;
if (op == ZEND_RECV_INIT) {
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
cur_arg_info->allow_null = 1;
} else {
zend_error(E_COMPILE_ERROR, "Default value for parameters with a class type hint can only be NULL");
}
}
} else {
cur_arg_info->array_type_hint = 1;
cur_arg_info->class_name = NULL;
cur_arg_info->class_name_len = 0;
if (op == ZEND_RECV_INIT) {
if (Z_TYPE(initialization->u.constant) == IS_NULL || (Z_TYPE(initialization->u.constant) == IS_CONSTANT && !strcasecmp(Z_STRVAL(initialization->u.constant), "NULL"))) {
cur_arg_info->allow_null = 1;
} else if (Z_TYPE(initialization->u.constant) != IS_ARRAY && Z_TYPE(initialization->u.constant) != IS_CONSTANT_ARRAY) {
zend_error(E_COMPILE_ERROR, "Default value for parameters with array type hint can only be an array or NULL");
}
}
}
cur_arg_info->allow_null = 0;
} else {
cur_arg_info->class_name = NULL;
cur_arg_info->class_name_len = 0;
@@ -1744,13 +1706,6 @@ void zend_do_begin_catch(znode *try_token, znode *catch_class, znode *catch_var,
long catch_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
if (catch_op_number > 0) {
opline = &CG(active_op_array)->opcodes[catch_op_number-1];
if (opline->opcode == ZEND_FETCH_CLASS) {
opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
}
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_CATCH;
opline->op1 = *catch_class;
@@ -2084,28 +2039,20 @@ static zend_bool do_inherit_property_access_check(HashTable *target_ht, zend_pro
zend_mangle_property_name(&prot_name, &prot_name_length, "*", 1, child_info->name, child_info->name_length, ce->type & ZEND_INTERNAL_CLASS);
if (child_info->flags & ZEND_ACC_STATIC) {
zval **prop;
HashTable *ht;
if (parent_ce->type != ce->type) {
/* User class extends internal class */
ht = parent_ce->static_members;
} else {
ht = &parent_ce->default_static_members;
}
if (zend_hash_find(ht, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {
if (zend_hash_find(parent_ce->static_members, prot_name, prot_name_length+1, (void**)&prop) == SUCCESS) {
zval **new_prop;
if (zend_hash_find(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
if (zend_hash_find(ce->static_members, child_info->name, child_info->name_length+1, (void**)&new_prop) == SUCCESS) {
if (Z_TYPE_PP(new_prop) != IS_NULL && Z_TYPE_PP(prop) != IS_NULL) {
char *prop_name, *tmp;
zend_unmangle_property_name_ex(child_info->name, child_info->name_length, &tmp, &prop_name);
zend_unmangle_property_name(child_info->name, &tmp, &prop_name);
zend_error(E_COMPILE_ERROR, "Cannot change initial value of property static protected %s::$%s in class %s",
parent_ce->name, prop_name, ce->name);
}
}
(*prop)->refcount++;
zend_hash_update(&ce->default_static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL);
zend_hash_del(&ce->default_static_members, prot_name, prot_name_length+1);
zend_hash_update(ce->static_members, child_info->name, child_info->name_length+1, (void**)prop, sizeof(zval*), NULL);
zend_hash_del(ce->static_members, prot_name, prot_name_length+1);
}
} else {
zend_hash_del(&ce->default_properties, prot_name, prot_name_length+1);
@@ -2191,13 +2138,7 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
/* Inherit properties */
zend_hash_merge(&ce->default_properties, &parent_ce->default_properties, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
if (parent_ce->type != ce->type) {
/* User class extends internal class */
zend_update_class_constants(parent_ce TSRMLS_CC);
zend_hash_merge(&ce->default_static_members, parent_ce->static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
} else {
zend_hash_merge(&ce->default_static_members, &parent_ce->default_static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
}
zend_hash_merge(ce->static_members, parent_ce->static_members, (void (*)(void *)) inherit_static_prop, NULL, sizeof(zval *), 0);
zend_hash_merge_ex(&ce->properties_info, &parent_ce->properties_info, (copy_ctor_func_t) (ce->type & ZEND_INTERNAL_CLASS ? zend_duplicate_property_info_internal : zend_duplicate_property_info), sizeof(zend_property_info), (merge_checker_func_t) do_inherit_property_access_check, ce);
zend_hash_merge(&ce->constants_table, &parent_ce->constants_table, (void (*)(void *)) zval_add_ref, NULL, sizeof(zval *), 0);
@@ -2208,14 +2149,10 @@ ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent
}
static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zval **parent_constant, zend_hash_key *hash_key, zend_class_entry *iface)
static zend_bool do_inherit_constant_check(HashTable *child_constants_table, zval *parent_constant, zend_hash_key *hash_key, zend_class_entry *iface)
{
zval **old_constant;
if (zend_hash_quick_find(child_constants_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h, (void**)&old_constant) == SUCCESS) {
if (*old_constant != *parent_constant) {
zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited constant %s from interface %s", hash_key->arKey, iface->name);
}
if (zend_hash_quick_exists(child_constants_table, hash_key->arKey, hash_key->nKeyLength, hash_key->h)) {
zend_error(E_COMPILE_ERROR, "Cannot inherit previously-inherited constant %s from interface %s", hash_key->arKey, iface->name);
return 0;
}
return 1;
@@ -2331,7 +2268,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(zend_op *opline, HashTable *c
zend_hash_destroy(&ce->function_table);
zend_hash_destroy(&ce->default_properties);
zend_hash_destroy(&ce->properties_info);
zend_hash_destroy(&ce->default_static_members);
zend_hash_destroy(ce->static_members);
zend_hash_destroy(&ce->constants_table);
return NULL;
}
@@ -2850,18 +2787,6 @@ ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src
}
ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **class_name, char **prop_name)
{
*prop_name = *class_name = NULL;
if (mangled_property_len < 2) { /* do not try to unmangle empty strings */
*prop_name = mangled_property;
return;
}
zend_unmangle_property_name(mangled_property, class_name, prop_name);
}
ZEND_API void zend_unmangle_property_name(char *mangled_property, char **class_name, char **prop_name)
{
*prop_name = *class_name = NULL;
@@ -3523,17 +3448,8 @@ void zend_do_isset_or_isempty(int type, znode *result, znode *variable TSRMLS_DC
void zend_do_instanceof(znode *result, znode *expr, znode *class_znode, int type TSRMLS_DC)
{
int last_op_number = get_next_op_number(CG(active_op_array));
zend_op *opline;
zend_op *opline = get_next_op(CG(active_op_array) TSRMLS_CC);
if (last_op_number > 0) {
opline = &CG(active_op_array)->opcodes[last_op_number-1];
if (opline->opcode == ZEND_FETCH_CLASS) {
opline->extended_value |= ZEND_FETCH_CLASS_NO_AUTOLOAD;
}
}
opline = get_next_op(CG(active_op_array) TSRMLS_CC);
opline->opcode = ZEND_INSTANCEOF;
opline->result.op_type = IS_TMP_VAR;
opline->result.u.var = get_temporary_variable(CG(active_op_array));
@@ -3657,8 +3573,7 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z
}
value_node = opline->result;
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
if (assign_by_ref) {
if (assign_by_ref) {
/* Mark FE_FETCH as IS_VAR as it holds the data directly as a value */
zend_do_assign_ref(NULL, value, &value_node TSRMLS_CC);
} else {
@@ -3669,8 +3584,7 @@ void zend_do_foreach_cont(znode *foreach_token, znode *as_token, znode *value, z
if (key->op_type != IS_UNUSED) {
znode key_node;
zend_do_end_variable_parse(BP_VAR_W, 0 TSRMLS_CC);
opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
opline = &CG(active_op_array)->opcodes[as_token->u.opline_num+1];
opline->result.op_type = IS_TMP_VAR;
opline->result.u.EA.type = 0;
opline->result.u.opline_num = get_temporary_variable(CG(active_op_array));
@@ -4018,12 +3932,17 @@ ZEND_API void zend_initialize_class_data(zend_class_entry *ce, zend_bool nullify
zend_hash_init_ex(&ce->default_properties, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
zend_hash_init_ex(&ce->properties_info, 0, NULL, (dtor_func_t) (persistent_hashes ? zend_destroy_property_info_internal : zend_destroy_property_info), persistent_hashes, 0);
zend_hash_init_ex(&ce->default_static_members, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
if (persistent_hashes) {
ce->static_members = (HashTable *) malloc(sizeof(HashTable));
} else {
ALLOC_HASHTABLE(ce->static_members);
}
zend_hash_init_ex(ce->static_members, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
zend_hash_init_ex(&ce->constants_table, 0, NULL, zval_ptr_dtor_func, persistent_hashes, 0);
zend_hash_init_ex(&ce->function_table, 0, NULL, ZEND_FUNCTION_DTOR, persistent_hashes, 0);
ce->static_members = (ce->type == ZEND_INTERNAL_CLASS) ? NULL : &ce->default_static_members;
if (nullify_handlers) {
ce->constructor = NULL;
ce->destructor = NULL;
+2 -3
View File
@@ -291,9 +291,9 @@ struct _zend_execute_data {
union _temp_variable *Ts;
zval ***CVs;
zend_bool original_in_execution;
zend_class_entry *calling_scope;
HashTable *symbol_table;
struct _zend_execute_data *prev_execute_data;
zval *old_error_reporting;
};
#define EX(element) execute_data.element
@@ -522,7 +522,6 @@ void zend_class_add_ref(zend_class_entry **ce);
ZEND_API void zend_mangle_property_name(char **dest, int *dest_length, char *src1, int src1_length, char *src2, int src2_length, int internal);
ZEND_API void zend_unmangle_property_name(char *mangled_property, char **prop_name, char **class_name);
ZEND_API void zend_unmangle_property_name_ex(char *mangled_property, int mangled_property_len, char **prop_name, char **class_name);
#define ZEND_FUNCTION_DTOR (void (*)(void *)) zend_function_dtor
#define ZEND_CLASS_DTOR (void (*)(void *)) destroy_zend_class
@@ -584,7 +583,7 @@ int zendlex(znode *zendlval TSRMLS_DC);
#define ZEND_FETCH_CLASS_GLOBAL 4
#define ZEND_FETCH_CLASS_AUTO 5
#define ZEND_FETCH_CLASS_INTERFACE 6
#define ZEND_FETCH_CLASS_NO_AUTOLOAD 0x80
/* variable parsing type (compile-time) */
#define ZEND_PARSED_MEMBER (1<<0)
-1
View File
@@ -196,7 +196,6 @@ static void _default_exception_get_entry(zval *object, char *name, int name_len,
*return_value = *value;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
+35 -37
View File
@@ -392,6 +392,12 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
if (variable_ptr == EG(error_zval_ptr) || value_ptr==EG(error_zval_ptr)) {
variable_ptr_ptr = &EG(uninitialized_zval_ptr);
} else if (variable_ptr != value_ptr) {
variable_ptr->refcount--;
if (variable_ptr->refcount==0) {
zendi_zval_dtor(*variable_ptr);
FREE_ZVAL(variable_ptr);
}
if (!PZVAL_IS_REF(value_ptr)) {
/* break it away */
value_ptr->refcount--;
@@ -407,12 +413,6 @@ static void zend_assign_to_variable_reference(zval **variable_ptr_ptr, zval **va
*variable_ptr_ptr = value_ptr;
value_ptr->refcount++;
variable_ptr->refcount--;
if (variable_ptr->refcount==0) {
zendi_zval_dtor(*variable_ptr);
FREE_ZVAL(variable_ptr);
}
} else if (!variable_ptr->is_ref) {
if (variable_ptr_ptr == value_ptr_ptr) {
SEPARATE_ZVAL(variable_ptr_ptr);
@@ -448,7 +448,6 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
{
zend_arg_info *cur_arg_info;
zend_execute_data *ptr = EG(current_execute_data)->prev_execute_data;
char *fclass, *fsep, *fname;
if (!zf->common.arg_info
|| arg_num>zf->common.num_args) {
@@ -456,25 +455,22 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
}
cur_arg_info = &zf->common.arg_info[arg_num-1];
fname = zf->common.function_name;
fsep = zf->common.scope ? "::" : "";
fclass = zf->common.scope ? zf->common.scope->name : "";
if (cur_arg_info->class_name) {
if (!arg) {
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s, called in %s on line %d and defined", arg_num, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s", arg_num, cur_arg_info->class_name);
}
}
switch (Z_TYPE_P(arg)) {
case IS_NULL:
if (!cur_arg_info->allow_null) {
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must not be null, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
zend_error_noreturn(E_ERROR, "Argument %d must not be null", arg_num);
}
}
break;
@@ -488,47 +484,47 @@ static inline void zend_verify_arg_type(zend_function *zf, zend_uint arg_num, zv
} else {
error_msg = "be an instance of";
}
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must %s %s, called in %s on line %d and defined", arg_num, error_msg, ce->name, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must %s %s", arg_num, fclass, fsep, fname, error_msg, ce->name);
zend_error_noreturn(E_ERROR, "Argument %d must %s %s", arg_num, error_msg, ce->name);
}
}
}
break;
default:
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s, called in %s on line %d and defined", arg_num, fclass, fsep, fname, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s, called in %s on line %d and defined", arg_num, cur_arg_info->class_name, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an object of class %s", arg_num, fclass, fsep, fname, cur_arg_info->class_name);
zend_error_noreturn(E_ERROR, "Argument %d must be an object of class %s", arg_num, cur_arg_info->class_name);
}
break;
}
} else if (cur_arg_info->array_type_hint) {
} else if (cur_arg_info->array_type_hint) {
if (!arg) {
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
zend_error_noreturn(E_ERROR, "Argument %d must be an array, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
zend_error_noreturn(E_ERROR, "Argument %d must be an array", arg_num);
}
}
switch (Z_TYPE_P(arg)) {
case IS_NULL:
if (!cur_arg_info->allow_null) {
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must not be null, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must not be null", arg_num, fclass, fsep, fname);
zend_error_noreturn(E_ERROR, "Argument %d must not be null", arg_num);
}
}
break;
case IS_ARRAY:
break;
default:
if (ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array, called in %s on line %d and defined", arg_num, fclass, fsep, fname, ptr->op_array->filename, ptr->opline->lineno);
if(ptr && ptr->op_array) {
zend_error_noreturn(E_ERROR, "Argument %d must be an array, called in %s on line %d and defined", arg_num, ptr->op_array->filename, ptr->opline->lineno);
} else {
zend_error_noreturn(E_ERROR, "Argument %d passed to %s%s%s() must be an array", arg_num, fclass, fsep, fname);
zend_error_noreturn(E_ERROR, "Argument %d must be an array", arg_num);
}
break;
}
@@ -1061,7 +1057,6 @@ static void zend_fetch_dimension_address(temp_variable *result, zval **container
SEPARATE_ZVAL(container_ptr);
container = *container_ptr;
}
zval_dtor(container);
array_init(container);
break;
}
@@ -1250,6 +1245,11 @@ static void zend_fetch_property_address(temp_variable *result, zval **container_
return;
}
if ((type==BP_VAR_W || type==BP_VAR_RW) && container->refcount>1 && !PZVAL_IS_REF(container)) {
SEPARATE_ZVAL(container_ptr);
container = *container_ptr;
}
if (Z_OBJ_HT_P(container)->get_property_ptr_ptr) {
zval **ptr_ptr = Z_OBJ_HT_P(container)->get_property_ptr_ptr(container, prop_ptr TSRMLS_CC);
if(NULL == ptr_ptr) {
@@ -1366,11 +1366,6 @@ ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_v
CHECK_SYMBOL_TABLES() \
EX(opline) = new_op
#define ZEND_VM_JMP(new_op) \
CHECK_SYMBOL_TABLES() \
EX(opline) = EG(exception)?EX(opline)+1:new_op; \
ZEND_VM_CONTINUE()
#define ZEND_VM_INC_OPCODE() \
if (!EG(exception)) { \
CHECK_SYMBOL_TABLES() \
@@ -1388,6 +1383,9 @@ ZEND_API void execute_internal(zend_execute_data *execute_data_ptr, int return_v
EG(current_execute_data) = EX(prev_execute_data); \
ZEND_VM_RETURN()
#define ZEND_VM_CONTINUE_JMP() \
ZEND_VM_CONTINUE()
#include "zend_vm_execute.h"
ZEND_API int zend_set_user_opcode_handler(zend_uchar opcode, opcode_handler_t handler)
-19
View File
@@ -65,7 +65,6 @@ static inline void safe_free_zval_ptr_rel(zval *p ZEND_FILE_LINE_DC ZEND_FILE_LI
}
}
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC);
ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC);
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC);
ZEND_API int zend_eval_string_ex(char *str, zval *retval_ptr, char *string_name, int handle_exceptions TSRMLS_DC);
@@ -99,24 +98,6 @@ static inline int i_zend_is_true(zval *op)
case IS_OBJECT:
if(IS_ZEND_STD_OBJECT(*op)) {
TSRMLS_FETCH();
if (Z_OBJ_HT_P(op)->cast_object) {
zval tmp;
if (Z_OBJ_HT_P(op)->cast_object(op, &tmp, IS_BOOL, 0 TSRMLS_CC) == SUCCESS) {
result = Z_LVAL(tmp);
break;
}
} else if (Z_OBJ_HT_P(op)->get) {
zval *tmp = Z_OBJ_HT_P(op)->get(op TSRMLS_CC);
if(Z_TYPE_P(tmp) != IS_OBJECT) {
/* for safety - avoid loop */
convert_to_boolean(tmp);
result = Z_LVAL_P(tmp);
zval_ptr_dtor(&tmp);
break;
}
}
if(EG(ze1_compatibility_mode)) {
result = (zend_hash_num_elements(Z_OBJPROP_P(op))?1:0);
} else {
+10 -29
View File
@@ -386,13 +386,6 @@ ZEND_API void _zval_ptr_dtor(zval **zval_ptr ZEND_FILE_LINE_DC)
zval_dtor(*zval_ptr);
safe_free_zval_ptr_rel(*zval_ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
} else if ((*zval_ptr)->refcount == 1) {
if ((*zval_ptr)->type == IS_OBJECT) {
TSRMLS_FETCH();
if (EG(ze1_compatibility_mode)) {
return;
}
}
(*zval_ptr)->is_ref = 0;
}
}
@@ -757,9 +750,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
return FAILURE;
}
}
if (fci_cache &&
(EX(function_state).function->type != ZEND_INTERNAL_FUNCTION ||
((zend_internal_function*)EX(function_state).function)->handler != zend_std_call_user_call)) {
if (fci_cache) {
fci_cache->function_handler = EX(function_state).function;
fci_cache->object_pp = fci->object_pp;
fci_cache->calling_scope = calling_scope;
@@ -915,7 +906,7 @@ int zend_call_function(zend_fcall_info *fci, zend_fcall_info_cache *fci_cache TS
}
ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload, zend_class_entry ***ce TSRMLS_DC)
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
{
zval **args[1];
zval autoload_function;
@@ -943,7 +934,7 @@ ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload,
/* The compiler is not-reentrant. Make sure we __autoload() only during run-time
* (doesn't impact fuctionality of __autoload()
*/
if (!use_autoload || zend_is_compiling(TSRMLS_C)) {
if (zend_is_compiling(TSRMLS_C)) {
free_alloca(lc_name);
return FAILURE;
}
@@ -1011,11 +1002,6 @@ ZEND_API int zend_lookup_class_ex(char *name, int name_length, int use_autoload,
return retval;
}
ZEND_API int zend_lookup_class(char *name, int name_length, zend_class_entry ***ce TSRMLS_DC)
{
return zend_lookup_class_ex(name, name_length, 1, ce TSRMLS_CC);
}
ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name TSRMLS_DC)
{
zval pv;
@@ -1341,9 +1327,7 @@ void zend_unset_timeout(TSRMLS_D)
zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fetch_type TSRMLS_DC)
{
zend_class_entry **pce;
int use_autoload = (fetch_type & ZEND_FETCH_CLASS_NO_AUTOLOAD) == 0;
fetch_type = fetch_type & ~ZEND_FETCH_CLASS_NO_AUTOLOAD;
check_fetch_type:
switch (fetch_type) {
case ZEND_FETCH_CLASS_SELF:
@@ -1368,15 +1352,12 @@ check_fetch_type:
break;
}
if (zend_lookup_class_ex(class_name, class_name_len, use_autoload, &pce TSRMLS_CC)==FAILURE) {
if (use_autoload) {
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
zend_error(E_ERROR, "Interface '%s' not found", class_name);
} else {
zend_error(E_ERROR, "Class '%s' not found", class_name);
}
if (zend_lookup_class(class_name, class_name_len, &pce TSRMLS_CC)==FAILURE) {
if (fetch_type == ZEND_FETCH_CLASS_INTERFACE) {
zend_error(E_ERROR, "Interface '%s' not found", class_name);
} else {
zend_error(E_ERROR, "Class '%s' not found", class_name);
}
return NULL;
}
return *pce;
}
@@ -1436,7 +1417,7 @@ ZEND_API void zend_reset_all_cv(HashTable *symbol_table TSRMLS_DC)
int i;
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
if (ex->op_array && ex->symbol_table == symbol_table) {
if (ex->symbol_table == symbol_table) {
for (i = 0; i < ex->op_array->last_var; i++) {
ex->CVs[i] = NULL;
}
@@ -1451,7 +1432,7 @@ ZEND_API int zend_delete_global_variable(char *name, int name_len TSRMLS_DC)
if (zend_hash_quick_exists(&EG(symbol_table), name, name_len+1, hash_value)) {
for (ex = EG(current_execute_data); ex; ex = ex->prev_execute_data) {
if (ex->op_array && ex->symbol_table == &EG(symbol_table)) {
if (ex->symbol_table == &EG(symbol_table)) {
int i;
for (i = 0; i < ex->op_array->last_var; i++) {
if (ex->op_array->vars[i].hash_value == hash_value &&
+1 -1
View File
@@ -27,7 +27,7 @@
/* The first number is the engine version and the rest is the date.
* This way engine 2 API no. is always greater than engine 1 API no..
*/
#define ZEND_EXTENSION_API_NO 220051025
#define ZEND_EXTENSION_API_NO 220050617
typedef struct _zend_extension_version_info {
int zend_extension_api_no;
-1
View File
@@ -135,7 +135,6 @@ struct _zend_compiler_globals {
#ifdef ZEND_MULTIBYTE
zend_encoding **script_encoding_list;
int script_encoding_list_size;
zend_bool detect_unicode;
zend_encoding *internal_encoding;
+4 -7
View File
@@ -154,7 +154,6 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
zend_ini_entry *hashed_ini_entry;
zval default_value;
HashTable *directives = registered_zend_ini_directives;
zend_bool config_directive_success = 0;
#ifdef ZTS
/* if we are called during the request, eg: from dl(),
@@ -172,7 +171,6 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
while (p->name) {
p->module_number = module_number;
config_directive_success = 0;
if (zend_hash_add(directives, p->name, p->name_length, p, sizeof(zend_ini_entry), (void **) &hashed_ini_entry)==FAILURE) {
zend_unregister_ini_entries(module_number TSRMLS_CC);
return FAILURE;
@@ -182,12 +180,11 @@ ZEND_API int zend_register_ini_entries(zend_ini_entry *ini_entry, int module_num
|| hashed_ini_entry->on_modify(hashed_ini_entry, default_value.value.str.val, default_value.value.str.len, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC)==SUCCESS) {
hashed_ini_entry->value = default_value.value.str.val;
hashed_ini_entry->value_length = default_value.value.str.len;
config_directive_success = 1;
}
}
if (!config_directive_success && hashed_ini_entry->on_modify) {
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
} else {
if (hashed_ini_entry->on_modify) {
hashed_ini_entry->on_modify(hashed_ini_entry, hashed_ini_entry->value, hashed_ini_entry->value_length, hashed_ini_entry->mh_arg1, hashed_ini_entry->mh_arg2, hashed_ini_entry->mh_arg3, ZEND_INI_STAGE_STARTUP TSRMLS_CC);
}
}
p++;
}
-1
View File
@@ -58,7 +58,6 @@ ZEND_API zval* zend_call_method(zval **object_pp, zend_class_entry *obj_ce, zend
/* no interest in caching and no information already present that is
* needed later inside zend_call_function. */
ZVAL_STRINGL(&z_fname, function_name, function_name_len, 0);
fci.function_table = !object_pp ? EG(function_table) : NULL;
result = zend_call_function(&fci, NULL TSRMLS_CC);
} else {
zend_fcall_info_cache fcic;
+4 -4
View File
@@ -181,7 +181,7 @@ inner_statement:
statement:
unticked_statement { zend_do_ticks(TSRMLS_C); }
unticked_statement { zend_do_ticks(TSRMLS_C); RESET_DOC_COMMENT(); }
;
unticked_statement:
@@ -220,7 +220,7 @@ unticked_statement:
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
| T_FOREACH '(' expr_without_variable { zend_do_foreach_begin(&$1, &$2, &$3, 0 TSRMLS_CC); } T_AS
{ zend_do_foreach_fetch(&$1, &$2, &$5 TSRMLS_CC); }
variable foreach_optional_arg ')' { zend_check_writable_variable(&$7); zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
w_variable foreach_optional_arg ')' { zend_do_foreach_cont(&$1, &$5, &$7, &$8 TSRMLS_CC); }
foreach_statement { zend_do_foreach_end(&$1, &$5 TSRMLS_CC); }
| T_DECLARE { $1.u.opline_num = get_next_op_number(CG(active_op_array)); zend_do_declare_begin(TSRMLS_C); } '(' declare_list ')' declare_statement { zend_do_declare_end(&$1 TSRMLS_CC); }
| ';' /* empty statement */
@@ -338,8 +338,8 @@ foreach_optional_arg:
foreach_variable:
variable { zend_check_writable_variable(&$1); $$ = $1; }
| '&' variable { zend_check_writable_variable(&$2); $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
w_variable { $$ = $1; }
| '&' w_variable { $$ = $2; $$.u.EA.type |= ZEND_PARSED_REFERENCE_VARIABLE; }
;
for_statement:
+4 -18
View File
@@ -506,9 +506,7 @@ ZEND_API int zend_get_scanned_file_offset(TSRMLS_D)
return zend_stream_ftell(yyin TSRMLS_CC) - offset_from_the_end;
} else {
/* The entire file is in the buffer; probably zend multibyte
is enabled */
return (yy_c_buf_p - (YY_CURRENT_BUFFER)->yy_ch_buf);
return -1;
}
}
@@ -617,7 +615,6 @@ int highlight_string(zval *str, zend_syntax_highlighter_ini *syntax_highlighter_
if (zend_prepare_string_for_scanning(str, str_name TSRMLS_CC)==FAILURE) {
return FAILURE;
}
BEGIN(INITIAL);
zend_highlight(syntax_highlighter_ini TSRMLS_CC);
#ifdef ZEND_MULTIBYTE
if (SCNG(script_org)) {
@@ -1465,13 +1462,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
yymore();
}
<ST_ONE_LINE_COMMENT><<EOF>> {
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
zendlval->type = IS_STRING;
return T_COMMENT;
}
<ST_ONE_LINE_COMMENT>{NEWLINE} {
zendlval->value.str.val = yytext; /* no copying - intentional */
zendlval->value.str.len = yyleng;
@@ -1843,13 +1833,6 @@ NEWLINE ("\r"|"\n"|"\r\n")
return T_CHARACTER;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\{$" {
zendlval->value.str.val = estrndup("{$", sizeof("{$")-1);
zendlval->value.str.len = sizeof("{$")-1;
zendlval->type = IS_STRING;
return T_STRING;
}
<ST_DOUBLE_QUOTES,ST_BACKQUOTE,ST_HEREDOC>"\\"{ANY_CHAR} {
switch (yytext[1]) {
case 'n':
@@ -1867,6 +1850,9 @@ NEWLINE ("\r"|"\n"|"\r\n")
case '$':
zendlval->value.lval = (long) yytext[1];
break;
case '{':
zendlval->value.lval = (long) yytext[1];
break;
default:
zendlval->value.str.val = estrndup(yytext, yyleng);
zendlval->value.str.len = yyleng;
+1 -1
View File
@@ -38,7 +38,7 @@ extern struct _zend_arg_info third_arg_force_ref[4];
extern struct _zend_arg_info fourth_arg_force_ref[5];
extern struct _zend_arg_info all_args_by_ref[1];
#define ZEND_MODULE_API_NO 20050922
#define ZEND_MODULE_API_NO 20050617
#ifdef ZTS
#define USING_ZTS 1
#else
+5 -7
View File
@@ -994,13 +994,11 @@ static zend_encoding* zend_multibyte_find_script_encoding(zend_encoding *onetime
return onetime_encoding;
}
if (CG(detect_unicode)) {
/* check out bom(byte order mark) and see if containing wchars */
script_encoding = zend_multibyte_detect_unicode(TSRMLS_C);
if (script_encoding != NULL) {
/* bom or wchar detection is prior to 'script_encoding' option */
return script_encoding;
}
/* check out bom(byte order mark) and see if containing wchars */
script_encoding = zend_multibyte_detect_unicode(TSRMLS_C);
if (script_encoding != NULL) {
/* bom or wchar detection is prior to 'script_encoding' option */
return script_encoding;
}
/* if no script_encoding specified, just leave alone */
+30 -71
View File
@@ -237,7 +237,7 @@ ZEND_API struct _zend_property_info *zend_get_property_info(zend_class_entry *ce
EG(std_property_info).flags = ZEND_ACC_PUBLIC;
EG(std_property_info).name = Z_STRVAL_P(member);
EG(std_property_info).name_length = Z_STRLEN_P(member);
EG(std_property_info).h = h;
EG(std_property_info).h = zend_get_hash_value(EG(std_property_info).name, EG(std_property_info).name_length+1);
property_info = &EG(std_property_info);
}
return property_info;
@@ -268,30 +268,6 @@ ZEND_API int zend_check_property_access(zend_object *zobj, char *prop_info_name
return zend_verify_property_access(property_info, zobj->ce TSRMLS_CC) ? SUCCESS : FAILURE;
}
static int zend_get_property_guard(zend_object *zobj, zend_property_info *property_info, zval *member, zend_guard **pguard)
{
zend_property_info info;
zend_guard stub;
if (!property_info) {
property_info = &info;
info.name = Z_STRVAL_P(member);
info.name_length = Z_STRLEN_P(member);
info.h = zend_get_hash_value(Z_STRVAL_P(member), Z_STRLEN_P(member) + 1);
}
if (!zobj->guards) {
ALLOC_HASHTABLE(zobj->guards);
zend_hash_init(zobj->guards, 0, NULL, NULL, 0);
} else if (zend_hash_quick_find(zobj->guards, property_info->name, property_info->name_length+1, property_info->h, (void **) pguard) == SUCCESS) {
return SUCCESS;
}
stub.in_get = 0;
stub.in_set = 0;
stub.in_unset = 0;
stub.in_isset = 0;
return zend_hash_quick_add(zobj->guards, property_info->name, property_info->name_length+1, property_info->h, (void**)&stub, sizeof(stub), (void**) pguard);
}
zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
{
zend_object *zobj;
@@ -300,9 +276,11 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
zval *rv = NULL;
zend_property_info *property_info;
int silent;
zend_bool use_get;
silent = (type == BP_VAR_IS);
zobj = Z_OBJ_P(object);
use_get = (zobj->ce->__get && !zobj->in_get);
if (member->type != IS_STRING) {
ALLOC_ZVAL(tmp_member);
@@ -318,18 +296,14 @@ zval *zend_std_read_property(zval *object, zval *member, int type TSRMLS_DC)
#endif
/* make zend_get_property_info silent if we have getter - we may want to use it */
property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__get != NULL) TSRMLS_CC);
property_info = zend_get_property_info(zobj->ce, member, use_get TSRMLS_CC);
if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
zend_guard *guard;
if (zobj->ce->__get &&
zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
!guard->in_get) {
if (use_get) {
/* have getter - try with it! */
guard->in_get = 1; /* prevent circular getting */
zobj->in_get = 1; /* prevent circular getting */
rv = zend_std_call_getter(object, member TSRMLS_CC);
guard->in_get = 0;
zobj->in_get = 0;
if (rv) {
retval = &rv;
@@ -359,8 +333,10 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
zval **variable_ptr;
int setter_done = 0;
zend_property_info *property_info;
zend_bool use_set;
zobj = Z_OBJ_P(object);
use_set = (zobj->ce->__set && !zobj->in_set);
if (member->type != IS_STRING) {
ALLOC_ZVAL(tmp_member);
@@ -371,7 +347,7 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
member = tmp_member;
}
property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__set != NULL) TSRMLS_CC);
property_info = zend_get_property_info(zobj->ce, member, use_set TSRMLS_CC);
if (property_info && zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &variable_ptr) == SUCCESS) {
if (*variable_ptr == value) {
@@ -381,30 +357,24 @@ static void zend_std_write_property(zval *object, zval *member, zval *value TSRM
/* if we are assigning reference, we shouldn't move it, but instead assign variable
to the same pointer */
if (PZVAL_IS_REF(*variable_ptr)) {
zval garbage = **variable_ptr; /* old value should be destroyed */
zval_dtor(*variable_ptr); /* old value should be destroyed */
/* To check: can't *variable_ptr be some system variable like error_zval here? */
(*variable_ptr)->type = value->type;
(*variable_ptr)->value = value->value;
if (value->refcount>0) {
zval_copy_ctor(*variable_ptr);
}
zval_dtor(&garbage);
setter_done = 1;
}
}
} else {
zend_guard *guard;
if (zobj->ce->__set &&
zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
!guard->in_set) {
guard->in_set = 1; /* prevent circular setting */
if (use_set) {
zobj->in_set = 1; /* prevent circular setting */
if (zend_std_call_setter(object, member, value TSRMLS_CC) != SUCCESS) {
/* for now, just ignore it - __set should take care of warnings, etc. */
}
setter_done = 1;
guard->in_set = 0;
zobj->in_set = 0;
}
}
@@ -526,15 +496,12 @@ static zval **zend_std_get_property_ptr_ptr(zval *object, zval *member TSRMLS_DC
fprintf(stderr, "Ptr object #%d property: %s\n", Z_OBJ_HANDLE_P(object), Z_STRVAL_P(member));
#endif
property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__get != NULL) TSRMLS_CC);
property_info = zend_get_property_info(zobj->ce, member, 0 TSRMLS_CC);
if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
if (zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval) == FAILURE) {
zval *new_zval;
zend_guard *guard;
if (!zobj->ce->__get ||
zend_get_property_guard(zobj, property_info, member, &guard) != SUCCESS ||
guard->in_get) {
if (!zobj->ce->__get && !zobj->ce->__set) {
/* we don't have access controls - will just add it */
new_zval = &EG(uninitialized_zval);
@@ -558,8 +525,10 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC)
zend_object *zobj;
zval *tmp_member = NULL;
zend_property_info *property_info;
zend_bool use_unset;
zobj = Z_OBJ_P(object);
use_unset = (zobj->ce->__unset && !zobj->in_unset);
if (member->type != IS_STRING) {
ALLOC_ZVAL(tmp_member);
@@ -570,18 +539,14 @@ static void zend_std_unset_property(zval *object, zval *member TSRMLS_DC)
member = tmp_member;
}
property_info = zend_get_property_info(zobj->ce, member, (zobj->ce->__unset != NULL) TSRMLS_CC);
property_info = zend_get_property_info(zobj->ce, member, 0 TSRMLS_CC);
if (!property_info || zend_hash_del(zobj->properties, property_info->name, property_info->name_length+1) == FAILURE) {
zend_guard *guard;
if (zobj->ce->__unset &&
zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
!guard->in_unset) {
if (use_unset) {
/* have unseter - try with it! */
guard->in_unset = 1; /* prevent circular setting */
zobj->in_unset = 1; /* prevent circular unsetting */
zend_std_call_unsetter(object, member TSRMLS_CC);
guard->in_unset = 0;
zobj->in_unset = 0;
}
}
@@ -855,8 +820,6 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
return NULL;
}
zend_update_class_constants(tmp_ce TSRMLS_CC);
zend_hash_quick_find(tmp_ce->static_members, property_info->name, property_info->name_length+1, property_info->h, (void **) &retval);
if (!retval) {
@@ -867,6 +830,7 @@ ZEND_API zval **zend_std_get_static_property(zend_class_entry *ce, char *propert
}
}
zval_update_constant(retval, (void *) 1 TSRMLS_CC);
return retval;
}
@@ -928,8 +892,10 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists
zval **value;
zval *tmp_member = NULL;
zend_property_info *property_info;
zend_bool use_isset;
zobj = Z_OBJ_P(object);
use_isset = (zobj->ce->__isset && !zobj->in_isset);
if (member->type != IS_STRING) {
ALLOC_ZVAL(tmp_member);
@@ -947,25 +913,19 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists
property_info = zend_get_property_info(zobj->ce, member, 1 TSRMLS_CC);
if (!property_info || zend_hash_quick_find(zobj->properties, property_info->name, property_info->name_length+1, property_info->h, (void **) &value) == FAILURE) {
zend_guard *guard;
result = 0;
if ((has_set_exists != 2) &&
zobj->ce->__isset &&
zend_get_property_guard(zobj, property_info, member, &guard) == SUCCESS &&
!guard->in_isset) {
if (use_isset && (has_set_exists != 2)) {
zval *rv;
/* have issetter - try with it! */
guard->in_isset = 1; /* prevent circular getting */
zobj->in_isset = 1; /* prevent circular getting */
rv = zend_std_call_issetter(object, member TSRMLS_CC);
zobj->in_isset = 0;
if (rv) {
result = zend_is_true(rv);
zval_ptr_dtor(&rv);
if (has_set_exists && result && !EG(exception) && zobj->ce->__get && !guard->in_get) {
guard->in_get = 1;
if (has_set_exists && result && !EG(exception) && zobj->ce->__get && !zobj->in_get) {
rv = zend_std_call_getter(object, member TSRMLS_CC);
guard->in_get = 0;
if (rv) {
rv->refcount++;
result = i_zend_is_true(rv);
@@ -973,7 +933,6 @@ static int zend_std_has_property(zval *object, zval *member, int has_set_exists
}
}
}
guard->in_isset = 0;
}
} else {
switch (has_set_exists) {
+4 -5
View File
@@ -88,10 +88,6 @@ ZEND_API void zend_objects_destroy_object(zend_object *object, zend_object_handl
ZEND_API void zend_objects_free_object_storage(zend_object *object TSRMLS_DC)
{
if (object->guards) {
zend_hash_destroy(object->guards);
FREE_HASHTABLE(object->guards);
}
zend_hash_destroy(object->properties);
FREE_HASHTABLE(object->properties);
efree(object);
@@ -105,7 +101,10 @@ ZEND_API zend_object_value zend_objects_new(zend_object **object, zend_class_ent
(*object)->ce = class_type;
retval.handle = zend_objects_store_put(*object, (zend_objects_store_dtor_t) zend_objects_destroy_object, (zend_objects_free_object_storage_t) zend_objects_free_object_storage, NULL TSRMLS_CC);
retval.handlers = &std_object_handlers;
(*object)->guards = NULL;
(*object)->in_get = 0;
(*object)->in_set = 0;
(*object)->in_unset = 0;
(*object)->in_isset = 0;
return retval;
}
+5 -13
View File
@@ -38,7 +38,6 @@ ZEND_API void zend_objects_store_init(zend_objects_store *objects, zend_uint ini
ZEND_API void zend_objects_store_destroy(zend_objects_store *objects)
{
efree(objects->object_buckets);
objects->object_buckets = NULL;
}
ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TSRMLS_DC)
@@ -51,7 +50,7 @@ ZEND_API void zend_objects_store_call_destructors(zend_objects_store *objects TS
if (!objects->object_buckets[i].destructor_called) {
objects->object_buckets[i].destructor_called = 1;
if (obj->dtor && obj->object) {
if (obj->dtor) {
obj->dtor(obj->object, i TSRMLS_CC);
}
}
@@ -111,7 +110,7 @@ ZEND_API zend_object_handle zend_objects_store_put(void *object, zend_objects_st
obj->refcount = 1;
obj->object = object;
obj->dtor = dtor?dtor:(zend_objects_store_dtor_t)zend_objects_destroy_object;
obj->dtor = dtor;
obj->free_storage = free_storage;
obj->clone = clone;
@@ -139,16 +138,9 @@ ZEND_API void zend_objects_store_add_ref(zval *object TSRMLS_DC)
ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC)
{
zend_object_handle handle;
struct _store_object *obj;
if (!EG(objects_store).object_buckets) {
return;
}
handle = Z_OBJ_HANDLE_P(zobject);
obj = &EG(objects_store).object_buckets[handle].bucket.obj;
zend_object_handle handle = Z_OBJ_HANDLE_P(zobject);
struct _store_object *obj = &EG(objects_store).object_buckets[handle].bucket.obj;
/* Make sure we hold a reference count during the destructor call
otherwise, when the destructor ends the storage might be freed
when the refcount reaches 0 a second time
+5 -9
View File
@@ -138,17 +138,11 @@ ZEND_API int zend_cleanup_function_data(zend_function *function TSRMLS_DC)
ZEND_API int zend_cleanup_class_data(zend_class_entry **pce TSRMLS_DC)
{
if ((*pce)->static_members) {
if ((*pce)->static_members != &(*pce)->default_static_members) {
zend_hash_destroy((*pce)->static_members);
FREE_HASHTABLE((*pce)->static_members);
}
(*pce)->static_members = NULL;
}
if ((*pce)->type == ZEND_USER_CLASS) {
/* Clean all parts that can contain run-time data */
/* Note that only run-time accessed data need to be cleaned up, pre-defined data can
not contain objects and thus are not probelmatic */
zend_hash_clean((*pce)->static_members);
zend_hash_apply(&(*pce)->function_table, (apply_func_t) zend_cleanup_function_data TSRMLS_CC);
}
return 0;
@@ -165,9 +159,10 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
case ZEND_USER_CLASS:
zend_hash_destroy(&ce->default_properties);
zend_hash_destroy(&ce->properties_info);
zend_hash_destroy(&ce->default_static_members);
zend_hash_destroy(ce->static_members);
efree(ce->name);
zend_hash_destroy(&ce->function_table);
FREE_HASHTABLE(ce->static_members);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0 && ce->interfaces) {
efree(ce->interfaces);
@@ -180,9 +175,10 @@ ZEND_API void destroy_zend_class(zend_class_entry **pce)
case ZEND_INTERNAL_CLASS:
zend_hash_destroy(&ce->default_properties);
zend_hash_destroy(&ce->properties_info);
zend_hash_destroy(&ce->default_static_members);
zend_hash_destroy(ce->static_members);
free(ce->name);
zend_hash_destroy(&ce->function_table);
free(ce->static_members);
zend_hash_destroy(&ce->constants_table);
if (ce->num_interfaces > 0) {
free(ce->interfaces);
+1 -1
View File
@@ -482,7 +482,7 @@ ZEND_API void convert_to_boolean(zval *op)
zend_bool retval = 1;
TSRMLS_FETCH();
convert_object_to_type(op, IS_BOOL, convert_to_boolean);
convert_object_to_type(op, IS_BOOL, convert_to_double);
if (op->type == IS_BOOL) {
return;
+9 -15
View File
@@ -65,7 +65,7 @@ ZEND_API zend_bool instanceof_function_ex(zend_class_entry *instance_ce, zend_cl
ZEND_API zend_bool instanceof_function(zend_class_entry *instance_ce, zend_class_entry *ce TSRMLS_DC);
END_EXTERN_C()
static inline zend_bool is_numeric_string(char *str, int length, long *lval, double *dval, int allow_errors)
static inline zend_bool is_numeric_string(char *str, int length, long *lval, double *dval, zend_bool allow_errors)
{
long local_lval;
double local_dval;
@@ -116,20 +116,14 @@ static inline zend_bool is_numeric_string(char *str, int length, long *lval, dou
} else {
end_ptr_double=NULL;
}
if (!allow_errors) {
return 0;
}
if (allow_errors == -1) {
zend_error(E_NOTICE, "A non well formed numeric value encountered");
}
if (end_ptr_double>end_ptr_long && dval) {
*dval = local_dval;
return IS_DOUBLE;
} else if (end_ptr_long && lval) {
*lval = local_lval;
return IS_LONG;
if (allow_errors) {
if (end_ptr_double>end_ptr_long && dval) {
*dval = local_dval;
return IS_DOUBLE;
} else if (end_ptr_long && lval) {
*lval = local_lval;
return IS_LONG;
}
}
return 0;
}
+1 -8
View File
@@ -84,14 +84,7 @@ static inline void zend_ptr_stack_3_pop(zend_ptr_stack *stack, void **a, void **
*a = *(--stack->top_element);
*b = *(--stack->top_element);
*c = *(--stack->top_element);
stack->top -= 3;
}
static inline void zend_ptr_stack_2_pop(zend_ptr_stack *stack, void **a, void **b)
{
*a = *(--stack->top_element);
*b = *(--stack->top_element);
stack->top -= 2;
stack->top -= 3;;
}
static inline void zend_ptr_stack_push(zend_ptr_stack *stack, void *ptr)
+102 -96
View File
@@ -41,13 +41,13 @@ zend_class_entry *reflection_property_ptr;
zend_class_entry *reflection_extension_ptr;
/* Method macros */
#define METHOD_NOTSTATIC(ce) \
if (!this_ptr || !instanceof_function(Z_OBJCE_P(this_ptr), ce TSRMLS_CC)) { \
#define METHOD_NOTSTATIC \
if (!this_ptr) { \
zend_error(E_ERROR, "%s() cannot be called statically", get_active_function_name(TSRMLS_C)); \
return; \
} \
#define METHOD_NOTSTATIC_NUMPARAMS(ce, c) METHOD_NOTSTATIC(ce) \
#define METHOD_NOTSTATIC_NUMPARAMS(c) METHOD_NOTSTATIC \
if (ZEND_NUM_ARGS() > c) { \
ZEND_WRONG_PARAM_COUNT(); \
} \
@@ -203,7 +203,10 @@ static void reflection_objects_clone(void *object, void **object_clone TSRMLS_DC
*intern_clone = emalloc(sizeof(reflection_object));
(*intern_clone)->zo.ce = intern->zo.ce;
(*intern_clone)->zo.guards = NULL;
(*intern_clone)->zo.in_get = 0;
(*intern_clone)->zo.in_set = 0;
(*intern_clone)->zo.in_unset = 0;
(*intern_clone)->zo.in_isset = 0;
ALLOC_HASHTABLE((*intern_clone)->zo.properties);
(*intern_clone)->ptr = intern->ptr;
(*intern_clone)->free_ptr = intern->free_ptr;
@@ -221,7 +224,10 @@ static zend_object_value reflection_objects_new(zend_class_entry *class_type TSR
intern = emalloc(sizeof(reflection_object));
intern->zo.ce = class_type;
intern->zo.guards = NULL;
intern->zo.in_get = 0;
intern->zo.in_set = 0;
intern->zo.in_unset = 0;
intern->zo.in_isset = 0;
intern->ptr = NULL;
intern->obj = NULL;
intern->free_ptr = 0;
@@ -714,7 +720,7 @@ static void _property_string(string *str, zend_property_info *prop, char *prop_n
string_printf(str, "static ");
}
zend_unmangle_property_name_ex(prop->name, prop->name_length, &class_name, &prop_name);
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
string_printf(str, "$%s", prop_name);
}
@@ -747,7 +753,7 @@ static int _extension_ini_string(zend_ini_entry *ini_entry, int num_args, va_lis
}
}
string_printf(str, "> ]\n");
string_printf(str, "> ]\n", indent, ini_entry->name);
string_printf(str, " %s Current = '%s'\n", indent, ini_entry->value ? ini_entry->value : "");
if (ini_entry->modified) {
string_printf(str, " %s Default = '%s'\n", indent, ini_entry->orig_value ? ini_entry->orig_value : "");
@@ -846,7 +852,7 @@ static void _function_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & mask);
}
@@ -972,7 +978,7 @@ static void reflection_property_factory(zend_class_entry *ce, zend_property_info
property_reference *reference;
char *class_name, *prop_name;
zend_unmangle_property_name_ex(prop->name, prop->name_length, &class_name, &prop_name);
zend_unmangle_property_name(prop->name, &class_name, &prop_name);
if (!(prop->flags & ZEND_ACC_PRIVATE)) {
/* we have to seach the class hierarchy for this (implicit) public or protected property */
@@ -1246,7 +1252,7 @@ ZEND_METHOD(reflection_function, __toString)
zend_function *fptr;
string str;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
string_init(&str);
_function_string(&str, fptr, "" TSRMLS_CC);
@@ -1258,7 +1264,7 @@ ZEND_METHOD(reflection_function, __toString)
Returns this function's name */
ZEND_METHOD(reflection, function_getName)
{
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -1270,7 +1276,7 @@ ZEND_METHOD(reflection, function_isInternal)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_INTERNAL_FUNCTION);
}
@@ -1283,7 +1289,7 @@ ZEND_METHOD(reflection_function, isUserDefined)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->type == ZEND_USER_FUNCTION);
}
@@ -1296,7 +1302,7 @@ ZEND_METHOD(reflection_function, getFileName)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_STRING(fptr->op_array.filename, 1);
@@ -1312,7 +1318,7 @@ ZEND_METHOD(reflection_function, getStartLine)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_start);
@@ -1328,7 +1334,7 @@ ZEND_METHOD(reflection_function, getEndLine)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION) {
RETURN_LONG(fptr->op_array.line_end);
@@ -1344,7 +1350,7 @@ ZEND_METHOD(reflection_function, getDocComment)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.doc_comment) {
RETURN_STRINGL(fptr->op_array.doc_comment, fptr->op_array.doc_comment_len, 1);
@@ -1361,13 +1367,12 @@ ZEND_METHOD(reflection_function, getStaticVariables)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_function_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(fptr);
/* Return an empty array in case no static variables exist */
array_init(return_value);
if (fptr->type == ZEND_USER_FUNCTION && fptr->op_array.static_variables != NULL) {
zend_hash_apply_with_argument(fptr->op_array.static_variables, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
zend_hash_copy(Z_ARRVAL_P(return_value), fptr->op_array.static_variables, (copy_ctor_func_t) zval_add_ref, (void *) &tmp_copy, sizeof(zval *));
}
}
@@ -1386,7 +1391,7 @@ ZEND_METHOD(reflection_function, invoke)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC(reflection_function_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
params = safe_emalloc(sizeof(zval **), argc, 0);
@@ -1446,7 +1451,7 @@ ZEND_METHOD(reflection_function, invokeArgs)
zend_function *fptr;
zval *param_array;
METHOD_NOTSTATIC(reflection_function_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "a", &param_array) == FAILURE) {
@@ -1497,7 +1502,7 @@ ZEND_METHOD(reflection_function, returnsReference)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC(reflection_function_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_BOOL(fptr->op_array.return_reference);
@@ -1511,7 +1516,7 @@ ZEND_METHOD(reflection_function, getNumberOfParameters)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC(reflection_function_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_LONG(fptr->common.num_args);
@@ -1525,7 +1530,7 @@ ZEND_METHOD(reflection_function, getNumberOfRequiredParameters)
reflection_object *intern;
zend_function *fptr;
METHOD_NOTSTATIC(reflection_function_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
RETURN_LONG(fptr->common.required_num_args);
@@ -1541,7 +1546,7 @@ ZEND_METHOD(reflection_function, getParameters)
zend_uint i;
struct _zend_arg_info *arg_info;
METHOD_NOTSTATIC(reflection_function_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(fptr);
arg_info= fptr->common.arg_info;
@@ -1703,7 +1708,7 @@ ZEND_METHOD(reflection_parameter, __toString)
parameter_reference *param;
string str;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
string_init(&str);
_parameter_string(&str, param->fptr, param->arg_info, param->offset, param->required, "" TSRMLS_CC);
@@ -1715,7 +1720,7 @@ ZEND_METHOD(reflection_parameter, __toString)
Returns this parameters's name */
ZEND_METHOD(reflection_parameter, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -1727,19 +1732,22 @@ ZEND_METHOD(reflection_parameter, getClass)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
if (!param->arg_info->class_name) {
RETURN_NULL();
} else {
zend_class_entry **pce;
if (zend_lookup_class_ex(param->arg_info->class_name, param->arg_info->class_name_len, 1, &pce TSRMLS_CC) == FAILURE) {
char *lcname = do_alloca(param->arg_info->class_name_len + 1);
zend_str_tolower_copy(lcname, param->arg_info->class_name, param->arg_info->class_name_len);
if (zend_hash_find(EG(class_table), lcname, param->arg_info->class_name_len + 1, (void **) &pce) == FAILURE) {
free_alloca(lcname);
zend_throw_exception_ex(reflection_exception_ptr, 0 TSRMLS_CC,
"Class %s does not exist", param->arg_info->class_name);
return;
}
free_alloca(lcname);
zend_reflection_class_factory(*pce, return_value TSRMLS_CC);
}
}
@@ -1752,7 +1760,7 @@ ZEND_METHOD(reflection_parameter, isArray)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->arg_info->array_type_hint);
@@ -1766,7 +1774,7 @@ ZEND_METHOD(reflection_parameter, allowsNull)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->arg_info->allow_null);
@@ -1780,7 +1788,7 @@ ZEND_METHOD(reflection_parameter, isPassedByReference)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->arg_info->pass_by_reference);
@@ -1794,7 +1802,7 @@ ZEND_METHOD(reflection_parameter, isOptional)
reflection_object *intern;
parameter_reference *param;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
RETVAL_BOOL(param->offset >= param->required);
@@ -1809,7 +1817,7 @@ ZEND_METHOD(reflection_parameter, isDefaultValueAvailable)
parameter_reference *param;
zend_op *precv;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
if (param->fptr->type != ZEND_USER_FUNCTION)
@@ -1836,7 +1844,7 @@ ZEND_METHOD(reflection_parameter, getDefaultValue)
zend_op *precv;
zval *zv, zv_copy;
METHOD_NOTSTATIC_NUMPARAMS(reflection_parameter_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(param);
if (param->fptr->type != ZEND_USER_FUNCTION)
@@ -1945,7 +1953,7 @@ ZEND_METHOD(reflection_method, __toString)
zend_function *mptr;
string str;
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(mptr);
string_init(&str);
_function_string(&str, mptr, "" TSRMLS_CC);
@@ -1968,7 +1976,7 @@ ZEND_METHOD(reflection_method, invoke)
zend_fcall_info_cache fcc;
zend_class_entry *obj_ce;
METHOD_NOTSTATIC(reflection_method_ptr);
METHOD_NOTSTATIC;
if (argc < 1) {
zend_error(E_WARNING, "Invoke() expects at least one parameter, none given");
@@ -2072,7 +2080,7 @@ ZEND_METHOD(reflection_method, invokeArgs)
zend_class_entry *obj_ce;
zval *param_array;
METHOD_NOTSTATIC(reflection_method_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(mptr);
@@ -2215,7 +2223,7 @@ ZEND_METHOD(reflection_method, isConstructor)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(mptr);
/* we need to check if the ctor is the ctor of the class level we we
* looking at since we might be looking at an inherited old style ctor
@@ -2231,7 +2239,7 @@ ZEND_METHOD(reflection_method, isDestructor)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_DTOR);
}
@@ -2244,7 +2252,7 @@ ZEND_METHOD(reflection_method, getModifiers)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC_NUMPARAMS(reflection_method_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(mptr);
RETURN_LONG(mptr->common.fn_flags);
@@ -2258,7 +2266,7 @@ ZEND_METHOD(reflection_method, getDeclaringClass)
reflection_object *intern;
zend_function *mptr;
METHOD_NOTSTATIC(reflection_method_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(mptr);
zend_reflection_class_factory(mptr->common.scope, return_value TSRMLS_CC);
@@ -2342,7 +2350,7 @@ ZEND_METHOD(reflection_class, getStaticProperties)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
zend_update_class_constants(ce TSRMLS_CC);
@@ -2428,7 +2436,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
zend_class_entry *ce;
int count;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
@@ -2448,7 +2456,7 @@ ZEND_METHOD(reflection_class, getDefaultProperties)
zend_hash_get_current_key_ex(&ce->default_properties, &key, &key_len, &num_index, 0, &pos);
zend_hash_move_forward_ex(&ce->default_properties, &pos);
zend_unmangle_property_name_ex(key, key_len, &class_name, &prop_name);
zend_unmangle_property_name(key, &class_name, &prop_name);
if (class_name && class_name[0] != '*' && strcmp(class_name, ce->name)) {
/* filter privates from base classes */
continue;
@@ -2474,7 +2482,7 @@ ZEND_METHOD(reflection_class, __toString)
zend_class_entry *ce;
string str;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
string_init(&str);
_class_string(&str, ce, intern->obj, "" TSRMLS_CC);
@@ -2486,7 +2494,7 @@ ZEND_METHOD(reflection_class, __toString)
Returns the class' name */
ZEND_METHOD(reflection_class, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -2498,7 +2506,7 @@ ZEND_METHOD(reflection_class, isInternal)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_INTERNAL_CLASS);
}
@@ -2511,7 +2519,7 @@ ZEND_METHOD(reflection_class, isUserDefined)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->type == ZEND_USER_CLASS);
}
@@ -2524,7 +2532,7 @@ ZEND_METHOD(reflection_class, getFileName)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
RETURN_STRING(ce->filename, 1);
@@ -2540,7 +2548,7 @@ ZEND_METHOD(reflection_class, getStartLine)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_FUNCTION) {
RETURN_LONG(ce->line_start);
@@ -2556,7 +2564,7 @@ ZEND_METHOD(reflection_class, getEndLine)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS) {
RETURN_LONG(ce->line_end);
@@ -2572,7 +2580,7 @@ ZEND_METHOD(reflection_class, getDocComment)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->type == ZEND_USER_CLASS && ce->doc_comment) {
RETURN_STRINGL(ce->doc_comment, ce->doc_comment_len, 1);
@@ -2588,7 +2596,7 @@ ZEND_METHOD(reflection_class, getConstructor)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->constructor) {
@@ -2608,7 +2616,7 @@ ZEND_METHOD(reflection_class, hasMethod)
char *name, *lc_name;
int name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2635,7 +2643,7 @@ ZEND_METHOD(reflection_class, getMethod)
char *name, *lc_name;
int name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2681,7 +2689,7 @@ ZEND_METHOD(reflection_class, getMethods)
long filter = 0;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (argc) {
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
return;
@@ -2708,7 +2716,7 @@ ZEND_METHOD(reflection_class, hasProperty)
int name_len;
zval *property;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2742,7 +2750,7 @@ ZEND_METHOD(reflection_class, getProperty)
char *name;
int name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2789,7 +2797,7 @@ ZEND_METHOD(reflection_class, getProperties)
long filter = 0;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (argc) {
if (zend_parse_parameters(argc TSRMLS_CC, "|l", &filter) == FAILURE) {
return;
@@ -2815,7 +2823,7 @@ ZEND_METHOD(reflection_class, hasConstant)
char *name;
int name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2837,7 +2845,7 @@ ZEND_METHOD(reflection_class, getConstants)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
array_init(return_value);
zend_hash_apply_with_argument(&ce->constants_table, (apply_func_arg_t) zval_update_constant, (void*)1 TSRMLS_CC);
@@ -2855,7 +2863,7 @@ ZEND_METHOD(reflection_class, getConstant)
char *name;
int name_len;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &name, &name_len) == FAILURE) {
return;
}
@@ -2876,7 +2884,7 @@ static void _class_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
RETVAL_BOOL(ce->ce_flags & mask);
}
@@ -2889,9 +2897,9 @@ ZEND_METHOD(reflection_class, isInstantiable)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS)) {
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_ABSTRACT)) {
RETURN_FALSE;
}
@@ -2936,7 +2944,7 @@ ZEND_METHOD(reflection_class, getModifiers)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_LONG(ce->ce_flags);
@@ -2951,7 +2959,7 @@ ZEND_METHOD(reflection_class, isInstance)
zend_class_entry *ce;
zval *object;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "o", &object) == FAILURE) {
return;
}
@@ -2969,7 +2977,7 @@ ZEND_METHOD(reflection_class, newInstance)
zend_class_entry *ce;
int argc = ZEND_NUM_ARGS();
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
object_init_ex(return_value, ce);
@@ -3027,7 +3035,7 @@ ZEND_METHOD(reflection_class, getInterfaces)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
/* Return an empty array if this class implements no interfaces */
@@ -3053,7 +3061,7 @@ ZEND_METHOD(reflection_class, getParentClass)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC_NUMPARAMS(reflection_class_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->parent) {
@@ -3072,7 +3080,7 @@ ZEND_METHOD(reflection_class, isSubclassOf)
zend_class_entry *ce, **pce, *class_ce;
zval *class_name;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &class_name) == FAILURE) {
@@ -3118,7 +3126,7 @@ ZEND_METHOD(reflection_class, implementsInterface)
zend_class_entry *ce, *interface_ce, **pce;
zval *interface;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &interface) == FAILURE) {
@@ -3167,7 +3175,7 @@ ZEND_METHOD(reflection_class, isIterateable)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
RETURN_BOOL(ce->get_iterator != NULL);
@@ -3181,7 +3189,7 @@ ZEND_METHOD(reflection_class, getExtension)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->module) {
@@ -3197,7 +3205,7 @@ ZEND_METHOD(reflection_class, getExtensionName)
reflection_object *intern;
zend_class_entry *ce;
METHOD_NOTSTATIC(reflection_class_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ce);
if (ce->module) {
@@ -3302,7 +3310,7 @@ ZEND_METHOD(reflection_property, __construct)
ZVAL_STRINGL(classname, ce->name, ce->name_length, 1);
zend_hash_update(Z_OBJPROP_P(object), "class", sizeof("class"), (void **) &classname, sizeof(zval *), NULL);
zend_unmangle_property_name_ex(property_info->name, property_info->name_length, &class_name, &prop_name);
zend_unmangle_property_name(property_info->name, &class_name, &prop_name);
MAKE_STD_ZVAL(propname);
ZVAL_STRING(propname, prop_name, 1);
zend_hash_update(Z_OBJPROP_P(object), "name", sizeof("name"), (void **) &propname, sizeof(zval *), NULL);
@@ -3324,7 +3332,7 @@ ZEND_METHOD(reflection_property, __toString)
property_reference *ref;
string str;
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ref);
string_init(&str);
_property_string(&str, ref->prop, NULL, "" TSRMLS_CC);
@@ -3336,7 +3344,7 @@ ZEND_METHOD(reflection_property, __toString)
Returns the class' name */
ZEND_METHOD(reflection_property, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -3346,7 +3354,7 @@ static void _property_check_flag(INTERNAL_FUNCTION_PARAMETERS, int mask)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ref);
RETURN_BOOL(ref->prop->flags & mask);
}
@@ -3398,7 +3406,7 @@ ZEND_METHOD(reflection_property, getModifiers)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ref);
RETURN_LONG(ref->prop->flags);
@@ -3414,7 +3422,7 @@ ZEND_METHOD(reflection_property, getValue)
zval *object;
zval **member= NULL;
METHOD_NOTSTATIC(reflection_property_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ref);
if (!(ref->prop->flags & ZEND_ACC_PUBLIC)) {
@@ -3440,7 +3448,6 @@ ZEND_METHOD(reflection_property, getValue)
*return_value= **member;
zval_copy_ctor(return_value);
INIT_PZVAL(return_value);
}
/* }}} */
@@ -3457,7 +3464,7 @@ ZEND_METHOD(reflection_property, setValue)
zval *tmp;
HashTable *prop_table;
METHOD_NOTSTATIC(reflection_property_ptr);
METHOD_NOTSTATIC;
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->prop->flags & ~(ZEND_ACC_PUBLIC|ZEND_ACC_STATIC)) {
@@ -3471,7 +3478,6 @@ ZEND_METHOD(reflection_property, setValue)
return;
}
}
zend_update_class_constants(intern->ce TSRMLS_CC);
prop_table = intern->ce->static_members;
} else {
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "oz", &object, &value) == FAILURE) {
@@ -3516,7 +3522,7 @@ ZEND_METHOD(reflection_property, getDeclaringClass)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ref);
zend_reflection_class_factory(ref->ce, return_value TSRMLS_CC);
@@ -3529,7 +3535,7 @@ ZEND_METHOD(reflection_property, getDocComment)
reflection_object *intern;
property_reference *ref;
METHOD_NOTSTATIC_NUMPARAMS(reflection_property_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(ref);
if (ref->prop->doc_comment) {
RETURN_STRINGL(ref->prop->doc_comment, ref->prop->doc_comment_len, 1);
@@ -3592,7 +3598,7 @@ ZEND_METHOD(reflection_extension, __toString)
zend_module_entry *module;
string str;
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(module);
string_init(&str);
_extension_string(&str, module, "" TSRMLS_CC);
@@ -3604,7 +3610,7 @@ ZEND_METHOD(reflection_extension, __toString)
Returns this extension's name */
ZEND_METHOD(reflection_extension, getName)
{
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
_default_get_entry(getThis(), "name", sizeof("name"), return_value TSRMLS_CC);
}
/* }}} */
@@ -3616,7 +3622,7 @@ ZEND_METHOD(reflection_extension, getVersion)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(module);
/* An extension does not necessarily have a version number */
@@ -3635,7 +3641,7 @@ ZEND_METHOD(reflection_extension, getFunctions)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3683,7 +3689,7 @@ ZEND_METHOD(reflection_extension, getConstants)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3715,7 +3721,7 @@ ZEND_METHOD(reflection_extension, getINIEntries)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3751,7 +3757,7 @@ ZEND_METHOD(reflection_extension, getClasses)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
@@ -3766,7 +3772,7 @@ ZEND_METHOD(reflection_extension, getClassNames)
reflection_object *intern;
zend_module_entry *module;
METHOD_NOTSTATIC_NUMPARAMS(reflection_extension_ptr, 0);
METHOD_NOTSTATIC_NUMPARAMS(0);
GET_REFLECTION_OBJECT_PTR(module);
array_init(return_value);
+101 -120
View File
@@ -13,8 +13,6 @@
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
@@ -1098,7 +1096,6 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2;
zval **container = GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET);
zval *dim = GET_OP2_ZVAL_PTR(BP_VAR_R);
/* Not needed in DIM_UNSET
@@ -1106,12 +1103,7 @@ ZEND_VM_HANDLER(96, ZEND_FETCH_DIM_UNSET, VAR|CV, CONST|TMP|VAR|CV)
PZVAL_LOCK(*EX_T(opline->op1.u.var).var.ptr_ptr);
}
*/
if (OP1_TYPE == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC);
zend_fetch_dimension_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_ZVAL_PTR_PTR(BP_VAR_UNSET), dim, IS_OP2_TMP_FREE(), BP_VAR_UNSET TSRMLS_CC);
FREE_OP2();
FREE_OP1_VAR_PTR();
if (EX_T(opline->result.u.var).var.ptr_ptr == NULL) {
@@ -1269,18 +1261,12 @@ ZEND_VM_HANDLER(97, ZEND_FETCH_OBJ_UNSET, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op1, free_op2, free_res;
zval **container = GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R);
zval *property = GET_OP2_ZVAL_PTR(BP_VAR_R);
if (OP1_TYPE == IS_CV) {
if (container != &EG(uninitialized_zval_ptr)) {
SEPARATE_ZVAL_IF_NOT_REF(container);
}
}
if (IS_OP2_TMP_FREE()) {
MAKE_REAL_ZVAL_PTR(property);
}
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), container, property, BP_VAR_R TSRMLS_CC);
zend_fetch_property_address(RETURN_VALUE_UNUSED(&opline->result)?NULL:&EX_T(opline->result.u.var), GET_OP1_OBJ_ZVAL_PTR_PTR(BP_VAR_R), property, BP_VAR_R TSRMLS_CC);
if (IS_OP2_TMP_FREE()) {
zval_ptr_dtor(&property);
} else {
@@ -1438,7 +1424,8 @@ ZEND_VM_HANDLER(43, ZEND_JMPZ, CONST|TMP|VAR|CV, ANY)
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
#endif
ZEND_VM_JMP(opline->op2.u.jmp_addr);
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr);
ZEND_VM_CONTINUE_JMP();
}
ZEND_VM_NEXT_OPCODE();
@@ -1455,7 +1442,8 @@ ZEND_VM_HANDLER(44, ZEND_JMPNZ, CONST|TMP|VAR|CV, ANY)
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
#endif
ZEND_VM_JMP(opline->op2.u.jmp_addr);
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr);
ZEND_VM_CONTINUE_JMP();
}
ZEND_VM_NEXT_OPCODE();
@@ -1472,12 +1460,14 @@ ZEND_VM_HANDLER(45, ZEND_JMPZNZ, CONST|TMP|VAR|CV, ANY)
#if DEBUG_ZEND>=2
printf("Conditional jmp on true to %d\n", opline->extended_value);
#endif
ZEND_VM_JMP(&EX(op_array)->opcodes[opline->extended_value]);
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->extended_value]);
ZEND_VM_CONTINUE(); /* CHECK_ME */
} else {
#if DEBUG_ZEND>=2
printf("Conditional jmp on false to %d\n", opline->op2.u.opline_num);
#endif
ZEND_VM_JMP(&EX(op_array)->opcodes[opline->op2.u.opline_num]);
ZEND_VM_SET_OPCODE(&EX(op_array)->opcodes[opline->op2.u.opline_num]);
ZEND_VM_CONTINUE_JMP();
}
}
@@ -1494,7 +1484,8 @@ ZEND_VM_HANDLER(46, ZEND_JMPZ_EX, CONST|TMP|VAR|CV, ANY)
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
#endif
ZEND_VM_JMP(opline->op2.u.jmp_addr);
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr);
ZEND_VM_CONTINUE_JMP();
}
ZEND_VM_NEXT_OPCODE();
}
@@ -1512,7 +1503,8 @@ ZEND_VM_HANDLER(47, ZEND_JMPNZ_EX, CONST|TMP|VAR|CV, ANY)
#if DEBUG_ZEND>=2
printf("Conditional jmp to %d\n", opline->op2.u.opline_num);
#endif
ZEND_VM_JMP(opline->op2.u.jmp_addr);
ZEND_VM_SET_OPCODE(opline->op2.u.jmp_addr);
ZEND_VM_CONTINUE_JMP();
}
ZEND_VM_NEXT_OPCODE();
}
@@ -1627,7 +1619,7 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
int function_name_strlen;
zend_free_op free_op1, free_op2;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
function_name = GET_OP2_ZVAL_PTR(BP_VAR_R);
@@ -1638,6 +1630,8 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
function_name_strval = function_name->value.str.val;
function_name_strlen = function_name->value.str.len;
EX(calling_scope) = EG(scope);
EX(object) = GET_OP1_OBJ_ZVAL_PTR(BP_VAR_R);
if (EX(object) && EX(object)->type == IS_OBJECT) {
@@ -1668,6 +1662,12 @@ ZEND_VM_HANDLER(112, ZEND_INIT_METHOD_CALL, TMP|VAR|UNUSED|CV, CONST|TMP|VAR|CV)
}
}
if (EX(fbc)->type == ZEND_USER_FUNCTION) {
EX(calling_scope) = EX(fbc)->common.scope;
} else {
EX(calling_scope) = NULL;
}
FREE_OP2();
FREE_OP1_IF_VAR();
@@ -1680,7 +1680,7 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
zval *function_name;
zend_class_entry *ce;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
ce = EX_T(opline->op1.u.var).class_entry;
if(OP2_TYPE != IS_UNUSED) {
@@ -1715,6 +1715,8 @@ ZEND_VM_HANDLER(113, ZEND_INIT_STATIC_METHOD_CALL, ANY, CONST|TMP|VAR|UNUSED|CV)
EX(fbc) = ce->constructor;
}
EX(calling_scope) = EX(fbc)->common.scope;
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
@@ -1735,7 +1737,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
int function_name_strlen;
zend_free_op free_op2;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
if (OP2_TYPE == IS_CONST) {
function_name_strval = opline->op2.u.constant.value.str.val;
@@ -1761,6 +1763,7 @@ ZEND_VM_HANDLER(59, ZEND_INIT_FCALL_BY_NAME, ANY, CONST|TMP|VAR|CV)
FREE_OP2();
}
EX(calling_scope) = function->common.scope;
EX(object) = NULL;
EX(fbc) = function;
@@ -1777,7 +1780,6 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zval *current_this;
int return_value_used = RETURN_VALUE_USED(opline);
zend_bool should_change_scope;
zend_op *ctor_opline;
if (EX(function_state).function->common.fn_flags & ZEND_ACC_ABSTRACT) {
zend_error_noreturn(E_ERROR, "Cannot call abstract method %s::%s()", EX(function_state).function->common.scope->name, EX(function_state).function->common.function_name);
@@ -1794,7 +1796,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
current_this = EG(This);
EG(This) = EX(object);
current_scope = EG(scope);
EG(scope) = (EX(function_state).function->type == ZEND_USER_FUNCTION || !EX(object)) ? EX(function_state).function->common.scope : NULL;
EG(scope) = EX(calling_scope);
} else {
should_change_scope = 0;
}
@@ -1816,8 +1818,6 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
}
}
if (EX(function_state).function->type == ZEND_INTERNAL_FUNCTION) {
unsigned char return_reference = EX(function_state).function->common.return_reference;
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
@@ -1852,10 +1852,10 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
*/
if (!return_value_used) {
zval_ptr_dtor(&EX_T(opline->result.u.var).var.ptr);
} else {
EX_T(opline->result.u.var).var.fcall_returned_reference = return_reference;
}
} else if (EX(function_state).function->type == ZEND_USER_FUNCTION) {
HashTable *calling_symbol_table;
EX_T(opline->result.u.var).var.ptr = NULL;
if (EG(symtable_cache_ptr)>=EG(symtable_cache)) {
/*printf("Cache hit! Reusing %x\n", symtable_cache[symtable_cache_ptr]);*/
@@ -1865,6 +1865,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zend_hash_init(EX(function_state).function_symbol_table, 0, NULL, ZVAL_PTR_DTOR, 0);
/*printf("Cache miss! Initialized %x\n", function_state.function_symbol_table);*/
}
calling_symbol_table = EG(active_symbol_table);
EG(active_symbol_table) = EX(function_state).function_symbol_table;
original_return_value = EG(return_value_ptr_ptr);
EG(return_value_ptr_ptr) = EX_T(opline->result.u.var).var.ptr_ptr;
@@ -1894,7 +1895,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
zend_hash_clean(EX(function_state).function_symbol_table);
*(++EG(symtable_cache_ptr)) = EX(function_state).function_symbol_table;
}
EG(active_symbol_table) = EX(symbol_table);
EG(active_symbol_table) = calling_symbol_table;
} else { /* ZEND_OVERLOADED_FUNCTION */
ALLOC_ZVAL(EX_T(opline->result.u.var).var.ptr);
INIT_ZVAL(*(EX_T(opline->result.u.var).var.ptr));
@@ -1919,18 +1920,16 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
}
}
ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
if (EG(This)) {
if (EG(exception) && ctor_opline) {
if (RETURN_VALUE_USED(ctor_opline)) {
EG(This)->refcount--;
}
if (EG(exception) && EX(fbc) && EX(fbc)->common.fn_flags&ZEND_ACC_CTOR) {
EG(This)->refcount--;
if (EG(This)->refcount == 1) {
zend_object_store_ctor_failed(EG(This) TSRMLS_CC);
}
}
if (should_change_scope) {
if (should_change_scope && EG(This) != current_this) {
zval_ptr_dtor(&EG(This));
}
} else if (should_change_scope) {
zval_ptr_dtor(&EG(This));
}
}
@@ -1939,7 +1938,7 @@ ZEND_VM_HELPER(zend_do_fcall_common_helper, ANY, ANY)
EG(This) = current_this;
EG(scope) = current_scope;
}
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
zend_ptr_stack_3_pop(&EG(arg_types_stack), (void**)&EX(calling_scope), (void**)&EX(object), (void**)&EX(fbc));
EX(function_state).function = (zend_function *) EX(op_array);
EG(function_state_ptr) = &EX(function_state);
@@ -1967,12 +1966,13 @@ ZEND_VM_HANDLER(60, ZEND_DO_FCALL, CONST, ANY)
zend_free_op free_op1;
zval *fname = GET_OP1_ZVAL_PTR(BP_VAR_R);
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), NULL);
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
if (zend_hash_find(EG(function_table), fname->value.str.val, fname->value.str.len+1, (void **) &EX(function_state).function)==FAILURE) {
zend_error_noreturn(E_ERROR, "Unknown function: %s()", fname->value.str.val);
zend_error_noreturn(E_ERROR, "Unknown function: %s()\n", fname->value.str.val);
}
EX(object) = NULL;
EX(calling_scope) = EX(function_state).function->common.scope;
FREE_OP1();
@@ -2171,9 +2171,6 @@ ZEND_VM_HELPER(zend_send_by_var_helper, VAR|CV, ANY)
ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
{
zend_op *opline = EX(opline);
zend_free_op free_op1;
zval *varptr;
if (opline->extended_value & ZEND_ARG_COMPILE_TIME_BOUND) { /* Had function_ptr at compile_time */
if (!(opline->extended_value & ZEND_ARG_SEND_BY_REF)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
@@ -2181,27 +2178,23 @@ ZEND_VM_HANDLER(106, ZEND_SEND_VAR_NO_REF, VAR|CV, ANY)
} else if (!ARG_SHOULD_BE_SENT_BY_REF(EX(fbc), opline->op2.u.opline_num)) {
ZEND_VM_DISPATCH_TO_HELPER(zend_send_by_var_helper);
}
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
if ((!(opline->extended_value & ZEND_ARG_SEND_FUNCTION) ||
EX_T(opline->op1.u.var).var.fcall_returned_reference) &&
varptr != &EG(uninitialized_zval) &&
(PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
varptr->is_ref = 1;
varptr->refcount++;
zend_ptr_stack_push(&EG(argument_stack), varptr);
if ((opline->extended_value & ZEND_ARG_SEND_FUNCTION) &&
!EX_T(opline->op1.u.var).var.fcall_returned_reference) {
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
} else {
zval *valptr;
zval *varptr;
zend_free_op free_op1;
varptr = GET_OP1_ZVAL_PTR(BP_VAR_R);
zend_error(E_STRICT, "Only variables should be passed by reference");
ALLOC_ZVAL(valptr);
INIT_PZVAL_COPY(valptr, varptr);
if (!IS_OP1_TMP_FREE()) {
zval_copy_ctor(valptr);
if (varptr != &EG(uninitialized_zval) && (PZVAL_IS_REF(varptr) || varptr->refcount == 1)) {
varptr->is_ref = 1;
varptr->refcount++;
zend_ptr_stack_push(&EG(argument_stack), varptr);
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE();
}
zend_ptr_stack_push(&EG(argument_stack), valptr);
zend_error_noreturn(E_ERROR, "Only variables can be passed by reference");
}
FREE_OP1_IF_VAR();
ZEND_VM_NEXT_OPCODE();
}
@@ -2333,24 +2326,26 @@ ZEND_VM_HANDLER(50, ZEND_BRK, ANY, CONST|TMP|VAR|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op2;
zend_brk_cont_element *el;
el = zend_brk_cont(GET_OP2_ZVAL_PTR(BP_VAR_R), opline->op1.u.opline_num,
EX(op_array), EX(Ts) TSRMLS_CC);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes +
zend_brk_cont(GET_OP2_ZVAL_PTR(BP_VAR_R),
opline->op1.u.opline_num,
EX(op_array), EX(Ts) TSRMLS_CC)->brk);
FREE_OP2();
ZEND_VM_JMP(EX(op_array)->opcodes + el->brk);
ZEND_VM_CONTINUE(); /* CHECK_ME */
}
ZEND_VM_HANDLER(51, ZEND_CONT, ANY, CONST|TMP|VAR|CV)
{
zend_op *opline = EX(opline);
zend_free_op free_op2;
zend_brk_cont_element *el;
el = zend_brk_cont(GET_OP2_ZVAL_PTR(BP_VAR_R), opline->op1.u.opline_num,
EX(op_array), EX(Ts) TSRMLS_CC);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes +
zend_brk_cont(GET_OP2_ZVAL_PTR(BP_VAR_R),
opline->op1.u.opline_num,
EX(op_array), EX(Ts) TSRMLS_CC)->cont);
FREE_OP2();
ZEND_VM_JMP(EX(op_array)->opcodes + el->cont);
ZEND_VM_CONTINUE(); /* CHECK_ME */
}
ZEND_VM_HANDLER(48, ZEND_CASE, CONST|TMP|VAR|CV, CONST|TMP|VAR|CV)
@@ -2420,18 +2415,24 @@ ZEND_VM_HANDLER(68, ZEND_NEW, ANY, ANY)
} else {
zval_ptr_dtor(&object_zval);
}
ZEND_VM_JMP(EX(op_array)->opcodes + opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes + opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
} else {
SELECTIVE_PZVAL_LOCK(object_zval, &opline->result);
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
EX_T(opline->result.u.var).var.ptr = object_zval;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), opline);
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(calling_scope));
/* We are not handling overloaded classes right now */
EX(object) = object_zval;
EX(fbc) = constructor;
if (constructor->type == ZEND_USER_FUNCTION) { /* HACK!! */
EX(calling_scope) = constructor->common.scope;
} else {
EX(calling_scope) = NULL;
}
ZEND_VM_NEXT_OPCODE();
}
}
@@ -2725,6 +2726,7 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
if (inc_filename==&tmp_inc_filename) {
zval_dtor(&tmp_inc_filename);
}
FREE_OP1();
EX_T(opline->result.u.var).var.ptr_ptr = &EX_T(opline->result.u.var).var.ptr;
if (new_op_array) {
zval *saved_object;
@@ -2774,7 +2776,6 @@ ZEND_VM_HANDLER(73, ZEND_INCLUDE_OR_EVAL, CONST|TMP|VAR|CV, ANY)
EX_T(opline->result.u.var).var.ptr->type = IS_BOOL;
}
}
FREE_OP1();
EG(return_value_ptr_ptr) = original_return_value;
ZEND_VM_NEXT_OPCODE();
}
@@ -2806,14 +2807,12 @@ ZEND_VM_HANDLER(74, ZEND_UNSET_VAR, CONST|TMP|VAR|CV, ANY)
do {
int i;
if (ex->op_array) {
for (i = 0; i < ex->op_array->last_var; i++) {
if (ex->op_array->vars[i].hash_value == hash_value &&
ex->op_array->vars[i].name_len == varname->value.str.len &&
!memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) {
ex->CVs[i] = NULL;
break;
}
for (i = 0; i < ex->op_array->last_var; i++) {
if (ex->op_array->vars[i].hash_value == hash_value &&
ex->op_array->vars[i].name_len == varname->value.str.len &&
!memcmp(ex->op_array->vars[i].name, varname->value.str.val, varname->value.str.len)) {
ex->CVs[i] = NULL;
break;
}
}
ex = ex->prev_execute_data;
@@ -2864,7 +2863,7 @@ ZEND_VM_HANDLER(75, ZEND_UNSET_DIM, VAR|UNUSED|CV, CONST|TMP|VAR|CV)
ulong hash_value = zend_inline_hash_func(offset->value.str.val, offset->value.str.len+1);
for (ex = EXECUTE_DATA; ex; ex = ex->prev_execute_data) {
if (ex->op_array && ex->symbol_table == ht) {
if (ex->symbol_table == ht) {
int i;
for (i = 0; i < ex->op_array->last_var; i++) {
@@ -2967,7 +2966,8 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
} else if (Z_TYPE_PP(array_ptr_ptr) == IS_OBJECT) {
if(Z_OBJ_HT_PP(array_ptr_ptr)->get_class_entry == NULL) {
zend_error(E_WARNING, "foreach() can not iterate over objects without PHP class");
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
}
ce = Z_OBJCE_PP(array_ptr_ptr);
@@ -3062,7 +3062,8 @@ ZEND_VM_HANDLER(77, ZEND_FE_RESET, CONST|TMP|VAR|CV, ANY)
FREE_OP1_IF_VAR();
}
if (is_empty) {
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
} else {
ZEND_VM_NEXT_OPCODE();
}
@@ -3088,7 +3089,8 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
default:
case ZEND_ITER_INVALID:
zend_error(E_WARNING, "Invalid argument supplied for foreach()");
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
case ZEND_ITER_PLAIN_OBJECT: {
char *class_name, *prop_name;
@@ -3098,14 +3100,15 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
do {
if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
/* reached end of iteration */
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
}
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 0, NULL);
zend_hash_move_forward(fe_ht);
} while (key_type != HASH_KEY_IS_STRING || zend_check_property_access(zobj, str_key TSRMLS_CC) != SUCCESS);
if (use_key) {
zend_unmangle_property_name_ex(str_key, str_key_len, &class_name, &prop_name);
zend_unmangle_property_name(str_key, &class_name, &prop_name);
str_key_len = strlen(prop_name);
str_key = estrndup(prop_name, str_key_len);
str_key_len++;
@@ -3117,7 +3120,8 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
fe_ht = HASH_OF(array);
if (zend_hash_get_current_data(fe_ht, (void **) &value)==FAILURE) {
/* reached end of iteration */
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
}
if (use_key) {
key_type = zend_hash_get_current_key_ex(fe_ht, &str_key, &str_key_len, &int_key, 1, NULL);
@@ -3144,7 +3148,8 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
zval_ptr_dtor(&array);
ZEND_VM_NEXT_OPCODE();
}
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
}
iter->funcs->get_current_data(iter, &value TSRMLS_CC);
if (EG(exception)) {
@@ -3154,7 +3159,8 @@ ZEND_VM_HANDLER(78, ZEND_FE_FETCH, VAR, ANY)
}
if (!value) {
/* failure in get_current_data */
ZEND_VM_JMP(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_SET_OPCODE(EX(op_array)->opcodes+opline->op2.u.opline_num);
ZEND_VM_CONTINUE_JMP();
}
if (use_key) {
if (iter->funcs->get_current_key) {
@@ -3417,16 +3423,10 @@ ZEND_VM_HANDLER(79, ZEND_EXIT, CONST|TMP|VAR|UNUSED|CV, ANY)
ZEND_VM_HANDLER(57, ZEND_BEGIN_SILENCE, ANY, ANY)
{
zend_op *opline = EX(opline);
EX_T(opline->result.u.var).tmp_var.value.lval = EG(error_reporting);
EX_T(opline->result.u.var).tmp_var.type = IS_LONG; /* shouldn't be necessary */
if (EX(old_error_reporting) == NULL) {
EX(old_error_reporting) = &EX_T(opline->result.u.var).tmp_var;
}
if (EG(error_reporting)) {
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
}
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), "0", 1, ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
ZEND_VM_NEXT_OPCODE();
}
@@ -3441,16 +3441,13 @@ ZEND_VM_HANDLER(58, ZEND_END_SILENCE, TMP, ANY)
zend_op *opline = EX(opline);
zval restored_error_reporting;
if (!EG(error_reporting) && EX_T(opline->op1.u.var).tmp_var.value.lval != 0) {
if (!EG(error_reporting)) {
restored_error_reporting.type = IS_LONG;
restored_error_reporting.value.lval = EX_T(opline->op1.u.var).tmp_var.value.lval;
convert_to_string(&restored_error_reporting);
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zendi_zval_dtor(restored_error_reporting);
}
if (EX(old_error_reporting) == &EX_T(opline->op1.u.var).tmp_var) {
EX(old_error_reporting) = NULL;
}
ZEND_VM_NEXT_OPCODE();
}
@@ -3577,7 +3574,6 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
int i;
int encapsulating_block=-1;
zval **stack_zval_pp;
zval restored_error_reporting;
stack_zval_pp = (zval **) EG(argument_stack).top_element - 1;
while (*stack_zval_pp != NULL) {
@@ -3599,27 +3595,12 @@ ZEND_VM_HANDLER(149, ZEND_HANDLE_EXCEPTION, ANY, ANY)
}
while (EX(fbc)) {
zend_op *ctor_opline = (zend_op*)zend_ptr_stack_pop(&EG(arg_types_stack));
if (EX(object)) {
if (ctor_opline && RETURN_VALUE_USED(ctor_opline)) {
EX(object)->refcount--;
}
zval_ptr_dtor(&EX(object));
}
zend_ptr_stack_2_pop(&EG(arg_types_stack), (void**)&EX(object), (void**)&EX(fbc));
zend_ptr_stack_n_pop(&EG(arg_types_stack), 3, &EX(calling_scope), &EX(object), &EX(fbc));
}
/* restore previous error_reporting value */
if (!EG(error_reporting) && EX(old_error_reporting) != NULL && EX(old_error_reporting)->value.lval != 0) {
restored_error_reporting.type = IS_LONG;
restored_error_reporting.value.lval = EX(old_error_reporting)->value.lval;
convert_to_string(&restored_error_reporting);
zend_alter_ini_entry("error_reporting", sizeof("error_reporting"), Z_STRVAL(restored_error_reporting), Z_STRLEN(restored_error_reporting), ZEND_INI_USER, ZEND_INI_STAGE_RUNTIME);
zendi_zval_dtor(restored_error_reporting);
}
EX(old_error_reporting) = NULL;
if (encapsulating_block == -1) {
ZEND_VM_RETURN_FROM_EXECUTE_LOOP();
} else {
+397 -375
View File
File diff suppressed because it is too large. Load diff
-1
View File
@@ -10,7 +10,6 @@ ZEND_API void {%EXECUTOR_NAME%}(zend_op_array *op_array TSRMLS_DC)
/* Initialize execute_data */
EX(fbc) = NULL;
EX(object) = NULL;
EX(old_error_reporting) = NULL;
if (op_array->T < TEMP_VAR_STACK_LIMIT) {
EX(Ts) = (temp_variable *) do_alloca(sizeof(temp_variable) * op_array->T);
} else {
+2 -21
View File
@@ -1,23 +1,4 @@
<?php
/*
+----------------------------------------------------------------------+
| Zend Engine |
+----------------------------------------------------------------------+
| Copyright (c) 1998-2005 Zend Technologies Ltd. (http://www.zend.com) |
+----------------------------------------------------------------------+
| This source file is subject to version 2.00 of the Zend license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.zend.com/license/2_00.txt. |
| If you did not receive a copy of the Zend license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
$Id$
*/
$header_text = <<< DATA
/*
@@ -35,11 +16,11 @@ $header_text = <<< DATA
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
/* \$Id$ */
DATA;
+2 -2
View File
@@ -13,11 +13,11 @@
| license@zend.com so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Authors: Andi Gutmans <andi@zend.com> |
| Zeev Suraski <zeev@zend.com> |
| Dmitry Stogov <dmitry@zend.com> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#define ZEND_NOP 0
#define ZEND_ADD 1
#define ZEND_SUB 2
+79 -90
View File
@@ -255,14 +255,14 @@ dnl append to the array which has been dynamically chosen at m4 time
dnl choose the right compiler/flags/etc. for the source-file
case $ac_src in
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
*.c[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.s[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.S[)] ac_comp="$b_c_pre $3 $ac_inc $b_c_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_c_post" ;;
*.cpp|*.cc|*.cxx[)] ac_comp="$b_cxx_pre $3 $ac_inc $b_cxx_meta -c $ac_srcdir$ac_src -o $ac_bdir$ac_obj.$b_lo $6$b_cxx_post" ;;
esac
dnl create a rule for the object/source combo
cat >>Makefile.objects<<EOF
cat >>Makefile.objects<<EOF
$ac_bdir[$]ac_obj.lo: $ac_srcdir[$]ac_src
$ac_comp
EOF
@@ -301,27 +301,27 @@ dnl
AC_DEFUN([PHP_RUNPATH_SWITCH],[
AC_MSG_CHECKING([if compiler supports -R])
AC_CACHE_VAL(php_cv_cc_dashr,[
SAVE_LIBS=$LIBS
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
LIBS=$SAVE_LIBS])
SAVE_LIBS=$LIBS
LIBS="-R /usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_dashr=yes, php_cv_cc_dashr=no)
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$php_cv_cc_dashr])
if test $php_cv_cc_dashr = "yes"; then
ld_runpath_switch=-R
ld_runpath_switch=-R
else
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
AC_CACHE_VAL(php_cv_cc_rpath,[
SAVE_LIBS=$LIBS
LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$php_cv_cc_rpath])
if test $php_cv_cc_rpath = "yes"; then
ld_runpath_switch=-Wl,-rpath,
else
dnl something innocuous
ld_runpath_switch=-L
fi
AC_MSG_CHECKING([if compiler supports -Wl,-rpath,])
AC_CACHE_VAL(php_cv_cc_rpath,[
SAVE_LIBS=$LIBS
LIBS="-Wl,-rpath,/usr/$PHP_LIBDIR $LIBS"
AC_TRY_LINK([], [], php_cv_cc_rpath=yes, php_cv_cc_rpath=no)
LIBS=$SAVE_LIBS])
AC_MSG_RESULT([$php_cv_cc_rpath])
if test $php_cv_cc_rpath = "yes"; then
ld_runpath_switch=-Wl,-rpath,
else
dnl something innocuous
ld_runpath_switch=-L
fi
fi
])
@@ -856,7 +856,7 @@ AC_DEFUN([PHP_SHARED_MODULE],[
;;
*netware*[)]
suffix=nlm
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) ifelse($1, php5lib, , -L$(top_builddir)/netware -lphp5lib) $(translit(ifelse($1, php5lib, $1, m4_substr($1, 3)),a-z_-,A-Z__)_SHARED_LIBADD)'
link_cmd='$(LIBTOOL) --mode=link ifelse($4,,[$(CC)],[$(CXX)]) $(COMMON_FLAGS) $(CFLAGS_CLEAN) $(EXTRA_CFLAGS) $(LDFLAGS) -o [$]@ -shared -export-dynamic -avoid-version -prefer-pic -module -rpath $(phplibdir) $(EXTRA_LDFLAGS) $($2) $(translit($1,a-z_-,A-Z__)_SHARED_LIBADD)'
;;
*[)]
suffix=la
@@ -951,13 +951,11 @@ dnl ---------------------------------------------- Static module
dnl ---------------------------------------------- Shared module
PHP_ADD_SOURCES_X(PHP_EXT_DIR($1),$2,$ac_extra,shared_objects_$1,yes)
case $host_alias in
*netware*[)]
PHP_SHARED_MODULE(php$1,shared_objects_$1, $ext_builddir, $6)
;;
*[)]
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
;;
*netware*)
PHP_ADD_LIBRARY_WITH_PATH(php5lib, netware, translit($1,a-z_-,A-Z__)_SHARED_LIBADD)
;;
esac
PHP_SHARED_MODULE($1,shared_objects_$1, $ext_builddir, $6)
AC_DEFINE_UNQUOTED([COMPILE_DL_]translit($1,a-z_-,A-Z__), 1, Whether to build $1 as dynamic module)
fi
fi
@@ -973,13 +971,6 @@ dnl ---------------------------------------------- CLI static module
EXT_CLI_STATIC="$EXT_CLI_STATIC $1"
fi
PHP_ADD_BUILD_DIR($ext_builddir)
dnl Set for phpize builds only
dnl ---------------------------
if test "$ext_builddir" = "."; then
PHP_PECL_EXTENSION=$1
PHP_SUBST(PHP_PECL_EXTENSION)
fi
])
dnl
@@ -1245,16 +1236,16 @@ AC_DEFUN([PHP_READDIR_R_TYPE],[
#endif
main() {
DIR *dir;
char entry[sizeof(struct dirent)+PATH_MAX];
struct dirent *pentry = (struct dirent *) &entry;
DIR *dir;
char entry[sizeof(struct dirent)+PATH_MAX];
struct dirent *pentry = (struct dirent *) &entry;
dir = opendir("/");
if (!dir)
exit(1);
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
exit(0);
exit(1);
dir = opendir("/");
if (!dir)
exit(1);
if (readdir_r(dir, (struct dirent *) entry, &pentry) == 0)
exit(0);
exit(1);
}
],[
ac_cv_what_readdir_r=POSIX
@@ -1385,17 +1376,17 @@ AC_DEFUN([PHP_AC_BROKEN_SNPRINTF],[
AC_TRY_RUN([
#define NULL (0L)
main() {
char buf[20];
int res = 0;
res = res || (snprintf(buf, 2, "marcus") != 6);
res = res || (buf[1] != '\0');
/* Implementations may consider this as an encoding error */
snprintf(buf, 0, "boerger");
/* However, they MUST ignore the pointer */
res = res || (buf[0] != 'm');
res = res || (snprintf(NULL, 0, "boerger") != 7);
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
exit(res);
char buf[20];
int res = 0;
res = res || (snprintf(buf, 2, "marcus") != 6);
res = res || (buf[1] != '\0');
/* Implementations may consider this as an encoding error */
snprintf(buf, 0, "boerger");
/* However, they MUST ignore the pointer */
res = res || (buf[0] != 'm');
res = res || (snprintf(NULL, 0, "boerger") != 7);
res = res || (snprintf(buf, sizeof(buf), "%f", 0.12345678) != 8);
exit(res);
}
],[
ac_cv_broken_snprintf=no
@@ -1426,16 +1417,14 @@ AC_DEFUN([PHP_SOLARIS_PIC_WEIRDNESS],[
if test -n "$EXT_SHARED"; then
os=`uname -sr 2>/dev/null`
case $os in
"SunOS 5.6"|"SunOS 5.7"[)]
case $CC in
gcc*|egcs*)
CFLAGS="$CFLAGS -fPIC";;
*[)]
CFLAGS="$CFLAGS -fpic";;
esac
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
"SunOS 5.6"|"SunOS 5.7"[)]
case $CC in
gcc*|egcs*) CFLAGS="$CFLAGS -fPIC";;
*[)] CFLAGS="$CFLAGS -fpic";;
esac
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
esac
else
AC_MSG_RESULT([no])
@@ -1569,10 +1558,10 @@ AC_DEFUN([PHP_BROKEN_GETCWD],[
os=`uname -sr 2>/dev/null`
case $os in
SunOS*[)]
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
AC_DEFINE(HAVE_BROKEN_GETCWD,1, [Define if system has broken getcwd])
AC_MSG_RESULT([yes]);;
*[)]
AC_MSG_RESULT([no]);;
esac
])
@@ -1592,8 +1581,8 @@ int main(int argc, char *argv[])
fp = fopen(filename, "w");
if (fp == NULL) {
perror("fopen");
exit(2);
perror("fopen");
exit(2);
}
fputs("foobar", fp);
fclose(fp);
@@ -1603,7 +1592,7 @@ int main(int argc, char *argv[])
fclose(fp);
unlink(filename);
if (position == 0)
return 1;
return 1;
return 0;
}
],
@@ -1621,10 +1610,10 @@ choke me
)])
if test "$have_broken_glibc_fopen_append" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_BROKEN_GLIBC_FOPEN_APPEND,1, [Define if your glibc borks on fopen with mode a+])
else
AC_MSG_RESULT(no)
AC_MSG_RESULT(no)
fi
])
@@ -1653,7 +1642,7 @@ AC_TRY_RUN([
#include <stdio.h>
struct cookiedata {
__off64_t pos;
__off64_t pos;
};
__ssize_t reader(void *cookie, char *buffer, size_t size)
@@ -1672,7 +1661,7 @@ main() {
FILE *fp = fopencookie(&g, "r", funcs);
if (fp && fseek(fp, 8192, SEEK_SET) == 0 && g.pos == 8192)
exit(0);
exit(0);
exit(1);
}
@@ -1906,14 +1895,14 @@ AC_DEFUN([PHP_C_BIGENDIAN],
[
int main(void)
{
short one = 1;
char *cp = (char *)&one;
short one = 1;
char *cp = (char *)&one;
if (*cp == 0) {
return(0);
} else {
return(1);
}
if (*cp == 0) {
return(0);
} else {
return(1);
}
}
], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown])
])
@@ -2344,7 +2333,7 @@ AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
set $libxml_full_version
IFS=$ac_IFS
LIBXML_VERSION=`expr [$]1 \* 1000000 + [$]2 \* 1000 + [$]3`
if test "$LIBXML_VERSION" -ge "2006011"; then
if test "$LIBXML_VERSION" -ge "2006000"; then
LIBXML_LIBS=`$XML2_CONFIG --libs`
LIBXML_INCS=`$XML2_CONFIG --cflags`
PHP_EVAL_LIBLINE($LIBXML_LIBS, $1)
@@ -2367,7 +2356,7 @@ AC_CACHE_CHECK([for xml2-config path], ac_cv_php_xml2_config_path,
fi
$2
else
AC_MSG_ERROR([libxml2 version 2.6.11 or greater required.])
AC_MSG_ERROR([libxml2 version 2.6.0 or greater required.])
fi
ifelse([$3],[],,[else $3])
fi
@@ -2386,7 +2375,7 @@ AC_DEFUN([PHP_INSTALL_HEADERS],[
ifelse([$2],[],[
for header_file in $1; do
PHP_RUN_ONCE(INSTALLHEADERS, $header_file, [
INSTALL_HEADERS="$INSTALL_HEADERS $header_file"
INSTALL_EXT_HEADERS="$INSTALL_EXT_HEADERS $header_file"
])
done
], [
@@ -2394,7 +2383,7 @@ AC_DEFUN([PHP_INSTALL_HEADERS],[
for header_file in $2; do
hp_hf="$header_path/$header_file"
PHP_RUN_ONCE(INSTALLHEADERS, $hp_hf, [
INSTALL_HEADERS="$INSTALL_HEADERS $hp_hf"
INSTALL_EXT_HEADERS="$INSTALL_EXT_HEADERS $hp_hf"
])
done
])
+8 -13
View File
@@ -42,7 +42,7 @@ AC_CONFIG_HEADER(main/php_config.h)
MAJOR_VERSION=5
MINOR_VERSION=1
RELEASE_VERSION=0
EXTRA_VERSION=""
EXTRA_VERSION="RC1"
VERSION="$MAJOR_VERSION.$MINOR_VERSION.$RELEASE_VERSION$EXTRA_VERSION"
dnl Define where extension directories are located in the configure context
@@ -874,13 +874,10 @@ if test "$PHP_PEAR" != "no"; then
pear_error_msg="$pear_error_msg
PEAR requires XML to be enabled. Add --enable-xml to the configure line. (or --without-pear)"
fi
dnl
dnl if test "$PHP_XMLRPC" = "no"; then
dnl pear_error_msg="$pear_error_msg
dnl PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
dnl fi
dnl
if test "$PHP_XMLRPC" = "no"; then
pear_error_msg="$pear_error_msg
PEAR requires XML-RPC to be enabled. Add --with-xmlrpc to the configure line. (or --without-pear)"
fi
if test "$pear_error_msg"; then
AC_MSG_ERROR([$pear_error_msg])
@@ -1129,7 +1126,7 @@ PHP_SUBST(WARNING_LEVEL)
PHP_SUBST(PHP_FRAMEWORKS)
PHP_SUBST(PHP_FRAMEWORKPATH)
PHP_SUBST_OLD(SHLIB_SUFFIX_NAME)
PHP_SUBST(INSTALL_HEADERS)
PHP_SUBST(INSTALL_EXT_HEADERS)
old_CC=$CC
@@ -1181,7 +1178,7 @@ INLINE_CFLAGS="$INLINE_CFLAGS $standard_libtool_flag"
CXXFLAGS="$CXXFLAGS $standard_libtool_flag"
all_targets='$(OVERALL_TARGET) $(PHP_MODULES) $(PHP_CLI_TARGET)'
install_targets="$install_modules install-build install-headers install-programs $install_pear"
install_targets="$install_modules $install_pear install-build install-headers install-programs"
case $PHP_SAPI in
cgi)
@@ -1198,8 +1195,6 @@ esac
PHP_SUBST(all_targets)
PHP_SUBST(install_targets)
PHP_INSTALL_HEADERS([Zend/ TSRM/ include/ main/ main/streams/ regex/])
PHP_ADD_SOURCES(TSRM, TSRM.c tsrm_strtok_r.c tsrm_virtual_cwd.c)
PHP_ADD_SOURCES(main, main.c snprintf.c spprintf.c php_sprintf.c \
@@ -1369,7 +1364,7 @@ X
fi
# Warn about linking Apache with libpthread if oci8 extension is enabled on linux.
if test "$PHP_OCI8" != "no"; then
if test "$PHP_OCI8" != "no" -o "$PHP_ORACLE" != "no"; then
if test "$PHP_SAPI" = "apache"; then
if test `uname` = "Linux"; then
cat <<X
+1 -1
View File
@@ -441,7 +441,7 @@ PHP_FUNCTION(bzdecompress)
char *source, *dest;
int source_len, error;
long small = 0;
#if defined(PHP_WIN32)
#if defined(PHP_WIN32) && _MSC_VER < 1300
unsigned __int64 size = 0;
#else
unsigned long long size = 0;
-20
View File
@@ -1,20 +0,0 @@
--TEST--
cal_days_in_month()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
$num = cal_days_in_month(CAL_GREGORIAN, 8, 2003);
echo "There are $num days in August 2003\n";
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2003);
echo "There are $num days in February 2003\n";
$num = cal_days_in_month(CAL_GREGORIAN, 2, 2004);
echo "There are $num days in February 2004\n";
$num = cal_days_in_month(CAL_GREGORIAN, 12, 2034);
echo "There are $num days in December 2034\n";
?>
--EXPECT--
There are 31 days in August 2003
There are 28 days in February 2003
There are 29 days in February 2004
There are 31 days in December 2034
-16
View File
@@ -1,16 +0,0 @@
--TEST--
cal_to_jd()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
echo cal_to_jd(CAL_GREGORIAN, 8, 26, 74), "\n";
echo cal_to_jd(CAL_JULIAN, 8, 26, 74), "\n";
echo cal_to_jd(CAL_JEWISH, 8, 26, 74), "\n";
echo cal_to_jd(CAL_FRENCH, 8, 26, 74), "\n";
?>
--EXPECT--
1748326
1748324
374867
0
-14
View File
@@ -1,14 +0,0 @@
--TEST--
easter_days()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
echo easter_days(1999), "\n";
echo easter_days(1492), "\n";
echo easter_days(1913), "\n";
?>
--EXPECT--
14
32
2
-16
View File
@@ -1,16 +0,0 @@
--TEST--
frenchtojd()
--SKIPIF--
<?php include 'skipif.inc'; ?>
--FILE--
<?php
echo frenchtojd(-1,-1,-1), "\n";
echo frenchtojd(0,0,0), "\n";
echo frenchtojd(1,1,1), "\n";
echo frenchtojd(14,31,15), "\n";
?>
--EXPECT--
0
0
2375840
0
-4
View File
@@ -1,4 +0,0 @@
<?php
if(!extension_loaded("calendar"))
print "skip - CALENDAR extension not available";
?>
+18 -23
View File
@@ -92,39 +92,34 @@ PHP_MINFO_FUNCTION(ctype)
/* {{{ ctype
*/
#define CTYPE(iswhat) \
zval *c, tmp; \
zval *c; \
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &c) == FAILURE) \
return; \
if (Z_TYPE_P(c) == IS_LONG) { \
switch (Z_TYPE_P(c)) { \
case IS_LONG: \
if (Z_LVAL_P(c) <= 255 && Z_LVAL_P(c) >= 0) { \
RETURN_BOOL(iswhat(Z_LVAL_P(c))); \
} else if (Z_LVAL_P(c) >= -128 && Z_LVAL_P(c) < 0) { \
RETURN_BOOL(iswhat(Z_LVAL_P(c) + 256)); \
} \
tmp = *c; \
zval_copy_ctor(&tmp); \
convert_to_string(&tmp); \
} else { \
tmp = *c; \
} \
if (Z_TYPE(tmp) == IS_STRING) { \
char *p = Z_STRVAL(tmp), *e = Z_STRVAL(tmp) + Z_STRLEN(tmp); \
if (e == p) { \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
} \
while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) { \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_FALSE; \
SEPARATE_ZVAL(&c); \
convert_to_string(c); \
case IS_STRING: \
{ \
char *p = Z_STRVAL_P(c), *e = Z_STRVAL_P(c) + Z_STRLEN_P(c); \
if (e == p) { \
RETURN_FALSE; \
} \
while (p < e) { \
if(!iswhat((int)*(unsigned char *)(p++))) RETURN_FALSE; \
} \
RETURN_TRUE; \
} \
if (Z_TYPE_P(c) == IS_LONG) zval_dtor(&tmp); \
RETURN_TRUE; \
} else { \
RETURN_FALSE; \
default: \
break; \
} \
RETURN_FALSE;
/* }}} */
/* {{{ proto bool ctype_alnum(mixed c)
-11
View File
@@ -1,11 +0,0 @@
--TEST--
Bug #34645 (ctype corrupts memory when validating large numbers)
--FILE--
<?php
$id = 394829384;
var_dump(ctype_digit($id));
var_dump($id);
?>
--EXPECT--
bool(true)
int(394829384)
+1 -33
View File
@@ -36,7 +36,7 @@ if test "$PHP_CURL" != "no"; then
CURL_CONFIG=${CURL_DIR}/bin/curl-config
else
if ${CURL_DIR}/curl-config --libs > /dev/null 2>&1; then
CURL_CONFIG=${CURL_DIR}/curl-config
CURL_CONFIG=${CURL_DIR}/curl-config
fi
fi
@@ -48,38 +48,6 @@ if test "$PHP_CURL" != "no"; then
else
AC_MSG_ERROR(cURL version 7.10.5 or later is required to compile php with cURL support)
fi
AC_MSG_CHECKING([for SSL support in libcurl])
CURL_SSL=`$CURL_CONFIG --feature | $EGREP SSL`
if test "$CURL_SSL" = "SSL"; then
AC_MSG_RESULT([yes])
AC_DEFINE([HAVE_CURL_SSL], [1], [Have cURL with SSL support])
AC_MSG_CHECKING([for SSL library used])
CURL_SSL_FLAVOUR=
for i in $CURL_LIBS; do
if test "$i" = "-lssl"; then
CURL_SSL_FLAVOUR="openssl"
AC_MSG_RESULT([openssl])
AC_DEFINE([HAVE_CURL_OPENSSL], [1], [Have cURL with OpenSSL support])
AC_CHECK_HEADERS([openssl/crypto.h])
break
elif test "$i" = "-lgnutls"; then
CURL_SSL_FLAVOUR="gnutls"
AC_MSG_RESULT([gnutls])
AC_DEFINE([HAVE_CURL_GNUTLS], [1], [Have cURL with GnuTLS support])
AC_CHECK_HEADERS([gcrypt.h])
break
fi
done
if test -z "$CURL_SSL_FLAVOUR"; then
AC_MSG_RESULT([unknown!])
AC_MSG_WARN([Could not determine the type of SSL library used!])
AC_MSG_WARN([Building will fail in ZTS mode!])
fi
else
AC_MSG_RESULT([no])
fi
PHP_ADD_INCLUDE($CURL_DIR/include)
PHP_EVAL_LIBLINE($CURL_LIBS, CURL_SHARED_LIBADD)
Loaded 100 of 842 files, more files were not shown because too many files have changed in this diff. Show more