<?php
$d=10;
$i=10;
$s=10;
$fc = `$d==$i && $i==$s`;
$f = '$d + 100';
$code = 'if ((' . $fc . ') == TRUE) { return "' . $f . '";}';
$ntotal = eval($code);
?>
Any alternative for this simple code NOT using eval or for newer PHP versions.
Blancer.com Tutorials and projects
Freelance Projects, Design and Programming Tutorials
Category Added in a WPeMatico Campaign
<?php
$d=10;
$i=10;
$s=10;
$fc = `$d==$i && $i==$s`;
$f = '$d + 100';
$code = 'if ((' . $fc . ') == TRUE) { return "' . $f . '";}';
$ntotal = eval($code);
?>
Any alternative for this simple code NOT using eval or for newer PHP versions.
I´m trying to connect with MySQL and create a query, but I’m unable and I don’t know why. Hope you can help.
This is my code
$host="myhost";
$username="myusername";
$password= "mypw";
$db="mydB";
$conn = mysqli_connect($host,$username,$password,$database);
if (!$conn) {
die("Conection failed: " . mysqli_connect_error());
}
else
{
echo "Connected successfully";
}
$sql="SELECT * FROM Books ORDER BY Downloads DESC LIMIT 50";
$result = mysqli_query($conn, $sql);
if (!$result) {
die("Query error: " . mysqli_error($conn));
}
if (mysqli_num_rows($result) > 0)
{
echo "<table id='menu'><tr><td>ID</td><td>Name Book</td><td>Downloads</td></tr>";
while ($row = mysqli_fetch_assoc($result))
{
$U = $row['Link'];
$Title = $row['Title'];
$plat= $row['Genre'];
echo "<tr><td><font color='black'><p align='left'><ul type='square'><li><a href='$U' target='blank' title='Download $Titulo $plat Book'>".$Title."</a>(".$plat.")</li></ul></font>";
}
echo "</td></tr></table>";
}
else
{
die ("cannot connect");
}
mysqli_close($conn);
?>
Thank you in advance
I have detected the following unusual problem, with codeigniter4.
Install.
PHP: 8.4.10 — CodeIgniter: 4.6.1 -- Environment: development
Error.
Undefined constant KintRendererAbstractRenderer::SORT_FULL
My composer file.
{
"name": "codeigniter4/appstarter",
"description": "CodeIgniter4 starter app",
"license": "MIT",
"type": "project",
"homepage": "https://codeigniter.com",
"support": {
"forum": "https://forum.codeigniter.com/",
"source": "https://github.com/codeigniter4/CodeIgniter4",
"slack": "https://codeigniterchat.slack.com"
},
"require": {
"php": "^7.4 || ^8.0",
"codeigniter4/framework": "^4.0",
"tatter/assets": "dev-master",
"twbs/bootstrap": "v5.3.7"
},
"require-dev": {
"fakerphp/faker": "^1.9",
"kint-php/kint": "^6.0",
"mikey179/vfsstream": "^1.6",
"phpunit/phpunit": "^9.1"
},
"autoload": {
"exclude-from-classmap": [
"**/Database/Migrations/**"
]
},
"autoload-dev": {
"psr-4": {
"Tests\Support\": "tests/_support"
}
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"scripts": {
"test": "phpunit"
}
}
It’s a normal zero installation dicodeigniter 4 but instead it gives me this error.
Everything is up to date and should not be there. How can I verify that kint library loads.
I tried putting .env in production and everything works.
When it loads kint in development it gives me this error.
Does anyone know what it can be?
I have a question regarding Symfony UX Live Components and forms.
Imagine you have a Parent Component and a nested Child Component. Both are Live Components and both include Symfony FORMS (FormBuilder). However, the submit button for the child’s form is located in the Parent Component, and I use a LiveComponent emit to dispatch an event that the child’s save method listens for.
Although the event arrives correctly, I get an Invalid CSRF-TOKEN error coming from the child component.
While investigating, I discovered that Turbo UX uses the csrf_protection_controller.js Stimulus controller to generate a CSRF token. What does this imply? Must I disable Symfony’s default CSRF token handling for forms?
In my csrf.yaml, I currently have:
# Enable stateless CSRF protection for forms and logins/logouts
framework:
form:
csrf_protection:
token_id: submit
csrf_protection:
check_header: true
stateless_token_ids:
# - submit
- authenticate
- logout
When I disable the submit entry under stateless_token_ids, the form no longer raises a CSRF error. If I inspect the Symfony Profiler (under the child’s save request → Forms), it shows :
Screenshot of Symfony Profiler
Does the CSRF token still exist, and should I therefore leave submit disabled in csrf.yaml?
Why aren’t there clear references or documentation explaining that Turbo UX uses its own controller for token generation and CSRF handling?
Thank you very much!
I am trying to use spatie laravel-pdf which uses browsershot under the hood to generate a pdf. I get the bellow error only on the production server when trying to generate the pdf which seems to not include any useful information regarding the problem. The index.html file does contain the contents I’m expecting. Confirmed nodejs folder in system path env variable.
The command “node C:inetpubwwwrootmyprojectvendorspatiebrowsershotsrc/../bin/browser.cjs “{“”url””:””file://C:WindowsTEMP607378296-0455840001752189861index.html””,””action””:””pdf””,””options””:{“”args””:[],””viewport””:{“”width””:800,””height””:600},””displayHeaderFooter””:false,””margin””:{“”top””:””0.25in””,””right””:””0.25in””,””bottom””:””0.25in””,””left””:””0.25in””},””format””:””letter””,””landscape””:true,””printBackground””:true}}”” failed. Exit Code: 1(General error) Working directory: C:inetpubwwwrootmyprojectpublic Output: ================ Error Output: ================
I have the following controller method which is used to generate the pdf.
<?php
namespace AppHttpControllers;
use SpatieLaravelPdfEnumsFormat;
use SpatieLaravelPdfEnumsUnit;
use SpatieLaravelPdfFacadesPdf;
class ExportController extends Controller
{
public function pdf() {
$pdf = Pdf::view('table-pdf');
return $pdf->format(Format::Letter)
->margins(0.25, 0.25, 0.25, 0.25, Unit::Inch)
->landscape()
->name("myfile.pdf");
}
}
I’ve tried using withBrowserShot method and called setNodeBinary() and noSandbox() methods, neither of which made any difference. Any ideas as to where to start? I’ve tried uninstalling and reinstalling puppeteer which did not help.
On Almalinux 8 PHP 8.0 and 8.3 are installed.
The default php release is 8.0 (php -v = 8.0) and all running websites use php 8.0 in FPM mode.
I want to move all to php 8.3
Sites are wordpress, so I can easily change php version there, but my question is about opcache (installed on both release). I check the opcache status using opcache-gui (https://github.com/amnuts/opcache-gui) that currently shows that it is running for php 8.0
I began to move one website to 8.3. Site is working but opcache-gui doesn’t show the cached files from this site. Is it because the server default php is 8.0, so opcache-gui only shows the cached files of sites under php 8.0? So, if I set the server default php to 8.3, will opcache-gui automatically monitor the php 8.3 opcache system, or are there additional setups to do?
Thank you!
I purchased a PHP-based coupon theme for my site, and I’m trying to customize the store pages. Here’s an example page: https://flashvoucher.com/store/a2-hosting
Currently, the page shows the list of coupons dynamically fetched from the database. However, there’s no option in the theme settings to add static content (like a small paragraph or HTML block) below the coupon list. I want to add some SEO-friendly text, maybe 200–300 words about the store, right after the coupons end.
The theme uses PHP templates and seems to be built using procedural PHP (not any modern frameworks). I can edit the template files directly.
Question:
What would be the best way to inject custom content (manually or via admin, if possible) just below the dynamic content block? Should I:
Modify the template file and hardcode the HTML block?
Use output buffering or hooks (if available)?
Append content via controller logic if it exists?
Any advice or code example would be appreciated.
Telescope Version : 5.10
Laravel Version : 10.48.29
PHP Version : 8.3.11
Laravel runs in a subfolder. This means only urls starting with /foo/ get routed to Laravel’s index.php. Other urls like /telescope/ are out of laravels control. Laravel’s router is smart enough to check that it is in a subforlder and ignores /foo/ in the url when matching routes. As a result the route “/telescope” automatically get converted to “example.com/foo/telescope” when printing routes with route() and the router maps /foo/telescope to telescopes controller. Telescope is not so smart. It takes the path from the config “path” => “telescope” and creates urls starting with “/telescope”. If i change it to “path” => “foo/telescope” Laravel’s router interprets them as “/foo/foo/telescope”. This results in Telescope still being incorrect because its javascript tries to send api requests to “/foo/telescope/telescope-api” but “/foo/foo/telescope/telescope” would be correct.
I’ve tried adding this fix in the bottom part also in header in both cases the path and basePath is going back to /telescope.
@php
$url = parse_url(config('app.url'));
$basePath = isset($url['path']) ? $url['path'] . '/telescope' : 'telescope';
$path = isset($url['path']) ? ltrim($url['path'], '/') . '/telescope' : 'telescope';
$vars = LaravelTelescopeTelescope::scriptVariables();
$vars['basePath'] = $basePath;
$vars['path'] = $path;
@endphp
<script>
window.Telescope = @json($vars);
console.log(window.Telescope.basePath);
console.log(window.Telescope.path);
</script>
I have searched for 2 days! I cannot find the answer. I am not sure I am wording this question correctly. What I am doing, I have rental units, and tenants. I have a form, I want to insert data from rental units database into the tenant info database, in a radio format. EXAMPLE, I have a new tenant moving in, I need to select the rental unit they are moving into. To see what I have, go to 3602online.com click Log In in the upper right corner. Look at the bottom of the form and register, I can delete any abusive users. Now, once a member, and logged in, go to Manage Rentals tab, and on the left, select Add Tenant. Now, this is the form I am having issues with. The radio buttons show, but the data I tried to retrieve from the rental unit DB does not show! I am not great at programming, but also, not stupid! Thank you if you can help me!
<!-- Rental Unit input -->
Rental Unit:
<!-- FETCHING DATA FROM EACH ROW OF EVERY COLUMN -->
<!-- PHP CODE TO FETCH DATA FROM ROWS -->
<?php
// LOOP TILL END OF DATA
while($rows = $result->fetch_assoc()) {
?>
<br/><br/>
<input name="rental_unit" <?php echo $rows['address'];?> required type="radio" />
<?php
}
?>
I can’t add fields to the profile, user_id seems to work, the values are correct, but it doesn’t add to the field, but if I change it manually in mysql, it changes the value without errors, what should I do?
It turns out that my question is that when a user registers, in addition to the user, a profile is created that is linked by user_id, but I can’t do it no matter how much I try
I have a database, here are its migrations(profile):
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 10,
'unsigned' => true,
'auto_increment' => true,
],
'firstname' => [
'type' => 'VARCHAR',
'constraint' => '128',
'null' => true,
],
'lastname' => [
'type' => 'VARCHAR',
'constraint' => '128',
'null' => true,
],
'email' => [
'type' => 'VARCHAR',
'constraint' => '128',
'null' => true,
],
'phone' => [
'type' => 'VARCHAR',
'constraint' => '128',
'null' => true,
],
'description' => [
'type' => 'TEXT',
'constraint' => '128',
'null' => true,
],
'date_birth' => [
'type' => 'DATE',
'null' => true,
],
'avatar' => [
'type' => 'TEXT',
'null' => true,
],
'user_id' => [
'type' => 'int',
'constraint' => 11,
'unsigned' => true,
'null' => false,
],
]);
$this->forge->addForeignKey('user_id', 'user', 'id', '', 'CASCADE');
$this->forge->addPrimaryKey('id')->addUniqueKey('user_id');;
$this->forge->createTable('profile');
}
public function down()
{
$this->forge->dropTable('profile');
}
user migration:
public function up()
{
$this->forge->addField([
'id' => [
'type' => 'INT',
'constraint' => 10,
'unsigned' => true,
'auto_increment' => true,
],
'name' => [
'type' => 'VARCHAR',
'constraint' => '128',
'null' => false,
],
'password_hash' => [
'type' => 'VARCHAR',
'constraint' => '255',
'null' => false,
]
]);
$this->forge->addPrimaryKey('id')->addUniqueKey('name');
$this->forge->createTable('user', true);
}
public function down()
{
$this->forge->dropTable('user');
}
controller registration (the task when creating a user is to create a separate profile):
public function create_account()
{
$user = $this->request->getPost();
$avatar = $user['avatar'];
if ($user) {
if ($this->model->insert($user)) {
$user_id = $this->request->getPost('name');
$login = $this->model->where('name', $user_id)->first();
$session = session();
$session->set('user_id', $login->id);
$session->set('user_name', $login->name);
if (session()->has('user_id') && $this->profile->insert(['firstname' => 'ivan', 'avatar' => $avatar, 'user_id' => 18])) {
return redirect()->to('/home')->with('success', ['Вы успешно авторизовались']);
}
} else {
return redirect()->back()->with('errors', $this->model->errors())->with('warning', 'Invalid data')->withInput();
}
}
}
I have a question.
If you use Webmin or Virtualmin on Ubuntu, I use at work for website and domain security on Digital Ocean hosting. I have a question.
We want to develop a company profile website using React.JS or Vue.JS (Node.JS, npm). Can it be installed and run on a VPS server with another port?
Can it be implemented by following the server settings? Is there a tutorial? Thank you in advance for your insight.
If possible, how do you set it on this tools? If not, it will run individually.
After Upgrading to the latest Codeigniter 4 version, when I am trying to run the command
php spark publish
Then I am getting an error failed to publish to
and more specifically for the reason:
fails the following restriction for "/path/to/my/project/public/": #.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)
Details of the error:
CodeIgniter v4.6.1 Command Line Tool - Server Time: 2025-07-09 03:30:54 UTC+00:00
"AppPublishersGroceryCrudPublisher" failed to publish to "/path/to/my/project/public/".
/path/to/my/project/vendor/grocery-crud/enterprise/public/vendor/grocery-crud/static/media/index.f6d03137e8c9dd0de04c.cjs
"/path/to/my/project/vendor/grocery-crud/enterprise/public/vendor/grocery-crud/static/media/index.f6d03137e8c9dd0de04c.cjs" fails the following restriction for "/path/to/my/project/public/": #.(s?css|js|map|html?|xml|json|webmanifest|ttf|eot|woff2?|gif|jpe?g|tiff?|png|webp|bmp|ico|svg)$#i
What is the best way to fix the above? Consider that removing the .cjs
files is an option but then I am also getting same errors for .DS_Store
files. Is there any option in Codeigniter 4 to just skip copying those files instead of throwing an error?
I have already installed DataTables on my web app , i have configured its JS dan CSS as below :
here is the head JS include
<!-- Core JS Files -->
<script src="<?= base_url('assets/js/core/jquery-3.7.1.min.js') ?>"></script>
<!-- Custom Plugins Sweetalert, Cookies, Etc -->
<script src="<?= base_url('assets/js/plugins.js') ?>" type="text/javascript"></script>
<script src="<?= base_url('assets/js/core/bootstrap.bundle.min.js') ?>"></script>
<script src="<?= base_url('assets/js/core/popper.min.js') ?>"></script>
<script src="<?= base_url('assets/js/core/bootstrap-material-design.min.js') ?>"></script>
<!-- DataTables JavaScript -->
<script src="<?= base_url('assets/js/core/datatables.min.js') ?>"></script>
<script src="<?= base_url('assets/js/core/dataTables.bootstrap5.js') ?>"></script>
<script src="<?= base_url('assets/js/plugins/perfect-scrollbar.jquery.min.js') ?>"></script>
<!-- Plugin for the Sliders, full documentation here: http://refreshless.com/nouislider/ -->
<script src="<?= base_url('assets/js/plugins/nouislider.min.js') ?>"></script>
<!-- Control Center for Material Dashboard: parallax effects, scripts for the example pages etc -->
<script src="<?= base_url('assets/js/material-dashboard.js') ?>" type="text/javascript"></script>
<!-- Custom JS App -->
<script src="<?= base_url('assets/js/plugins/file-uploader/js/jquery.dm-uploader.min.js'); ?>"></script>
<script src="<?= base_url('assets/js/plugins/file-uploader/js/ui.js'); ?>"></script>
<script src="<?= base_url('assets/js/custom.js') ?>" type="text/javascript"></script>
the CSS file
<!-- CSS Files -->
<link href="<?= base_url('assets/css/dataTables.bootstrap5.css'); ?>" rel="stylesheet" />
<link href="<?= base_url('assets/css/bootstrap.min.css'); ?>" rel="stylesheet" />
<link href="<?= base_url('assets/fonts/fonts.css?v=1.0.0'); ?>" rel="stylesheet" />
<link href="<?= base_url('assets/css/material-dashboard.css'); ?>" rel="stylesheet" />
<link href="<?= base_url('assets/css/style.css?v=1.0.0'); ?>" rel="stylesheet" />
<link rel="stylesheet" href="<?= base_url('assets/js/plugins/file-uploader/css/jquery.dm-uploader.min.css'); ?>" />
<link rel="stylesheet" href="<?= base_url('assets/js/plugins/file-uploader/css/styles-1.0.css'); ?>" />
<link rel="apple-touch-icon" sizes="76x76" href="<?= base_url('assets/img/apple-icon.png'); ?>">
<link rel="icon" type="image/png" href="<?= base_url('assets/img/favicon.png'); ?>">
the script on the head :
<script>
$(document).ready(function() {
$('#example').DataTable({
responsive: true
});
});
</script>
the Data Table Section with id “example” :
<div class="card-body">
<?php if (!$empty) : ?>
<table class="table table-striped" id="example">
<thead class="text-primary">
<th width="20"><input type="checkbox" class="checkbox-table" id="checkAll"></th>
<th><b>No</b></th>
<th><b>#</b></th>
<th><b>NIS</b></th>
<th><b>Nama Siswa</b></th>
<th><b>Jenis Kelamin</b></th>
<th><b>Kelas</b></th>
<th><b>Jurusan</b></th>
<th><b>No HP</b></th>
<th width="1%"><b>Aksi</b></th>
</thead>
<tbody>
<?php $i = 1;
foreach ($data as $value) :
$photo = $value['photo'];
if($photo == NULL || $photo == '' || empty($photo)){
$photo = "profil.png";
}
?>
<tr>
<td><input type="checkbox" name="checkbox-table" class="checkbox-table" value="<?= $value['id_siswa']; ?>"></td>
<td><?= $i; ?></td>
<td><img src="<?= base_url('uploads/photo/'.$photo) ?>" width="50px" height="50px"></td>
<td><?= $value['nis']; ?></td>
<td><b><?= $value['nama_siswa']; ?></b></td>
<td><?= $value['jenis_kelamin']; ?></td>
<td><?= $value['kelas']; ?></td>
<td><?= $value['jurusan']; ?></td>
<td><?= $value['no_hp']; ?></td>
<td>
<div class="d-flex justify-content-center">
<a title="Edit" href="<?= base_url('admin/siswa/edit/' . $value['id_siswa']); ?>" class="btn btn-primary p-2" id="<?= $value['nis']; ?>">
<i class="material-icons">edit</i>
</a>
<form action="<?= base_url('admin/siswa/delete/' . $value['id_siswa']); ?>" method="post" class="d-inline">
<?= csrf_field(); ?>
<input type="hidden" name="_method" value="DELETE">
<button title="Delete" onclick="return confirm('Konfirmasi untuk menghapus data');" type="submit" class="btn btn-danger p-2" id="<?= $value['nis']; ?>">
<i class="material-icons">delete_forever</i>
</button>
</form>
<a title="Download QR Code" href="<?= base_url('admin/qr/siswa/' . $value['id_siswa'] . '/download'); ?>" class="btn btn-success p-2">
<i class="material-icons">qr_code</i>
</a>
</div>
</td>
</tr>
<?php $i++;
endforeach; ?>
</tbody>
</table>
<?php else : ?>
<div class="row">
<div class="col">
<h4 class="text-center text-danger">Data tidak ditemukan</h4>
</div>
</div>
<?php endif; ?>
</div>
the html view still not work like this :
can somebody tell me what am i doing wrong ?
I’m following VichUploader instructions to add a file upload to my form for the Item entity.
Now, if I go to any page of the site I get a raw error (without Symfony profiler and not pretty printed) about two entity names already in use :
Fatal error: Cannot declare class AppEntityItemCategory, because the name is already in use in /Users/corentoulf/DEV/boite-a-partage/src/Entity/ItemCategory.php on line 11.
Fatal error: Cannot declare class AppEntityItemType, because the name is already in use in /Users/corentoulf/DEV/boite-a-partage/src/Entity/ItemType.php on line 11
If I go to the page where the concerned form is, I get a raw error + pretty Symofny error about only the ItemType entity:
Fatal error: Cannot declare class AppEntityItemType, because the name is already in use in /Users/corentoulf/DEV/boite-a-partage/src/Entity/ItemType.php on line 11
What am I missing in VichUploader configuration that causes such errors ?
Configuration
Vich version : 2.7.0
Symfony version : 7.3.1
PHP version : 8.3.6
Vich config file
vich_uploader:
db_driver: orm
metadata:
type: attribute
auto_detection: true
mappings:
items:
uri_prefix: /images/items
upload_destination: '%kernel.project_dir%/public/images/items'
namer: VichUploaderBundleNamingSmartUniqueNamer
Item Entity
namespace AppEntity;
use AppRepositoryItemRepository;
use DoctrineCommonCollectionsArrayCollection;
use DoctrineCommonCollectionsCollection;
use DoctrineORMMapping as ORM;
use SymfonyComponentHttpFoundationFileFile;
use VichUploaderBundleMappingAnnotation as Vich;
#[ORMEntity(repositoryClass: ItemRepository::class)]
#[VichUploadable]
class Item
{
#[ORMId]
#[ORMGeneratedValue]
#[ORMColumn]
private ?int $id = null;
#[ORMManyToOne(inversedBy: 'items')]
#[ORMJoinColumn(nullable: false)]
private ?User $owner = null;
#[ORMColumn]
private ?DateTimeImmutable $created_at = null;
/**
* @var Collection<int, ItemCircle>
*/
#[ORMOneToMany(targetEntity: ItemCircle::class, mappedBy: 'item', cascade: ['persist'], orphanRemoval: true)]
private Collection $itemCircles;
#[ORMManyToOne(inversedBy: 'items')]
private ?itemType $itemType = null;
#[ORMColumn(length: 255, nullable: true)]
private ?string $property_1 = null;
#[ORMColumn(length: 255, nullable: true)]
private ?string $property_2 = null;
#[ORMColumn(length: 255, nullable: true)]
private ?string $property_3 = null;
#[ORMColumn(length: 255, nullable: true)]
private ?string $property_4 = null;
#[ORMColumn(length: 255, nullable: true)]
private ?string $property_5 = null;
// NOTE: This is not a mapped field of entity metadata, just a simple property.
#[VichUploadableField(mapping: 'items', fileNameProperty: 'imageName', size: 'imageSize', mimeType: "imageMimeType")]
private ?File $imageFile = null;
#[ORMColumn(nullable: true)]
private ?string $imageName = null;
#[ORMColumn(nullable: true)]
private ?int $imageSize = null;
#[ORMColumn(nullable: true)]
private ?int $imageMimeType = null;
#[ORMColumn(nullable: true)]
private ?DateTimeImmutable $updated_at = null;
/**
* If manually uploading a file (i.e. not using Symfony Form) ensure an instance
* of 'UploadedFile' is injected into this setter to trigger the update. If this
* bundle's configuration parameter 'inject_on_load' is set to 'true' this setter
* must be able to accept an instance of 'File' as the bundle will inject one here
* during Doctrine hydration.
*
* @param File|SymfonyComponentHttpFoundationFileUploadedFile|null $imageFile
*/
public function setImageFile(?File $imageFile = null): void
{
$this->imageFile = $imageFile;
if (null !== $imageFile) {
// It is required that at least one field changes if you are using doctrine
// otherwise the event listeners won't be called and the file is lost
$this->updated_at = new DateTimeImmutable();
}
}
public function getImageFile(): ?File
{
return $this->imageFile;
}
public function setImageName(?string $imageName): void
{
$this->imageName = $imageName;
}
public function getImageMimeType(): ?string
{
return $this->imageMimeType;
}
public function setImageMimeType(?string $imageMimeType): void
{
$this->imageMimeType = $imageMimeType;
}
public function getImageName(): ?string
{
return $this->imageName;
}
public function setImageSize(?int $imageSize): void
{
$this->imageSize = $imageSize;
}
public function getImageSize(): ?int
{
return $this->imageSize;
}
public function __construct()
{
$this->itemCircles = new ArrayCollection();
}
public function __toString()
{
return $this->property_1;
}
public function getId(): ?int
{
return $this->id;
}
public function getOwner(): ?User
{
return $this->owner;
}
public function setOwner(?User $owner): static
{
$this->owner = $owner;
return $this;
}
public function getCreatedAt(): ?DateTimeImmutable
{
return $this->created_at;
}
public function setCreatedAt(DateTimeImmutable $created_at): static
{
$this->created_at = $created_at;
return $this;
}
/**
* @return Collection<int, ItemCircle>
*/
public function getItemCircles(): Collection
{
return $this->itemCircles;
}
public function addItemCircle(ItemCircle $itemCircle): static
{
if (!$this->itemCircles->contains($itemCircle)) {
$this->itemCircles->add($itemCircle);
$itemCircle->setItem($this);
}
return $this;
}
public function removeItemCircle(ItemCircle $itemCircle): static
{
if ($this->itemCircles->removeElement($itemCircle)) {
// set the owning side to null (unless already changed)
if ($itemCircle->getItem() === $this) {
$itemCircle->setItem(null);
}
}
return $this;
}
public function getItemType(): ?itemType
{
return $this->itemType;
}
public function setItemType(?itemType $itemType): static
{
$this->itemType = $itemType;
return $this;
}
public function getProperty1(): ?string
{
return $this->property_1;
}
public function setProperty1(?string $property_1): static
{
$this->property_1 = $property_1;
return $this;
}
public function getProperty2(): ?string
{
return $this->property_2;
}
public function setProperty2(?string $property_2): static
{
$this->property_2 = $property_2;
return $this;
}
public function getProperty3(): ?string
{
return $this->property_3;
}
public function setProperty3(?string $property_3): static
{
$this->property_3 = $property_3;
return $this;
}
public function getProperty4(): ?string
{
return $this->property_4;
}
public function setProperty4(?string $property_4): static
{
$this->property_4 = $property_4;
return $this;
}
public function getProperty5(): ?string
{
return $this->property_5;
}
public function setProperty5(?string $property_5): static
{
$this->property_5 = $property_5;
return $this;
}
}
Here is my pattern:
/^(?:include|require)(?:_once)*[^"']*['"]([^'"]+)['"]/i
I want to find all three of these lines:
include MODX_CORE_PATH . 'test.php';
require_once MODX_CORE_PATH . 'components/dirwalker/model/dirwalker/dirwalker.class.php';
include MODX_CORE_PATH . 'aaaDummy/aaaDummy.txt';
The Rubular regex tester finds all three, but in my code I’m only getting the first one. I’m sure it’s something simple and obvious, but I can’t see it.